LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

aquiring data from serial port

Hi All,
I am new to Labview. I need to aquire data from a capacitance meter which has RS 232 interface (connected directly to RS
232 Port of my PC. when I am using a serial read VI which i got from these forums, I am getting a series of ASCII
characters. How can i convert them to decimal and display them on a graph..
 
Thanks,
Reddy
0 Kudos
Message 1 of 21
(3,791 Views)
If the ASCII characters are a string representation of the actual number (like "23.45"), then you can use the Fract/Exp String to Number function found in the String - String/Number Conversion palette.  If the ASCII characters are unprintable or unreadable garbage characters (like "@#*$"), then the string is a binary representation of the actual number.  You can use the Type Cast function found in Advanced - Data Manipulation palette.  However, you would have to know if the number is an 8-bit (U8) or a 16-bit (U16) number, or even a 32-bit (U32).  You must use the correct data type for the top input to Type Cast.
- tbob

Inventor of the WORM Global
Message 2 of 21
(3,764 Views)
Thanks for the reply..
The ASCII character I am getting are unreadable garbage characters (like "@#*$") as u said, How can they be read and displayed on a graph.. COuld u explain in detail (I am new to labview )
 
Thanks in advance,
 
Srikanth
0 Kudos
Message 3 of 21
(3,753 Views)
What is the model of meter that you are using?  Are you using downloaded drivers?
0 Kudos
Message 4 of 21
(3,746 Views)
the meter is BKprecision  capacitance meter ( model # 890) which has RS 232 interface. i dont have ny drivers for that. he providied data logging software through which i can store capacitance values to a text file.
 
Thanks,
 
Reddy
0 Kudos
Message 5 of 21
(3,739 Views)
The meter model is BKprecsion capacitance meter  Model # 890 (http://bkprecision.com/www/np_searchmodel7.asp?lf=Capacitance+Meters). I dont have any drivers for that. Right now  i am using te data logging software provided by the manufacturer.
 
Thanks.,
 
Srikanth Reddy
0 Kudos
Message 6 of 21
(3,733 Views)
Here is an example vi on how to convert binary strings into numbers.  The first loop creates an array of strings that represent numbers in binary.  Here you would substitute your code for receiving the strings from RS232, make them into an array (see build array examples).  Send the array into the second loop.  The resulting array of numbers are then wired into a graph indicator.  You must be sure that your numbers are double precision floating point (DBL).  If not, substitute the appropriate type in place of all DBLs, including the 0 wired into the top of the Type Cast in the second loop.
- tbob

Inventor of the WORM Global
Message 7 of 21
(3,728 Views)

I used typecast as suggested by tbob ( thanks to him). Now  I am getting the some values on te graph but they r not the actual values ( of capacitance. could anyone check the program and tell me what am i doing wrong.

 

Thanks,

Reddy

0 Kudos
Message 8 of 21
(3,682 Views)
Could you capture a string of raw data that you get from the instrument?  Make it pretty long, to be sure that we see all of the response data.
0 Kudos
Message 9 of 21
(3,667 Views)
Make sure that your baud rate, stop bits, parity bit all match between your code and the device.  Any mismatch would cause bad characters to be sent, and this would type cast into the wrong numbers.  Since the characters are garbage characters anyway, it would not be obvious if you had a mismatch in settings.  Also, check the documentation on the device you are communicating with.  Find out the exact format of what it is supposed to return on the serial line.  Maybe it is sending something other than a double precesion floating point number.
- tbob

Inventor of the WORM Global
Message 10 of 21
(3,648 Views)