BitScope Blogs |
2013-11-07 Breadboard One | The 4 Bit Up/Down CounterLast month we introduced the Breadboard One educational electronic projects lab. It is a simple mixed signal circuit which we're using to explain the key elements of typical mixed signal systems. Breadboard One comprises four primary circuits, the first of which is a 4 bit up/down counter. This is a purely digital component and we'll explain how it works and what its output looks like here. The counter we use is the CMOS Logic CD4029. It is a member of the CD4000 family which has been in production for almost 40 years! There are newer logic families with the same functionality such as 74HC4029 but we'll stick with the original. As you would expect, a counter counts. The block diagram shows the layout of the inputs and outputs of this component where Q4..Q1 are the four bits that comprise the binary encoded output that drive the BreadBoard's D/A convertor. The other two important signals are the CLOCK and the UP/DOWN inputs. There are other signals which we're not using in this project as well as power (Vdd) and ground (Vss) but we'll list all the signals here as you can easily experiment with them by modifying the circuit slightly if you want.
Internally the counter comprises a set of logic gates configured to implement the arithmetic addition operator (grab the data sheet for the full details). Normally the counter increments the 4 bit word (Q4,Q3,Q2,Q1) by one every time the clock input is toggled. If the UP/DOWN input is asserted the counter counts down (subtracts one) upon each clock cycle instead. These two modes of operation are what the Breadboard One project uses but we can run these two modes in isolation by modifying the circuit to simply disconnect the UP/DOWN input from the output of the SCHMITT trigger (as we will show below). The CARRY OUT and CARRY IN signals are used when more than one counter are used "in cascade". Simply connecting the CARRY OUT of one counter to the CARRY IN of a second one, an 8 bit counter can be built where Q4..Q1 of the first are the low four bits and Q4..Q1 of the second are the high four bits. The CARRY signal is generated each time the counter reaches its limit and "rolls over" (to start the count again). There are other ways to connect multiple counters (e.g. ripple counting) but refer to the data sheet for full details. The BINARY/DECADE input defines the limit; 15 (binary, 0..15) or 9 (decimal, 0..9). The remaining signals, PRESET ENABLE and J4..J1 allow the counter to be preset with a known value. Timing Diagrams and Logic AnalysisA logic diagram is the easiest way describe the operation of a digital circuit like this. For each clock cycle (at the top of the diagram) the four bits cycle in a binary encoded sequence in this case starting at 5, counting up to 15 before being "jammed" to 9 and then counting down to zero and wrapping. Our use of the counter in Breadboard One is simpler in that we're using the UP/DOWN signal but not the jam or carry and to keep it even simpler, here we've asserted the counter as always UP and we observe the result on BS10 as: The top half of the display shows the binary encoded counter output as an analog signal produced by the D/A convertor. We'll explain the operation of this component in a future post. For now it's enough to understand that it shows an analog representation of the 4 bit counter output on Q1..Q4. These signals are shown on BitScope's logic channels 0..3 (white, brown, red and orange) and you can see their combined value aligns with the analog signal level for each value. The clock input (driven by BitScope's waveform generator) is logic channel 5 (yellow) and the UP/DOWN signal is on channel 6 (green). Note that it remains high so the counter increments from 0 to 15 before wrapping and starting again. Here's the same circuit with one modification, we've pulled the UP/DOWN signal on channel 6 (green) low: It's very easy with Breadboard One to re-arrange the circuit to try all sorts of variations on this theme and observe all the signals, digital and analog, using the BitScope but for now we have the full monty: This is the complete Breadboard One circuit counting UP and then DOWN as we outlined in our earlier post describing the operation of the complete mixed signal circuit. Note the UP/DOWN signal is now toggling as driven by the SCHMITT trigger output. All of these circuit experiments and screenshots were made on our Raspberry Pi based Electronic Projects Lab using BreadBoard One. In future posts we'll explore the operation of the D/A convertor, the analog filter and SCHMITT trigger components of this circuit and explain the details of how they work together. In the meantime, here are some further experiments that you can try:
There are many other changes and tests that can be made to find out how circuits like Breadboard One work in practice compared to their theory of operation and we'll cover these issues in future posts too. Related Posts |
Copyright © 2023 BitScope Designs