TRYING TO CREATE A 4-BIT BINARY COUNTER FROM A CLOCK PULSE.
shop
Posts: 3
I created a TTL circuit using a 74193 (up/down counter) using a external clock pulse. The binary output of the 74193 is wired to a 74154 (one of sixteen decoder). The output of the 74154 is connected to 16 LEDs.
It works fine using these TTL logic IC's to control the count out of the 74154. My external clock pulse is derived from audio that is from a Schmitt trigger circuit to make it a clock pulse into the 74193.
I now want to use the Basic Stamp 2 to perform the same function, and I have run into problems programming the Basic Stamp to do this. I want the Basic Stamp to "simulate" the 74193.
I am new to the Basic Stamp, and it is not working exactly like the TTL circuit, meaning the output of the Basic Stamp binary count is to only change with the transition (low to high) of the external clock pulse.
any solutions anyone?
It works fine using these TTL logic IC's to control the count out of the 74154. My external clock pulse is derived from audio that is from a Schmitt trigger circuit to make it a clock pulse into the 74193.
I now want to use the Basic Stamp 2 to perform the same function, and I have run into problems programming the Basic Stamp to do this. I want the Basic Stamp to "simulate" the 74193.
I am new to the Basic Stamp, and it is not working exactly like the TTL circuit, meaning the output of the Basic Stamp binary count is to only change with the transition (low to high) of the external clock pulse.
any solutions anyone?
Comments
So you have to keep track of whether you have counted "this" positive transition. An easy way to do that is to, after you have incremented your counter, wait until you see the negative transition. For extra credit, implement the up/down function.
To react to the transition of the external clock from low to high your program will need some way to remember the previous state of the clock. It can do that with a 1-bit variable or by being in one of two loops ... one when the previous clock state is low and the other when the previous clock state is high.
clockPin PIN 0 ' Use pin 0 for this example ... input by default
loopLow:
IF clockPin = 0 THEN GOTO loopLow
' Here the clock pin has gone from low to high
loopHigh:
IF clockPin = 1 THEN GOTO loopHigh
' Here the clock pin has gone from high to low
GOTO loopLow
First, thank you for responding to my request for assistance with my Basic Stamp problem.
I believe I applied your solution to create a 4-bit binary counter, as I made a simple test program based on your reply. (see below)
What I notice from this program I made, is the " CLOCKPIN" goes high, the output on pin #11 is a changing a clock pulse when I check it on
my scope. I apply a steady "High" input to Pin 0, I thought the output on Pin 11 would be a steady high until i remove it.
I don't understand why the output is a clock pulse, and not a steady output. Any suggestions for me?
Shop.
' {$STAMP BS2}
' {$PBASIC 2.5}
clockPin PIN 0 ' Use pin 0 for this example ... input by default
DO
IF clockPin = 0 THEN GOTO loopLow
' Here the clock pin has gone from low to high
loopLow:
LOW 8
LOW 9
LOW 10
LOW 11
IF clockPin = 1 THEN GOTO loopHigh ' Here the clock pin has gone from low to high
loophigh:
HIGH 11
LOOP
Thanks a bunch !!
You can go the your first post and "edit advanced" to marked this "Solved".
If you can not find it, I will do it for you.