why does it show junk?
Hello.
I have a program that reads temperature.· Then I want to display it on a serial LCD, but I get junk.
SUB Get_Temperature
· HIGH resetpetp
· SHIFTOUT DQ, Clock, LSBFIRST, RdTmp
· SHIFTIN DQ, Clock, LSBPRE, tempIn
· SHIFTIN DQ, Clock, LSBPRE, tempInS\1
· LOW resetpetp
· RETURN
The temp I want to show is in tempIn which is Byte.
Then I convert the tempIn to two numbers and send to LCD as follows.·
· temp10 = tempIn / 10
· temp1 = tempIn // 10
··
· LCDdata = ClearLCD
· SER_OUT
· LCDdata = temp10
· SER_OUT
··LCDdata = temp1
· SER_OUT
Subprogram to show on LCD is tested and working when sending characters.
Do I need to convert it to·ASCII character before sending it to serial LCD?· How do you do that in SX/B?
Thanks.·
I have a program that reads temperature.· Then I want to display it on a serial LCD, but I get junk.
SUB Get_Temperature
· HIGH resetpetp
· SHIFTOUT DQ, Clock, LSBFIRST, RdTmp
· SHIFTIN DQ, Clock, LSBPRE, tempIn
· SHIFTIN DQ, Clock, LSBPRE, tempInS\1
· LOW resetpetp
· RETURN
The temp I want to show is in tempIn which is Byte.
Then I convert the tempIn to two numbers and send to LCD as follows.·
· temp10 = tempIn / 10
· temp1 = tempIn // 10
··
· LCDdata = ClearLCD
· SER_OUT
· LCDdata = temp10
· SER_OUT
··LCDdata = temp1
· SER_OUT
Subprogram to show on LCD is tested and working when sending characters.
Do I need to convert it to·ASCII character before sending it to serial LCD?· How do you do that in SX/B?
Thanks.·
Comments
temp10 = tempIn / 10
temp01 = __REMAINDER ' this saves a lot of code versus using //
LCDdata = temp10 + "0" ' convert to ASCII
SER_OUT
LCDdata = temp01 + "0"
SER_OUT
Robert
It is much easier to troubleshoot if you post the entire program. Otherwise we are just guessing...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson
"It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter
www.iElectronicDesigns.com
·