Design a 4-bit Up-down Binary Counter Using

2013-11-07

Breadboard One | The 4 Bit Up/Down Counter

4 Bit Up/Down Counter Block Diagram

Breadboard One | 4 Bit Up/Down Counter Block Diagram

Last 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.

Signal Type Description
CLOCK Mixed Counter clock input.
UP/DOWN Input Increment or Decrement Count.
Q4..Q1 Output 4 bit binary encoded outputs.
J4..J1 Inputs 4 bit binary encoded "jam" inputs.
BINARY/
DECADE
Input Binary or Decade counting mode.
CARRY IN Input Counter "carry in" input.
CARRY OUT Output Counter "carry out" output.
PRESET
ENABLE
INPUT Enable the jam inputs.

CD4029 Signal Descriptions

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 Analysis

A logic diagram is the easiest way describe the operation of a digital circuit like this.

Binary Counter Logic Diagram

Binary Counter Logic Diagram

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:

Binary Counter, Mixed Signal Analysis, UP Count

Binary Counter, Mixed Signal Analysis, UP Count

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:

Binary Counter, Mixed Signal Analysis, DOWN Count

Binary Counter, Mixed Signal Analysis, DOWN Count

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:

Binary Counter, Mixed Signal Analysis, Breadboard One

Binary Counter, Mixed Signal Analysis, Breadboard One

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:

  • Pull the BINARY/DECIMAL pin to HIGH and LOW and watch the counting states.
  • Monitor the CARRY OUT pin and check it changes for UP, DOWN. Compare when it does this when BINARY and DECIMAL are selected.
  • Check that the counter changes state on the rising edge of the clock and not the falling edge.
  • Change the generated CLOCK signal (on BitScope) to a TRIANGLE wave and make measurements of the exact switching voltage of the CLOCK input. Make the CLOCK signal smaller and see when circuit stops functioning.

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

BitScope
Build a powerful mixed signal workstation with one simple 3D print ! Sep 3
Raspberry
Raspberry Pi 3 Launch and BitScope Blade Feb 29
BitScope
Physical Computing with Raspberry Pi and BitScope! Dec 01
Education
Picademy Workshop with Carrie Anne Philbin Jul 27
Raspberry
BitScope Blade for Raspberry Pi at Hannover Maker Faire! Jun 05
Software
BitScope DSO 2.9 Now Available. Jun 02
BitScope
BitScope ARM Platform Compatibility Feb 10
Education
BitScope Micro & Raspberry Pi in Education at BETT Jan 21
BitScope
BitScope Connection Ports Explained Dec 19
BitScope
BitScope Micro and Oscilloscope Probes Dec 10
Education
Electronic Measurement with BitScope & Raspberry Pi Nov 12
BitScope
Hands on with BitScope Micro at electronica 2014 Nov 11
BitScope
BitScope Micro Video Tutorial with Farnell element14 Nov 10
BitScope
BitScope Micro and Raspberry Pi at electronica 2014! Nov 06
BitScope
BitScope Micro element14 Webinar Review. Nov 03
BitScope
BitScope Micro Webinar with element14! Oct 29
BitScope
element14 launches BitScope Micro for Raspberry Pi! Oct 27
BitScope
BitScope Micro Diagnostic Port Explained. Aug 16
BitScope
BitScope Model 10 or BitScope Micro? Apr 25
BitScope
BitScope Micro, what's in the box? Apr 17
Raspberry
BitScope Micro Questions & Answers Apr 12
Raspberry
BitScope Micro (New Product) for Raspberry Pi! Apr 11
Education
BitScope Workshop at OzBerryPi Apr 8
Education
BitScope Ed at the Sydney Mini Maker Faire! Nov 20
Education
BitScope Ed at OzBerryPi, Presentation Review. Oct 21
Raspberry
How to Install BitScope DSO on Raspberry Pi Oct 18
Education
Breadboard One, a typical Mixed Signal Circuit. Oct 17
Raspberry
Electronic Projects Lab for Raspberry Pi Oct 17
BitScope
BitScope Smart Port. The clever connection. Oct 12
Education
BitScope Ed, an Educational Blog about Electronics. Oct 09
Raspberry
BitScope Software for Raspberry Pi Oscilloscope Sep 27
Raspberry
BitScope Raspberry Pi Oscilloscope Sep 25
More...

Design a 4-bit Up-down Binary Counter Using

Source: https://www.bitscope.com/ed/blog/DK/?p=DK07A

0 Response to "Design a 4-bit Up-down Binary Counter Using"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel