PDA

View Full Version : LCDOUT Question? Please Help



spotlite
- 26th April 2011, 22:04
Hi,
I am new in this wonderful forum.
I was wondering if someone can help me on this one:

d VAR BYTE
d=%00010110
LCDOUT BIN (d)

The LCD displays "10110", cause the leading zeroes are omited!
So, How to make it to always show the whole thing? - i.e. "00010110"

Thanks in advance!

Archangel
- 26th April 2011, 22:40
I think you will find what you are looking for in the manual listing under serout2, I know, that's not where you would expect to find it but it's there. It (the manual) explains it better than I can.
From the manual:


BIN, DEC and HEX may be preceded or followed by several optional parameters. If any of them are preceded by an I (for indicated), the output will be preceded by either a A%@, A#@ or A$@ to indicate the following value is binary, decimal or hexadecimal.
If any are preceded by an S (for signed), the output will be sent preceded by a A-A if the high order bit of the data is set. This allows the transmission of negative numbers. Keep in mind that all of the math and comparisons in PBP are unsigned. However, unsigned math can yield signed results. For example, take the case of B0 = 9 - 10. The result of DEC B0 would be A255". Sending SDEC B0 would give A-1" since the high order bit is sent. So with a little trickery, the unsigned math of PBP can yield signed results.
BIN, DEC and HEX may also be followed by a number. Normally, these modifiers display exactly as many digits as are necessary, zero blanked (leading zeros are not sent). However, if a number follows the modifier, SEROUT2 will always send that number of digits, adding leading zeros as necessary. It will also trim of any extra high order digits. For example, BIN6 8 would send A001000" and BIN2 8 would send A00".
Any or all of the modifier combinations may be used at once. For example, ISDEC4 B0.

spotlite
- 27th April 2011, 06:57
Thank you so much!
This really helped me a lot!