예제 #1
0
# In[32]:

# Initiating the oscilloscope

o = Oscilloscope(
    (clk_conn, "CLK"), (b.out[0], "BIT3"), (b.out[1], "BIT2"), (b.out[2], "BIT1"), (b.out[3], "BIT0"), (enable, "EN1")
)

# starting the oscillioscope thread - This does not initiate the recording.

o.start()

# setting the scale

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

# Set the width of the oscilloscope to fit the ipython notebook.

o.setWidth(100)


# In[33]:

# unhold the oscilloscope to start the recording.

o.unhold()

# Initial State

print(b.state())
예제 #2
0
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]:

# Then unhold [ Run the Oscilloscope ]
o.unhold()

print(b.state())

# Triggering the Binary Counter 10 times.
for i in range(10):
    b.trigger()
    print(b.state())
예제 #3
0
#   1          Monostable
#   2          Astable
#   3          Bistable

out = Connector(0)

# MODE 3

m = Multivibrator(0, mode=3)

m.start()
m.setOutput(out)

o = Oscilloscope((m.A, 'OUT'))
o.start()
o.setScale(0.05)
o.unhold()

time.sleep(0.1)
m.trigger()
print(m.A())
time.sleep(0.5)
m.trigger()
print(m.A())
time.sleep(1)
m.trigger()
print(m.A())
time.sleep(2)
m.trigger()
print(m.A())
o.display()
예제 #4
0
print("Initializing Ripple Counter with 4 bits and clock_conn")
print("b = NBitRippleCounter(4, clk_conn)")
b = NBitRippleCounter(4, clk_conn)

# Initiating the oscilloscope
print("\n")
print("Initializing the Oscillioscope")
print(
    "o = Oscilloscope((clk_conn, 'CLK'), (b.out[0], 'BIT3'), (b.out[1], 'BIT2'), (\
    b.out[2], 'BIT1'), (b.out[3], 'BIT0'), (enable, 'EN1'))")
print("o.start() # starting the oscillioscope")
print("o.setScale(0.05) # setting the scale")
o = Oscilloscope((clk_conn, 'CLK'), (b.out[0], 'BIT3'), (b.out[1], 'BIT2'), (
    b.out[2], 'BIT1'), (b.out[3], 'BIT0'), (enable, 'EN1'))
o.start()
o.setScale(0.0005)  # Set scale by trial and error.
o.unhold()


print ("Initial State")
print (b.state())

print ("Triggering the counter sequentially 2^4 + 1 times")

for i in range(1, 2 ** 4 + 1):
    b.trigger()
    print (b.state())
o.display()
o.kill()

print("\n")
예제 #5
0
import time

# MODE selects the mode of operation of the multivibrator.

# Mode No. :  Description
#   1          Monostable
#   2          Astable
#   3          Bistable

out = Connector()


# MODE 2

m = Multivibrator(0, 2, on_time=0.2, off_time=0.8)

m.start()
m.setOutput(out)
m.trigger()

o = Oscilloscope((out, 'OUT'))
o.start()
o.setScale(0.2)
o.unhold()

time.sleep(10)

o.display()

m.kill()
예제 #6
0
out = Connector(0)

# <codecell>

# Initialize mutivibrator in MODE 3

m = Multivibrator(0, mode=3)
m.start()
m.setOutput(out)

# <codecell>

# Initialize the oscilloscope
o = Oscilloscope((out, 'OUT'))
o.start()
o.setScale(0.05)
o.setWidth(100)
o.unhold()
# This is done to let the oscilloscope thread to synchronize with the main
# thread...
time.sleep(0.001)

# <codecell>

# Trigger the multivibrator to change the state
print(out())
time.sleep(0.1)
m.trigger()

time.sleep(0.001)  # This is done to synchronize the multivibrator thread ...
예제 #7
0
from BinPy.tools.oscilloscope import Oscilloscope
import time

# MODE selects the mode of operation of the multivibrator.

# Mode No. :  Description
#   1          Monostable
#   2          Astable
#   3          Bistable

out = Connector()

# MODE 2

m = Multivibrator(0, 2, on_time=0.2, off_time=0.8)

m.start()
m.setOutput(out)
m.trigger()

o = Oscilloscope((out, 'OUT'))
o.start()
o.setScale(0.2)
o.unhold()

time.sleep(10)

o.display()

m.kill()
예제 #8
0
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]:

# Then unhold [ Run the Oscilloscope ]
o.unhold()

print(b.state())

# Triggering the Binary Counter 10 times.
for i in range(10):
    b.trigger()