HOW TO SEND '0' IN A STRING VIA RS232
Posted: Thu Mar 31, 2011 3:19 pm
Hi
Hopefully someone can help me.
I am sending a string of data via RS232 from a master pic to a slave. Unfortunately I cannot send the number 0. For example, if I define the string data in a calculation function as;
STRING[0]=5
STRING[1]=150
STRING[2]=0
STRING[3]=10
STRING[4]=75
Then send via RS232; Only STRING[0] and STRING[1] are sent. This is backed up by the simulation which highlights this. A '0' terminates the string.
Unfortunately for me, there are multiple variables in my program which could have a 0 like time for instance . I thought about trying an if function like;
if
Variable 2 = 0
then
String[2] = 255
but this would take too many functions as there are lots of variables and I actually need the number 255.
Hopefully this all makes sense.
Any help would be greatly appreciated.
Cheers
Hopefully someone can help me.
I am sending a string of data via RS232 from a master pic to a slave. Unfortunately I cannot send the number 0. For example, if I define the string data in a calculation function as;
STRING[0]=5
STRING[1]=150
STRING[2]=0
STRING[3]=10
STRING[4]=75
Then send via RS232; Only STRING[0] and STRING[1] are sent. This is backed up by the simulation which highlights this. A '0' terminates the string.
Unfortunately for me, there are multiple variables in my program which could have a 0 like time for instance . I thought about trying an if function like;
if
Variable 2 = 0
then
String[2] = 255
but this would take too many functions as there are lots of variables and I actually need the number 255.
Hopefully this all makes sense.
Any help would be greatly appreciated.
Cheers