Binary Counter
dmyhand
Posts: 5
I want to build a device which will count in binary using 8 LEDs. I teach networking and I am finding that most, if not all, of my students understand things better with a visual representation. Would this be easy to do with a BASIC Stamp? I am new to circuit design, but willing to learn. Thanks, Dennis Myhand
Comments
' {$STAMP BS2}
' {$PBASIC 2.5}
LEDs··········· VAR···· OUTL··········· ' on P0 - P7
counter········ VAR···· Byte
Reset:
· DIRL = %11111111······················' make P0 - P7 outputs·
Main:
· FOR counter = 0 TO 255
··· LEDs = counter
··· PAUSE 250
· NEXT
· GOTO Main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 6/7/2005 8:29:48 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
How many mA does each LED draw?
And how many LEDs can be lit at one time before you run into problems?
The FAQ suggests not having more than 3 LEDs powered at any time to avoid flaky and unpredictable behaviour...
http://www.parallax.com/dl/docs/prod/stamps/basicstampfaq.pdf
(See page 10)
This FAQ may need to be updated about the latest models, though...
(Latest revision is from 2000...)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
For one type of design you'll need 7 LEDs for seconds, 7 LEDs for min., and 6 LEDs for Hours as so:
Hours- from left to right: one row of two, one row of four
Min - from left to right: one row of three, one row of four
Sec - from left to right : one row of three, one row of four
Then you only have to convert each 'place'-
You can also teach binary counting on fingers, just be careful when you get to four! I used to tell kids that we count in base 10 because we have ten fingers and toes- but if we were born with only thumbs then we'd count in binary... and that the characters in Springfield (the Simpsons) must count in octal (they have 8 fingers!)
Ryan
Ryan