Much easier than using a calculator and separating the bytes.
You can load the number you want like this ...
Code:
@ MOVE?CP 100000, _SetPoint
Which puts up to a 32-bit Constant (4,294,967,295) into a PVAR.
Displaying the big numbers is just a matter of dividing them down to useable amounts.
For small numbers like 100,000 a single divide will do.
Code:
Divisor VAR BYTE[PRECISION]
Result VAR BYTE[PRECISION]
WordVar VAR WORD
Remainder VAR WORD
@ MOVE?CP 10000, _Divisor ; load 10,000 into Divisor
@ MATH_DIV _SetPoint, _Divisor, _Result ; isolate lowest 4 digits
@ MOVE?PW _Result, _WordVar ; copy Result to a PBP Word
@ MOVE?PW REG_Z, _Remainder ; copy remainder to a PBP Word
IF WordVar > 0 THEN
LCDOUT DEC Wordvar, DEC4 Remainder
ELSE
LCDOUT DEC Remainder
ENDIF
It should work up to 655,359,999. Larger numbers will require more divisions.
That's just off the top of my head, untested.
Let me know if you have problems.
Bookmarks