Usage of IC 7445

from __future__ import print_function
from BinPy import *
# Usage of IC 7445:

ic = IC_7445()

print(ic.__doc__)
This is a Four-to-Ten (BCD to Decimal) DECODER
datasheet at http://www.skot9000.com/ttl/datasheets/45.pdf
# The Pin configuration is:

inp = {8: 0, 12: 0, 13: 1, 14: 0, 15: 0, 16: 1}

# Pin initinalization

# Powering up the IC - using -- ic.setIC({14: 1, 7: 0})

ic.setIC({14: 1, 7: 0})

# Setting the inputs of the ic

ic.setIC(inp)

# Draw the IC with the current configuration\n

ic.drawIC()
         ┌─────────◡─────────┐
         │                   │
[Z]    ──┤  1            16  ├──    [1]
         │                   │
         │                   │
[Z]    ──┤  2      7     15  ├──    [0]
         │                   │
         │                   │
[Z]    ──┤  3      4     14  ├──    [0]
         │                   │
         │                   │
[Z]    ──┤  4      4     13  ├──    [1]
         │                   │
         │                   │
[Z]    ──┤  5      5     12  ├──    [0]
         │                   │
         │                   │
[Z]    ──┤  6            11  ├──    [Z]
         │                   │
         │                   │
[0]    ──┤  7            10  ├──    [Z]
         │                   │
         │                   │
[0]    ──┤  8             9  ├──    [Z]
         │                   │
         └───────────────────┘
# Run the IC with the current configuration using -- print ic.run() --

# Note that the ic.run() returns a dict of pin configuration similar to

print (ic.run())
{1: 1, 2: 1, 3: 1, 4: 1, 5: 0, 6: 1, 7: 1, 9: 1, 10: 1, 11: 1}
# Seting the outputs to the current IC configuration using -- ic.setIC(ic.run()) --\n

ic.setIC(ic.run())

# Draw the final configuration

ic.drawIC()
         ┌─────────◡─────────┐
         │                   │
[1]    ──┤  1            16  ├──    [1]
         │                   │
         │                   │
[1]    ──┤  2      7     15  ├──    [0]
         │                   │
         │                   │
[1]    ──┤  3      4     14  ├──    [0]
         │                   │
         │                   │
[1]    ──┤  4      4     13  ├──    [1]
         │                   │
         │                   │
[0]    ──┤  5      5     12  ├──    [0]
         │                   │
         │                   │
[1]    ──┤  6            11  ├──    [1]
         │                   │
         │                   │
[1]    ──┤  7            10  ├──    [1]
         │                   │
         │                   │
[0]    ──┤  8             9  ├──    [1]
         │                   │
         └───────────────────┘
# Seting the outputs to the current IC configuration using -- ic.setIC(ic.run()) --

ic.setIC(ic.run())

# Draw the final configuration

ic.drawIC()

# Run the IC

print (ic.run())
              ┌─────────◡─────────┐
              │                   │
     [1]    ──┤  1            16  ├──    [1]
              │                   │
              │                   │
     [1]    ──┤  2      7     15  ├──    [0]
              │                   │
              │                   │
     [1]    ──┤  3      4     14  ├──    [0]
              │                   │
              │                   │
     [1]    ──┤  4      4     13  ├──    [1]
              │                   │
              │                   │
     [0]    ──┤  5      5     12  ├──    [0]
              │                   │
              │                   │
     [1]    ──┤  6            11  ├──    [1]
              │                   │
              │                   │
     [1]    ──┤  7            10  ├──    [1]
              │                   │
              │                   │
     [0]    ──┤  8             9  ├──    [1]
              │                   │
              └───────────────────┘
{1: 1, 2: 1, 3: 1, 4: 1, 5: 0, 6: 1, 7: 1, 9: 1, 10: 1, 11: 1}
# Connector Outputs
c = Connector()

# Set the output connector to a particular pin of the ic
ic.setOutput(1, c)

print(c)
Connector; State: 1