Shop OBEX P1 Docs P2 Docs Learn Events
Hex issues — Parallax Forums

Hex issues

Brian MillerBrian Miller Posts: 25
edited 2004-09-22 01:49 in BASIC Stamp
Ok, my brain hurts....
·
I have a LED display driver that basically takes 5 nibs of data and displays the value in hex on each of the 5 digits.·I'm trying to display the time, but can't come up with a sensible way to get it to display in decimals. I shiftout the 3 bytes (the extra nib is for dp) the "secs" variable contains the current seconds from the clock. So you start getting 3c for 60 seconds and so on. The only think I can think of is to create a giant "DATA" array and map each second of 60 to the appropriate byte. I hope that makes sense??
·
·
·
The shiftout
SHIFTOUT pLED14489d, pLED14489c, MSBFIRST, [noparse][[/noparse]%10110000, %00000000, secs]

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Newbie, using the NX-1000 24/40 Board with a BS2p40

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-09-21 23:56
    Hi Brian,

    What if you try the following:

    seconds (units) LOWNIB.seconds
    seconds (tens) HIGHNIB.seconds

    Just a thought.....

    Klaus
  • K de JongK de Jong Posts: 154
    edited 2004-09-21 23:58
    Sorry,

    seconds (units) seconds.LOWNIB
    seconds (tens) seconds.HIGHNIB

    smile.gif))
  • Brian MillerBrian Miller Posts: 25
    edited 2004-09-22 00:08
    Yea, I tried that but realized that that will return 0-15 thus 0-F

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Newbie, using the NX-1000 24/40 Board with a BS2p40
  • CPUMANCPUMAN Posts: 55
    edited 2004-09-22 00:09
    Basically you'll want to use a math trick to get the right value to be displayed.· There is several ways to go about this.· I'd recommend just doing this...

    You could simply add 6 to the counter ever time it gets to $A (10) so that if it's say at $2A it'll add 6 making it $30 which will produce the desired output of 30 instead of 2A.· The only thing is you'll have to adjust your program to look for $60 (96) instead of 60.

    Chris
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-22 01:34
    I wrote a demo for the chip a month or so ago -- perhaps my code will help.· You see that the DIG operator and using the \bits parameter with SHIFTOUT are very helpful.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Brian MillerBrian Miller Posts: 25
    edited 2004-09-22 01:49
    Jon, do you ever sleep? confused.gif

    Thanks, that will learn me something. I have the thing counting right now. I will now go off in the code and "DIG" lol.gif for a better understanding! Thanks again!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Newbie, using the NX-1000 24/40 Board with a BS2p40
Sign In or Register to comment.