Shop OBEX P1 Docs P2 Docs Learn Events
rctime problems — Parallax Forums

rctime problems

FrankA_645FrankA_645 Posts: 7
edited 2008-11-06 01:49 in BASIC Stamp
Hello,

Im currently going through the whats a microcontroller book, and Im having some problems with the DialDisplay program in chapter 6. After setting the circuit just like the picture, and copying the code, the 7 segment display would not change as I turned the pot (all 5 segments stayed lit). I added a debug command after the rctime (debug ? time , crsrup) and I am getting totally random values usually around 10-14, but sometimes up to 60. These values change when i spin the pot, but in no particular order.
The strange part is when it says 60 it will still not turn off a segment (the first value in the lookdown table is 40). hrmm. any ideas?
thanks -Frank

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-06 01:15
    There must be something about what you've done that's different from what's in the book.

    1) Go through what you've wired up and make absolutely sure that what you've wired is the same as in the book

    2) Go through the program and make absolutely sure that it's exactly the same as what's in the book.

    3) Post a picture of what you've got (physically) and post a copy of your program (as attachments to a reply).

    4) Check the various connections. Sometimes a wire isn't connected properly.
  • FrankA_645FrankA_645 Posts: 7
    edited 2008-11-06 01:24
    here is the code, (also attached)· I will take a picture right now..

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    DEBUG "lere we go; pot & lcd"·· , CR
    time VAR Nib
    index VAR Word
    OUTH = %00000000
    DIRH = %11111111
    DO
    · HIGH 5
    · PAUSE 100
    · RCTIME 5, 1, time

    · DEBUG ? time , CRSRUP

    · LOOKDOWN time, <= [noparse][[/noparse]40, 150, 275, 400, 550, 800], index
    · LOOKUP index, [noparse][[/noparse] %11100101, %11100001, %01100001,
    · %00100001, %00000001, %00000000 ], OUTH
    LOOP
  • FrankA_645FrankA_645 Posts: 7
    edited 2008-11-06 01:33
    ...and the picture. I'm pretty sure everything is seated nicely. I keep thinking the pot is bad.. but it still wont turn off a segment when the rctime is over 40. thanks! -frank
    640 x 480 - 120K
  • MikerocontrollerMikerocontroller Posts: 310
    edited 2008-11-06 01:41
    ·It looks like you accidently declared "index" as a word variable and "time" as a nib variable.· It should be the other way around.· A nib can only store from 0-15 in decimal.
  • FranklinFranklin Posts: 4,747
    edited 2008-11-06 01:45
    your posted code looks nothing like the code in the book as far as I went. Exactly what page are you referencing? (I didn't look at the code you attached, sorry)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • FrankA_645FrankA_645 Posts: 7
    edited 2008-11-06 01:46
    A-HA! I had the index and time variables set to the wrong types! works great now. man I spent the last couple hours on this.. and read and read it so many times I cant believe i missed it! haha.
  • FrankA_645FrankA_645 Posts: 7
    edited 2008-11-06 01:49
    thanks guys!! Im sure i will have lots more questions.. Thanks again!
Sign In or Register to comment.