08-16-2011 12:16 PM
I think it would be best to parse after. This way you don't have to worry about leaving bits in the buffer and flushing it out.
Jon
08-16-2011 12:31 PM
Since I haven't done this before in LabVIEW, are there some examples somewhere?
08-16-2011 02:29 PM
Another newbie question: Does an instrument driver need to be installed for a device to properly send a serial message? I have a couple pieces of equipment that don't have associated instrument drivers - is that a problem?
08-16-2011 04:17 PM
There are literally thousands of instrument drivers available (including the 34401 that comes with LabVIEW) and they all parse the return strings from a VISA Read in some form or another. How they parse is very dependent on the instrument. Attach a typical string returned.
Your code right now does not use an instrument driver so of course one is not required.
08-17-2011 06:16 AM
Thanks for the response. Conceptually, what I want to do is strip out the data from the serial message. The way a serial message packet is organized is that it has a start bit, 6 data bits, and a start bit. Would it be best to grab 8 message bits, strip off the first and last, and somehow recover bits 1-6 into an unsigned data packet?
08-17-2011 07:01 AM
Sorry - RS232 serial message packet is: 1 start bit; 7 data bits; 1 parity bit; and 2 stop bits. So I guess I read 11 bits, strip bits 1-6, and reassemble into data?
08-17-2011 07:30 AM
However, 10-bit N81 is 1 start, 8 data, and 1 stop (no parity).
08-17-2011 08:38 AM
1) Typically, you always want to read out everything the buffer has to offer as opposed to asking for N bytes and hoping you get it.
2) Parsing out the data that you want from a data packet is very typical LabVIEW 101. Use one of the many String parsing functions. I almost always use Match Pattern but there are others.
I once worked with a data packet that was a few hundered bytes long - and this varied from message to message - and the "data" was only 2 bytes!
08-17-2011 08:57 AM
Thanks...the plot is thickening. I wasn't aware that companies would deviate from the RS232 protocol to allow unique formatting of their data - very eye-opening. I'm working on getting some datasheet stuff that explains the frame formatting for the products I'm using. I found the user guide for the Cooper Instruments & Systems Model BG100 force gauge. However, I can't find a datasheet or user manual for the Mastech M9803R multimeter (in-house or online). The BG100 will require a message be sent to it (\?) to release data onto the serial bus.
08-17-2011 09:02 AM
tgilbert wrote:
I wasn't aware that companies would deviate from the RS232 protocol to allow unique formatting of their data
RS232 "standard" does not define any character limit, length, order, etc. - you are free to send anything down the pipe you want. RS232 is an electrical standard for the interface.