I’ve been playing around with the 7-Segment Shield for Arduino from the Maker Shed, and realize that I need a better understanding of how seven segment displays work.
When addressing the display from the sample Arduino sketch, I was pulling pre-formed characters from an array of hex values.This means that when I wanted a number 3, for example, I’d ask for NumberLookup[3], which had been assigned hex value 0x4F. I asked my friend Tod Kurt, “What’s this mapping, is there a standard table of characters to hex they’re pulling from?”. He responded, “That’s hex for “01001111” in binary, five ones in there equate to five lit segments. You should look at the datasheet for the SAA1064 LED-driver for the segment mapping. Or better yet, reverse-engineer the binary-to-segment relationship.”
So that’s what I did, and I have a better understanding of how it works as a result. Starting with the decimal point and moving through each character segment, I numbered which segment lit up when I asked for them to display via binary. The first place, or B10000000, lit the dot. Next, B01000000, lit the middle horizontal segment. Once I’d mapped out all the relationships, I wrote an Arduino sketch to cycle through each segment on the first digit, while displaying its binary place in the third digit (that’s the fancy GIF animation up there). Next up, I’ll discuss forming characters from an array of hex values.
In the Maker Shed
The Arduino 7-Segment Shield has four 7-segment displays (and driver), a temperature sensor, a PWM RGB LED, and plugs into an Arduino.
ADVERTISEMENT