time and bintoascii

KeithRB

Senior Member
I was creating a quick program on my 18M2 to test out a serial LCD and included a bintoascii time, b1, b2, b3, b4, b5, b6 to send the elapsed time to the LCD. I got an error about using a byte variable where a word was required, so I switched it to bintoascii time, b1, b2, b3 and it worked.

I thought 'time' was a word variable, but I guess it is not. Or am I doing something wrong?
 

jtcurneal

Senior Member
Time is a word variable. I think that your problem is that you tried to convert a word variable to 6 ascii byte variables.

try bintoascii time, b1, b2, b3, b4, b5

Joel
 

KeithRB

Senior Member
I don't think I miscounted my variables, but I may have. I will try that tonight and see what happens.
 

jtcurneal

Senior Member
I just checked and I was mistaken.
Time is a special case. read the time into a word variable and then use your bintoascii.
for example

Let w5 = time
bintoascii w5, b1,b2,b3,b4,b5

Joel
 

jtcurneal

Senior Member
It says in the manual, the commands disabletime and enabletime are word variables,
but I have always read the time variable into a word variable (w2) before converting it
or sending its value (up to 65535) to an LCD or to an EEPROM. I am not sure just why that is necessary.

Joel
 
Top