Binary Counter — Logic Analyzer
Build an LED Binary Counter & Improve The Code — ArduSeries #88
Hi, Let’s make an 8-bit counter with Arduino and use it to study this Logic Analyzer 24 Mhz8CH:)
To see how it works let’s bring some codes for discussion: Counters!
[TODO: COUNTING GIFS CIRCUIT WORKING GOES HERE]
Let’s initialize with some of the easiest counter codes there is to learn, then put some science and experience on it, for finally, use that cheap Logic Analyzer (24 MHz 8 Channels) and see how it works:)
After building a breadboard, here is the first program (please see this video from Paul McWhorter):
The purpose is to test the hardware (There are any LEDs burned?)
The First Code — Testing The Hardware
As you know there are many approaches to coding the 4-bit counter in Arduino; here I present what is probably the most obvious code ever. Let’s make the real 4-bit counter (brute force approach):
The Second Code — 4-bit Counter
Let’s make some improvements on the previous code; the magic number turns out to be variable for easy maintenance:)
The Third Code — 4-bit Counter Improved
The brute force approach is not applicable for counters greater than 4 bits; for 8-bit we will need to have 255 blocks to cope with all LED’s states :/
Now let’s make some real code:
The Forth Code —Sophisticated 4-bit Counter
If you want to understand the code above, please consider watching this video:
Now the last code is for the 8-bit counter:)
The Fifth Code — Sophisticated 8-bit Counter
Now let’s read at least 4 channels with Logic Analyzer (24 MHz 8 Channels).
Run the second code (_88_logicCounter_PaulMcWhorter_4bits_02.ino) and see this graph running Saleae Logic Analyzer Software.
Now run the last code — 8-bit counter () and you should see 8 channels, but unfortunately, I did not make my Chinese & cheap clone Logic Analyzer 24 Mhz8CH work for all channels: only 6 worked (and I do not discover why…may you help me?)
And that’s all.
Thanks for reading.
Have a comment? Do you know how to configure all 8 channels of this device? Please let me know below…
Bye!
Download All Files For This Project
Related Post
PIC 18 I2C — External EEPROM — Interfacing external EEPROM with PIC Microcontroller — I2C — Episode # 01
Credits & References
Arduino Tutorial 6: Build an LED Binary Counter by Paul McWhorter
http://fritzing.org/projects/arduino-8-bit-binary-led-counter
<Edited: Feb 2024 — Minor text fix and link>