What's a Microcontroller - Ch6 #3
jwt708
Posts: 1
Let me start by introducing myself. I got into robotics not very long ago, but don't alwalys have time to play/learn with working full time and going to school. I bought the What's a Microcontroller from Radio Shack to learn more about programming being completely new to it.
Anyway, I've made it to chapter 6 to the program DisplayDigitsWithLookup (pg 180). Here's my problem...after you complete the program and make sure it works, your instructed to redo it so that it will count from 0 to F in hexadecimal. I've been struggling with with it for a while, and I was hoping someone could point me in the right direction. Any suggestions would be helpful.
Anyway, I've made it to chapter 6 to the program DisplayDigitsWithLookup (pg 180). Here's my problem...after you complete the program and make sure it works, your instructed to redo it so that it will count from 0 to F in hexadecimal. I've been struggling with with it for a while, and I was hoping someone could point me in the right direction. Any suggestions would be helpful.
Comments
In the binary patterns a 1 corresponds to a segment of the display being lit up and a 0 to one not lit. What you need to do is add the patterns for the A – F by outputting a 1 for the correct segments to light up and a 0 where you do not want one. You can add additional lines of code with the pattern output and PAUSE just like in the 0 – 9 example and modify those if you find it easier. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andy Lindsay
Education Department
Parallax, Inc.
' What's a Microcontroller - DisplayDigitsWithLookupYourTurn.bs2
' Use a lookup table to store and display digits with a 7-segment LED display.
' {$STAMP BS2}
' {$PBASIC 2.5}
index·········· VAR···· Nib
OUTH = %00000000
DIRH = %11111111
DEBUG "index OUTH ", CR,
····· "
", CR
FOR index = 0 TO 15
· LOOKUP index, [noparse][[/noparse] %11100111, %10000100, %11010011,
················· %11010110, %10110100, %01110110,
················· %01110111, %11000100, %11110111,
················· %11110110, %11110101, %00110111,
················· %01100011, %10010111, %01110011,
················· %01110001 ], OUTH
· DEBUG " ", DEC2 index, " ", BIN8 OUTH, CR
· PAUSE 1000
NEXT
DIRH = %00000000
END