Hello.
I have a sensor that uses ASCII connected to the rs232 port on my red lion data station. Im using this program to get the data into a array.
// this Rx routine will allow you to display all of the bytes received in a transmission
// declare locals
int i;
int j;
int in = PortRead(2, 255);
// loop while there is data in the buffer, populating the array
while(in != -1) {
Array[i++] = in;
in = PortRead(2, 255);
}
// if something was received, build a string
if(i > 0) {
String = "";
for(j = 0; j <= i; j ++){
String += Array[j];
}
}
The values i get are decimal values, the first 4 bytes are 52 52 50 48, which is 4420 when i convert it to ascii and that is the sensor type. Is there a way to create a program that can translate the bytes received to ascii?
Coding is not something i do frequently, so any help or documentation on how to do it is appreciated.
I have a sensor that uses ASCII connected to the rs232 port on my red lion data station. Im using this program to get the data into a array.
// this Rx routine will allow you to display all of the bytes received in a transmission
// declare locals
int i;
int j;
int in = PortRead(2, 255);
// loop while there is data in the buffer, populating the array
while(in != -1) {
Array[i++] = in;
in = PortRead(2, 255);
}
// if something was received, build a string
if(i > 0) {
String = "";
for(j = 0; j <= i; j ++){
String += Array[j];
}
}
The values i get are decimal values, the first 4 bytes are 52 52 50 48, which is 4420 when i convert it to ascii and that is the sensor type. Is there a way to create a program that can translate the bytes received to ascii?
Coding is not something i do frequently, so any help or documentation on how to do it is appreciated.