LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Communication Strategy Question

Hello,
Here is my situation:

I have a piece of hardware that we built that we want to communicate with LabVIEW 7.0 (via Serial -RS232). LabVIEW will have to read data and interpret because we can't write back to the hardware (because it is already listening to a different device).

The hardware measures a huge range of items for us.
24 Short Circuit Currents
24 Open Circuit Voltages
24 Operating Currents
24 Operating Voltages
17 Angles (actually just # of steps 17 different steppers have taken)
1 True/False Button

Knowing -RS232 serial read- is the only option, is there a "best" or �suggested� way to get this much data?

I tried the Instrument I/O assistant but after labeling the first 5 tokens it gives a �Remainin
g Out� output. When I expand that output with �unbundled� I can get at all of my tokens but they are all unlabeled.

I can tell I need a strategy for handling so many serial tokens in. Can any body help?
Thanks,
Matt Schneider (my first post...)
0 Kudos
Message 1 of 3
(2,275 Views)
What is the protocol? How much data are we talking about (KBs) and how often do you read the data? Is the data just spit out, or do you need to poll for it? If so do you have to poll for each value, or do you get all the values in one reply...

Can you provide an example of the string you will receive from the unit?
0 Kudos
Message 2 of 3
(2,275 Views)
Because your LabVIEW program can't control when your hardware sends data, your first issue is going to be synchronisation with the incoming data and this will be determined by how the data is formatted. Is each item always terminated with a unique character (e.g. a carriage return) that never occurs elsewhere in the data? Then you can set the appropriate termination character in the properties of your VISA session and use a single VISA Read to return the data item as a string. On the other hand if it's a block of binary data terminated with a checksum or CRC, you may need to read one character at a time in a while loop and accumulate them in a shift register until you determine that you have a valid block of data.

Once you have your data you can decide what to do wit
h it. Does the data always come in a big block containing all the readings, or do the readings come individually in variable order, with some kind of identifier saying what each one is? In the first case you just need to split the block up into the appropriate chunks, in the second you might use a case structure to handle each type of data appropriately. Either way you'll probably find the Scan from String and/or String to Byte Array functions very useful.

If your LV program does anything else besides displaying/logging the data you receive, you'll probably want to use independent loops for the other processes. If you need to send data from the serial read loop to the rest of the program, consider using queues, notifiers or functional globals (aka LV2 style globals).

Looking at the examples in the LV installation and on this site will probably help, and you may get more help here if you can give us more detail about the format of the data.
0 Kudos
Message 3 of 3
(2,275 Views)