Shop OBEX P1 Docs P2 Docs Learn Events
What's a Microcontroller - Ch6 #3 — Parallax Forums

What's a Microcontroller - Ch6 #3

jwt708jwt708 Posts: 1
edited 2008-12-29 06:07 in Learn with BlocklyProp
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.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-09 16:15
    Hello,

    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
  • edited 2007-01-09 18:53
    You might also find some hints in the Solutions section at the tail end of the chapter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
  • NickolasNickolas Posts: 1
    edited 2008-12-29 06:07
    i had some problem on this one as well. but stayed up all night and figured it out finally!·i have posted the program below.

    ' 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
Sign In or Register to comment.