Hex issues
Brian Miller
Posts: 25
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
·
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
What if you try the following:
seconds (units) LOWNIB.seconds
seconds (tens) HIGHNIB.seconds
Just a thought.....
Klaus
seconds (units) seconds.LOWNIB
seconds (tens) seconds.HIGHNIB
))
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Newbie, using the NX-1000 24/40 Board with a BS2p40
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 Williams
Applications Engineer, Parallax
Dallas Office
Thanks, that will learn me something. I have the thing counting right now. I will now go off in the code and "DIG" for a better understanding! Thanks again!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Newbie, using the NX-1000 24/40 Board with a BS2p40