Hi guys,
I am using the commad: BinToStr(Number) to output a binary number to an
LCD display.
The problem is this.
Say I want to display a binary number (8bits) counting from 0 to 127, the LCD display will show nothing when the count is zero.
Then, as the counter increments , will show '1' and no zeros.
Then will whow '101, and no trailing zero. And so on!
Any idea of how to output a whole 8bit number, and change it as the counter increments?
Regards
Francesco C.
Help in formatting Binary counter for LCD display.
Moderators: David Barker, Jerry Messina
-
- Posts: 41
- Joined: Thu Feb 26, 2009 6:54 pm
- Location: UK
From the help file:
function BinToStr(pValue as type [, pPad as byte, pPadChar as char = "0"]) as string
pValue - The number to convert. The argument can be of type byte, shortint, word, integer, longword or longint.
pPad - An optional parameter which will pack the left hand side of the returned string with (pPad - length of numeric string) zeros.
pPadChar - An optional parameter which changes the default packing character.
This function will convert a number and return a string binary representation of the number passed. Optional pPad and pPadChar arguments can be used to format the returned string value. For example,
MyString = BinToStr(12) // result is "1100"
MyString = BinToStr(12,5) // result is "01100"
MyString = BinToStr(12,5,"#") // result is "#1100"
function BinToStr(pValue as type [, pPad as byte, pPadChar as char = "0"]) as string
pValue - The number to convert. The argument can be of type byte, shortint, word, integer, longword or longint.
pPad - An optional parameter which will pack the left hand side of the returned string with (pPad - length of numeric string) zeros.
pPadChar - An optional parameter which changes the default packing character.
This function will convert a number and return a string binary representation of the number passed. Optional pPad and pPadChar arguments can be used to format the returned string value. For example,
MyString = BinToStr(12) // result is "1100"
MyString = BinToStr(12,5) // result is "01100"
MyString = BinToStr(12,5,"#") // result is "#1100"
-
- Posts: 41
- Joined: Thu Feb 26, 2009 6:54 pm
- Location: UK