示例#1
0
from BinPy.Gates import Connector
from BinPy.tools.oscilloscope import Oscilloscope
import time

# In[2]:

# A clock of 1 hertz frequency  With initial value as 0

clock = Clock(0, 1)
clock.start()
clk_conn = clock.A

# In[3]:

# Initializing Binary Counter with 2 bits and clock_conn
b = BinaryCounter(2, clk_conn)

# Initializing the Oscillioscope
o = Oscilloscope((clk_conn, 'CLK'), (b.out[0], 'MSB'), (b.out[1], 'LSB'))

# Starting the oscillioscope
o.start()

# Set scale by trial and error.
o.setScale(0.15)

# Set the width of the oscilloscope [ To fit the ipython Notebook ]
o.setWidth(100)

# In[4]:
示例#2
0
import time


# In[2]:

# A clock of 1 hertz frequency  With initial value as 0

clock = Clock(0, 1)
clock.start()
clk_conn = clock.A


# In[3]:

# Initializing Binary Counter with 2 bits and clock_conn
b = BinaryCounter(2, clk_conn)

# Initializing the Oscillioscope
o = Oscilloscope((clk_conn, 'CLK'), (b.out[0], 'MSB'), (b.out[1], 'LSB'))

# Starting the oscillioscope
o.start()

# Set scale by trial and error.
o.setScale(0.15)

# Set the width of the oscilloscope [ To fit the ipython Notebook ]
o.setWidth(100)


# In[4]:
示例#3
0
# Example for Binary Counter a 2 bit counter.

from __future__ import print_function
from BinPy.tools.digital import Clock
from BinPy.Sequential.counters import BinaryCounter
from BinPy.Gates import Connector

# Initialize the clock
clock = Clock(1, 1)
clock.start()
# A clock of 1 hertz frequency
clk_conn = clock.A

b = BinaryCounter(clk_conn)

print('INITIAL STATE')
print(b.state())

print('TRIGGERING THE COUNTER SEQUENTIALLY')

for i in range(5):
    b.trigger()
    print(b.state())
示例#4
0
# Example for Binary Counter a 2 bit counter.

from __future__ import print_function
from BinPy.tools.digital import Clock
from BinPy.Sequential.counters import BinaryCounter
from BinPy.Gates import Connector

# Initialize the clock
clock = Clock(1, 1)
clock.start()
# A clock of 1 hertz frequency
clk_conn = clock.A

b = BinaryCounter(clk_conn)

print ('INITIAL STATE')
print (b.state())

print ('TRIGGERING THE COUNTER SEQUENTIALLY')

for i in range(5):
    b.trigger()
    print (b.state())