BASIC Stamp & the 7-Segment Display

by Rael Dornfest

BASIC Stamp 2 and the 7-Segment LED Display

Continuing on with my adventures in microcontrollers, I spent the evening running through a couple more of the "What's a Microcontroller" [PDF] workbook exercises. I finally reached the one I'd just been itching to get to: the 7-segment LED display.


The evening started out with lighting up individual segments by sending a HIGH to the appropriate pin and ended with a sweet bit of code making use of a LOOKUP table holding 8-bit representations of 0-9A-F:




LOOKUP index, [ %11100111, %10000100, %11010011,
%11010110, %10110100, %01110110,
%01110111, %11000100, %11110111,
%11110110, %11110101, %00110111,
%01100011, %10010111, %01110011,
%01110001 ], OUTH



A friend, more fascinated by my fascination than the whole counting in hex thing asked: "So, why do you find this all so interesting?" The closest I could come was likening it to someone who followed cooking recipes to the letter stepping back one day, trying something simple, and building back up over time to something akin to the recipes they started out with.


It's grokking the distance between bits and browser, pins and pixels that gets me going.


That and I'm just that much closer to recreating Mattel's Battlestar Galactica SPACE ALERT LED-based handheld from 1978 ;-).