Hi,
In part of my code I am using variables b1, b2 and b3. What I am trying to do is this:
b1=1
b2=3
b3=5
tach=b1,b2,b3
When I go to complile it, it keeps giving me an error.
Can anyone help me with this?
Thanks,
Chris
Hi,
In part of my code I am using variables b1, b2 and b3. What I am trying to do is this:
b1=1
b2=3
b3=5
tach=b1,b2,b3
When I go to complile it, it keeps giving me an error.
Can anyone help me with this?
Thanks,
Chris
I'm guessing that in this example you want 'tach' to end up being 135?
So you'd want b1 to be the 100's place of tach, b2 to be the 10's place, and b3 to be the 1's place, is that correct?
Yes, that is correct. When I display it to a LCD display, this works correctly when I use the DEC command. I have tried everything and still can't get it.
How about
tach = (b1*100)+(b2*10)+b3
Why are you speciying the digits individually ?
Whats wrong with....
tach = 135 'or whatever
LCDout DEC tach ' which would suppress leading zeros eg 135 or 79 or 4
LCDout DEC3 tach ' which would always display 3 digits. eg 135 or 079 or 004
Keith
www.diyha.co.uk
www.kat5.tv
Thanks for the reply. I never thought of doing tach = (b1*100)+(b2*10)+b3 and this will work perfect! The problem is that the numbers are coming over a wireless link and I am having trouble sending word variables. I know these are byte variables but it is only an example. Anyhow, the variables are not going to an LCD display. This is a great temporary solution until I can find out how to send word variables over a wireless link.
Thanks!
Be sure not to overflow your variable type with the calculation
tach = (b1*100)+(b2*10)+b3
Arch
Arch... it would not be possible to overflow a word with that formula...
Guess I should have been more specific about that - I meant if he was using a byte variable. (but now I see that he mentioned a word-sized variable - DUH!)Originally Posted by Melanie
Arch
"This is a great temporary solution until I can find out how to send word variables over a wireless link."
If you can send bytes then you can send words.
When you send just break the words into bytes.
tach var word
tach.lowbyte = high byte of word
tach.highbyte = low byte of word
Bookmarks