Hi, I new to labview and I can't understand how to program the serial port? Can the serial port through LabView read binary data ? Everything I read talks about strings which for me are only ASCII data. Thanks for any help you can give.
> Hi, I new to labview and I can't understand how to program the serial > port? Can the serial port through LabView read binary data ? > Everything I read talks about strings which for me are only ASCII > data. Thanks for any help you can give.
The short answer is Yes, LV and serial port read binary data.
The long answer is a bit more complex.
The serial port only understands binary data (that is, some sequence of 0's and 1's). Interpretation of that sequence is another matter. ASCII assigns specific characters to specific sequences of binary data. Since ASCII covers the range of an 8 bit sequence it is normally used to transfer serial data. This can be seen by the serial port VIs. If I wanted to send binary data of 41 (hex) I would send the A SCII character "A" using serial port write VI. If I received the binary data of 41 (hex) the serial read VI will give me an ASCII "A" this may mean the character "A" or hex 41 or decimal 65 or it could mean "feed the cat". It is all a matter of interpretation.
Use the string functions to generate and decode the values to something appropriate.
Hope this is less confusing than Quantum Physics. Kevin Kent
Yeah, this can get confusing for newbies. If you're sending anything other than text messages, your strings are going to look garbled and messy. Make use of the "String to Byte Array" and "Byte Array to String" functions. You can always use "String to Byte Array" and then hook up an indicator to the output, and an array of the data you're sending will pop up. Then you can view it in decimal for the ASCII codes. Hex is also good for viewing bytes.
Hi, Unfortunately I can't attach you my VI to labview for serial port with this post. Email me and I attach VI to my mail. I use sequence structure for work with serial port: 1 frame - I use Serial port init VI for setup port number, baud rate and ... 2 frame - Writ command to serial port. 3 frame - Read number of characters and convert them into binary or hex or else format. With Best Regards. Vadim Ukraine