LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems decoding sensor values

Well , I have an RS232 incoming frame which consists on groups of two bytes separated by a carriage return character, like this :
byte1byte2\rbyte3byte4\r.........
Each group of two bytes represent a 12-bit resolution sensor value. I used to measure 8bit resolution sensors with no problems, but now I am getting mad. I am able to remove th CR character an place the info between them into an array but I didn't success taking the two bytes away from the frame and combining them into a int16 value in order to obtain a value between 0-5 volts with 12 bit resolution.
I attach my Vi.
Thanks in advance for the help.
Regards
0 Kudos
Message 1 of 2
(2,400 Views)
In the advanced > Data manipulation subpalette, use the Type cast function : wire a constant 1D array of U16 as type input, and you are done. Forget what you have done in your vi, and wire directly your serial string. If the bytes are not in the proper order, you can use the swap byte function, in the same sub palette.
Chilly Charly    (aka CC)
Message 2 of 2
(2,393 Views)