My colleague Greg figured out why my 74hc163 counter IC wasn't working. The problem was not the counter - it was the 74hc04 IC I was using as an ersatz logic probe. With the 150 Ohm resistors I was using, the LEDs were consuming more current than the 74hc04 could supply.
Greg gave me a ULN2803A peripheral driver IC which is capable of sinking 500 mA per pin, which is more than ample for lighting an LED. I modified my "logic probe" circuit, and now everything is working nicely. As a side-benefit, I now have 8 inputs rather than just 6.
A picture:
Now the 74hc163 properly rolls over from 1111 (15) to 0 (0000). Next experiment - cascading two 74hc163's to make an 8-bit counter.
Monday, August 31, 2009
Friday, August 28, 2009
Hmm...now I'm confused
I replaced the 74HC163 which was behaving strangely with a 74LS163. I also changed my "logic probe" circuit to use a 74HCT04 instead of a 74HC04 for the inputs, in order to cope with the LS-TTL output levels.
Well, strangely enough, the modified circuit also jumps from a count of 1111 to a count of 0001. Obviously, there is something I don't understand about the '163.
Feh.
Well, strangely enough, the modified circuit also jumps from a count of 1111 to a count of 0001. Obviously, there is something I don't understand about the '163.
Feh.
74hc163 counter has a bug?
I have been playing around with some 74hc163 chips that I have. These are 4-bit synchronous counters with a parallel load capability. When both counter-enable inputs are logic high, and a positive clock edge arrives, the counter value increases by 1.
Oddly, the 74hc163 chips that I have seem to have a bug! When the counter value is at 1111 (i.e., 15, the highest possible count), and a positive clock edge arrives, the count changes to 0001 rather than 0000. From all of the 74hc163 datasheets I have seen, the count should wrap-around back to 0.
I'm pretty sure I have wired the circuit correctly. There are no floating inputs, for example.
The chips are labeled "SP74HC163N", and the manufacturer seems to be "SPI".
Here's a picture of the circuit with the 74hc163:
The following two pictures show LEDs which follow the '163 output. The 4 LEDs to the left are bits 0 through 3 of the count. The two LEDs on the right are showing the values at the -LOAD and enable inputs. (Note that they are both high, meaning that the counter is in counting mode.)
Here's how things look when the count is at 1111:
And here's how things look after one positive clock edge:
That's clearly not zero!
Oddly, the 74hc163 chips that I have seem to have a bug! When the counter value is at 1111 (i.e., 15, the highest possible count), and a positive clock edge arrives, the count changes to 0001 rather than 0000. From all of the 74hc163 datasheets I have seen, the count should wrap-around back to 0.
I'm pretty sure I have wired the circuit correctly. There are no floating inputs, for example.
The chips are labeled "SP74HC163N", and the manufacturer seems to be "SPI".
Here's a picture of the circuit with the 74hc163:
The following two pictures show LEDs which follow the '163 output. The 4 LEDs to the left are bits 0 through 3 of the count. The two LEDs on the right are showing the values at the -LOAD and enable inputs. (Note that they are both high, meaning that the counter is in counting mode.)
Here's how things look when the count is at 1111:
And here's how things look after one positive clock edge:
That's clearly not zero!
Saturday, August 22, 2009
Neat logic synthesis freeware
I was trying to minimize a boolean circuit for a project I'm working on, and I found a really nice program called Simple Solver:
http://home.roadrunner.com/~ssolver/index.html
You type in a truth table, and it spits out a boolean equation and/or circuit that generates the correct output. You can constrain the part types, which of course is very useful if you're using discrete parts (e.g., 74HC gates).
For the problem I gave it, Simple Solver found a solution using 4 NAND gates, which exactly fits in a single 74HC00. Sweet.
Simple Solver can also generate circuits using flip-flops based on user-specified timing diagrams, which is a feature I'm planning to investigate at some point.
http://home.roadrunner.com/~ssolver/index.html
You type in a truth table, and it spits out a boolean equation and/or circuit that generates the correct output. You can constrain the part types, which of course is very useful if you're using discrete parts (e.g., 74HC gates).
For the problem I gave it, Simple Solver found a solution using 4 NAND gates, which exactly fits in a single 74HC00. Sweet.
Simple Solver can also generate circuits using flip-flops based on user-specified timing diagrams, which is a feature I'm planning to investigate at some point.
Friday, August 21, 2009
Electronics stuff
I've been having a lot of fun playing with electronics this summer. I completed my AVR microcontroller project, which involved designing a custom circuit board and having it manufactured. More details soon.
Since I feel like I have a reasonable handle on working with AVRs, I'm currently taking a step back, and learning about low-level digital circuits - gates, flip-flops, etc.
Several important issues arise when building digital circuits:
The thing at the lower-right with the two wires sticking out of it is a single-row header socket, which is very handy for allowing wires to be plugged into a circuit on the fly. I will spare you a picture of the underside, where you can see how bad I am at soldering things. In any case, the thing works, and is useful for generating both reset and clock signals.
I addressed problem number 3 (visualizing logic levels) using a pair of 74HC04 (hex inverter) ICs to control 6 LEDs. Each input is fed through a pair of inverters, where the output of the second inverter controls the LED. So, the LED is lit if the input is high, and is dark when the input is low. Basically, each input is a really simple logic probe. (I found out by experience that you can't use a 74HC output to both light an LED and also drive an input.) The only minor hassle is that you have to tie the unused inputs to ground, but that's not a big deal. A picture:
Here, the LEDs are showing the output of (one half of) a 74HC139 2-to-4 decoder driven by a 74HC74 dual D-type flip-flop used as a 2-bit counter. When the clock button is pressed, the dark LED (the '139 decoder has active-low outputs) cycles through positions 0 (left) through 3 (third LED from the right). The last two LEDs are unused.
Since I feel like I have a reasonable handle on working with AVRs, I'm currently taking a step back, and learning about low-level digital circuits - gates, flip-flops, etc.
Several important issues arise when building digital circuits:
- You need to have a power-on reset to get all of the stateful circuit elements into a well-defined initial state
- You need a clock source
- To understand what is going on in the circuit, you need a way of visualizing the logic levels at important points
The thing at the lower-right with the two wires sticking out of it is a single-row header socket, which is very handy for allowing wires to be plugged into a circuit on the fly. I will spare you a picture of the underside, where you can see how bad I am at soldering things. In any case, the thing works, and is useful for generating both reset and clock signals.
I addressed problem number 3 (visualizing logic levels) using a pair of 74HC04 (hex inverter) ICs to control 6 LEDs. Each input is fed through a pair of inverters, where the output of the second inverter controls the LED. So, the LED is lit if the input is high, and is dark when the input is low. Basically, each input is a really simple logic probe. (I found out by experience that you can't use a 74HC output to both light an LED and also drive an input.) The only minor hassle is that you have to tie the unused inputs to ground, but that's not a big deal. A picture:
Here, the LEDs are showing the output of (one half of) a 74HC139 2-to-4 decoder driven by a 74HC74 dual D-type flip-flop used as a 2-bit counter. When the clock button is pressed, the dark LED (the '139 decoder has active-low outputs) cycles through positions 0 (left) through 3 (third LED from the right). The last two LEDs are unused.
Subscribe to:
Posts (Atom)