Where is your data stored ?
Variable or EEprom or something else?
Where is your data stored ?
Variable or EEprom or something else?
Last edited by Robson; - 25th August 2007 at 20:08.
Hi tcbcats,
This is just off the top of my head and will need written and debugged.
Subtract each number with $30 giving 00, 01, 03, 08 and 09 ThenI can also convert it to the format $30, $31, $33, $38, $39 in a 4 byte string. If needed. Each digit is 0 to 9 decimal… never any alpha chr’s. Max value for the expected data is 09999
For example to get the first LSB = (08*16)+09 this should give $89
Do the same for the other numbers.
Please this is off the top of my head and I havn't checked it out! It may be of some help?
Bob
Try this
Code:B0 VAR BYTE B1 VAR BYTE B2 VAR BYTE B3 VAR BYTE BWord1 Var BYTE BWord2 VAR BYTE BWord VAR WORD VarWord VAR WORD VarWord = 1389 ' Here is your number you defined B3 = VarWord DIG 3 B2 = VarWord DIG 2 B1 = VarWord DIG 1 B0 = VarWord DIG 0 BWord1 = B3 * 16 + B2 BWord2 = B1 * 16 + B0 BWord = BWord1 * $100 + BWord2 ' Here stands your Word like 1389 as hex
Displays 00:13:89Code:Value VAR WORD Buf VAR BYTE[3] DigLoop VAR BYTE Value = 01389 For DigLoop = 5 to 1 STEP -2 Buf((6-DigLoop)/2) = ((Value DIG DigLoop) << 4) + Value DIG (DigLoop -1) Next DigLoop LCDOUT HEX2 Buf(0),":",HEX2 Buf(1),":",HEX2 Buf(2)
<br>
DT
Darrel something is not going in my head.
Code:Value = 01389 ' <- Is the "0" really included ?
The compiler will ignore any leading 0's.
That's the way Tcbcats showed it, so I left it in there.
<br>
DT
@Darrel
i mean this line.
I don´t tried it out, maybe it worksCode:For DigLoop = 5 to 1 STEP -2 Buf((6-DigLoop)/2) ' = Buf((6-5)/2) = 0.5 ??? Does it really works? Round it to zero? Next DigLoop
Bookmarks