Lecture 5 - Counters
Asynchronous ripple counter
This one is easy to implement and understand, but the outputs do not
all change simultaneously. It takes some finite time for transistors
to change state, and thus for each flipflop to alter its output, which
is the clock input for the next flipflop.
Each T-flipflop divides its clock input frequency by two. Cascading
them produces slower and slower frequency outputs. Note that here
we clock each flipflop directly off the output of the preceeding flipflop,
whereas in the lecture notes there is a NOT gate on the output. This
is because the flipflops used here are trailing edge triggered, meaning
that they change when the clock drops low. Most flipflops are
leading edge triggered, meaning that they change when the clock goes
high.
{
"width":500,
"height":500,
"showToolbox":false,
"toolbox":[
],
"devices":[
{"type":"LED","id":"dev0","x":416,"y":96,"label":"LED"},
{"type":"T-FF","id":"dev1","x":256,"y":104,"label":"T-FF"},
{"type":"T-FF","id":"dev2","x":256,"y":168,"label":"T-FF"},
{"type":"LED","id":"dev3","x":416,"y":160,"label":"LED"},
{"type":"T-FF","id":"dev4","x":256,"y":240,"label":"T-FF"},
{"type":"LED","id":"dev5","x":416,"y":232,"label":"LED"},
{"type":"4bit7seg","id":"dev6","x":400,"y":296,"label":"4bit7seg"},
{"type":"DC","id":"dev7","x":112,"y":160,"label":"DC"},
{"type":"OSC","id":"dev8","x":112,"y":112,"label":"OSC","freq":"1"}
],
"connectors":[
{"from":"dev0.in0","to":"dev1.out0"},
{"from":"dev1.in0","to":"dev7.out0"},
{"from":"dev1.in1","to":"dev8.out0"},
{"from":"dev2.in0","to":"dev7.out0"},
{"from":"dev2.in1","to":"dev1.out0"},
{"from":"dev3.in0","to":"dev2.out0"},
{"from":"dev4.in0","to":"dev7.out0"},
{"from":"dev4.in1","to":"dev2.out0"},
{"from":"dev5.in0","to":"dev4.out0"},
{"from":"dev6.in0","to":"dev1.out0"},
{"from":"dev6.in1","to":"dev2.out0"},
{"from":"dev6.in2","to":"dev4.out0"}
]
}
Synchronous counter
This counter has the advantage that all the outputs change at the same
time because all the flipflops are clocked from the same signal.
Each T-flipflop is toggled only when all the lower bit flipflops
are high.
{
"width":500,
"height":500,
"showToolbox":false,
"devices":[
{"type":"T-FF","id":"dev0","x":152,"y":112,"label":"T-FF"},
{"type":"OSC","id":"dev1","x":56,"y":192,"label":"OSC","freq":1},
{"type":"LED","id":"dev2","x":440,"y":176,"label":"LED"},
{"type":"T-FF","id":"dev3","x":152,"y":184,"label":"T-FF"},
{"type":"T-FF","id":"dev4","x":152,"y":256,"label":"T-FF"},
{"type":"DC","id":"dev5","x":56,"y":104,"label":"DC"},
{"type":"AND","id":"dev6","x":272,"y":144,"label":"AND"},
{"type":"LED","id":"dev7","x":440,"y":104,"label":"LED"},
{"type":"LED","id":"dev8","x":440,"y":248,"label":"LED"},
{"type":"4bit7seg","id":"dev9","x":424,"y":312,"label":"4bit7seg"}
],
"connectors":[
{"from":"dev0.in0","to":"dev5.out0"},
{"from":"dev0.in1","to":"dev1.out0"},
{"from":"dev2.in0","to":"dev3.out0"},
{"from":"dev3.in0","to":"dev0.out0"},
{"from":"dev3.in1","to":"dev1.out0"},
{"from":"dev4.in0","to":"dev6.out0"},
{"from":"dev4.in1","to":"dev1.out0"},
{"from":"dev6.in0","to":"dev0.out0"},
{"from":"dev6.in1","to":"dev3.out0"},
{"from":"dev7.in0","to":"dev0.out0"},
{"from":"dev8.in0","to":"dev4.out0"},
{"from":"dev9.in0","to":"dev0.out0"},
{"from":"dev9.in1","to":"dev3.out0"},
{"from":"dev9.in2","to":"dev4.out0"}
]
}
Sand box
{
"width":700,
"height":500,
"showToolbox":true,
"toolbox":[
{"type":"In"},
{"type":"Out"},
{"type":"DC"},
{"type":"LED"},
{"type":"PushOff"},
{"type":"PushOn"},
{"type":"Toggle"},
{"type":"BUF"},
{"type":"NOT"},
{"type":"AND"},
{"type":"NAND"},
{"type":"OR"},
{"type":"NOR"},
{"type":"EOR"},
{"type":"ENOR"},
{"type":"OSC"},
{"type":"7seg"},
{"type":"16seg"},
{"type":"4bit7seg"},
{"type":"RotaryEncoder"},
{"type":"BusIn"},
{"type":"BusOut"},
{"type":"RS-FF"},
{"type":"JK-FF"},
{"type":"T-FF"},
{"type":"D-FF"},
{"type":"8bitCounter"},
{"type":"HalfAdder"},
{"type":"FullAdder"},
{"type":"4bitAdder"},
{"type":"2to4BinaryDecoder"},
{"type":"3to8BinaryDecoder"},
{"type":"4to16BinaryDecoder"}
],
"devices":[
{"type":"LED","id":"dev0","x":416,"y":96,"label":"LED"},
{"type":"T-FF","id":"dev1","x":256,"y":104,"label":"T-FF"},
{"type":"T-FF","id":"dev2","x":256,"y":168,"label":"T-FF"},
{"type":"LED","id":"dev3","x":416,"y":160,"label":"LED"},
{"type":"T-FF","id":"dev4","x":256,"y":240,"label":"T-FF"},
{"type":"LED","id":"dev5","x":416,"y":232,"label":"LED"},
{"type":"4bit7seg","id":"dev6","x":400,"y":296,"label":"4bit7seg"},
{"type":"DC","id":"dev7","x":112,"y":160,"label":"DC"},
{"type":"OSC","id":"dev8","x":112,"y":112,"label":"OSC","freq":"1"}
],
"connectors":[
{"from":"dev0.in0","to":"dev1.out0"},
{"from":"dev1.in0","to":"dev7.out0"},
{"from":"dev1.in1","to":"dev8.out0"},
{"from":"dev2.in0","to":"dev7.out0"},
{"from":"dev2.in1","to":"dev1.out0"},
{"from":"dev3.in0","to":"dev2.out0"},
{"from":"dev4.in0","to":"dev7.out0"},
{"from":"dev4.in1","to":"dev2.out0"},
{"from":"dev5.in0","to":"dev4.out0"},
{"from":"dev6.in0","to":"dev1.out0"},
{"from":"dev6.in1","to":"dev2.out0"},
{"from":"dev6.in2","to":"dev4.out0"}
]
}