8-bit CPU: Playing with 7-segment displays
I'm playing around with electronics from time to time, so I already had some parts and tools that might be useful for this project.
- small parts like various resistors, capacitors, LEDs
- Arduino Uno
- prototyping board containing half-size breadboard
- four 7-segment displays (conveniently: common cathode ones)
- pack of jumper wires and several meters of CAT5 cable
- few TS555CN timer ICs
- multimeter
- soldering iron
- wire cutter
Let's try to play with those 7-segment displays using Arduino then. In theory the build is fairly easy: connect all anodes (of same segment for each display) together, add a current limiting resistors and connect to Arduino. Then connect each cathode to the Arduino. Voila. The rest is up to software.
In practice, however, there are 8 anode inputs per display, multiply it to 4 displays and you have to cut, strip and plug in 32 small wires. It became apparent very quickly that bent nose pliers and wire stripper is a must. I managed to do it using only a wire cutter, knife and fingers, but that was tiresome.
Now on to software. In spite of being quite fluent with AVR microcontrollers (they are used as heart for Arduinos), I've never actually used Arduino as it was intended to. Usually I do it on a bit lower level, using AVR Libc, GCC and AVRDUDE directly. Well, all those things are still used in background by Arduino IDE, but it bundles it all together and adds its own higher level library. Now it is an opportunity to try it out.
My first impressions of Arduino IDE, however, are a bit divided. There are neat features for fast prototyping, but the code editor itself is very basic, at least when comparing to Visual Studio Code. Granted, Debian (my primary OS of choice) bundles only ancient, almost 6 years old version 1.0.5, but even upgrading manually to current one doesn't help much. Luckily, there is VSCode extension that integrates with it.
And here is the device, counting the numbers tirelessly.
Well, actually, at some point it decided that something's funny about the code I wrote 🤣
I do not blame it, I was not too careful when I wrote it. It's probably trying to display negative numbers after integer wrap-around or something. No worries there, I was just testing out the concept, it does not have to be perfect.
Comments
Post a Comment