From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial read, and data import into spreadsheet

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

Applications Engineer
National Instruments
0 Kudos
Message 31 of 86
(982 Views)

Since I haven't done this before in LabVIEW, are there some examples somewhere?

0 Kudos
Message 32 of 86
(977 Views)

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?

0 Kudos
Message 33 of 86
(965 Views)

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.

0 Kudos
Message 34 of 86
(957 Views)

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?

0 Kudos
Message 35 of 86
(949 Views)

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?

0 Kudos
Message 36 of 86
(946 Views)

However, 10-bit N81 is 1 start, 8 data, and 1 stop (no parity).

0 Kudos
Message 37 of 86
(943 Views)

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!

 

Richard






0 Kudos
Message 38 of 86
(939 Views)

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.

0 Kudos
Message 39 of 86
(936 Views)

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.

 

Richard






0 Kudos
Message 40 of 86
(934 Views)