LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Continuous Data on Multiple Ports

@ Aaron P

 

Ah yes, that's what I want to do. What's that object you're using, though? It says status on it and converts the error to boolean. I haven't seen that before and can't find it now.

0 Kudos
Message 11 of 17
(1,050 Views)

Hi IMSargon,

 

That is an Unbundle By Name function. It is in the Functions»Programming»Cluster, Class, & Variant palette.

 

Thank you for choosing National Instruments.

 

Aaron Pena

National Instruments

Applications Engineer

http://www.ni.com/support

0 Kudos
Message 12 of 17
(1,048 Views)

So there are a number of ways to implement this. Timing is not critical. If I get each of the masses a couple times per second, that's fine. It doesn't matter if they all read simultaneously or sequentially. 

 

I could:

1. Make one subVI that reads all the scales simultaneously.

2. Make one subVI that reads all the scales sequentially

3. Make one subVI that reads one scale, and use many instances to read each scale sequentially

4. Make one subVI that reads one scale, and use many instances to read the scales simultaneously

 

Also, when do I close the VISA channel?  For option 1, I can just close when I'm done reading, but for option 3 should I open and close for each read? Is there a way to check if the channel is already open, so my VI could only open on the first execution and only close on the last? (I'd like as few inputs to my subvi as possible, but I suppose a true/false input to tell it if it has to open or not would work.)

 

What's most efficient for LabVIEW? What's most efficient for the hardware (just a couple of USB RS-232 boxes)? What's most efficient for the poor sap who has to maintain my code when I'm gone?

0 Kudos
Message 13 of 17
(1,022 Views)
And another question. Is there a graceful way to get all my loops to shut down when a stop button is pressed? Or is the answer just "Stop using all those parallel loops and you won't have that problem"
0 Kudos
Message 14 of 17
(1,016 Views)

IMSargon wrote:

So there are a number of ways to implement this. Timing is not critical. If I get each of the masses a couple times per second, that's fine. It doesn't matter if they all read simultaneously or sequentially. 

 

I could:

1. Make one subVI that reads all the scales simultaneously.

2. Make one subVI that reads all the scales sequentially

3. Make one subVI that reads one scale, and use many instances to read each scale sequentially

4. Make one subVI that reads one scale, and use many instances to read the scales simultaneously

 

Also, when do I close the VISA channel?  For option 1, I can just close when I'm done reading, but for option 3 should I open and close for each read? Is there a way to check if the channel is already open, so my VI could only open on the first execution and only close on the last? (I'd like as few inputs to my subvi as possible, but I suppose a true/false input to tell it if it has to open or not would work.)

 

What's most efficient for LabVIEW? What's most efficient for the hardware (just a couple of USB RS-232 boxes)? What's most efficient for the poor sap who has to maintain my code when I'm gone?


IMSargon,

 

 

As far as which method you should use, that is more of a personal preference. Since timing is not critical for you, any of the options would be sufficient.

 

You need to close the VISA channel when you are done using it. That being said, in your application it would probably be after the while loop(s). Opening and closing the VISA channel every time you read from it would just add unnecessary overhead, so you should just leave it open as long as it's in use and close it at the end of your VI.

 

Thank you for choosing National Instruments.

 

Aaron Pena

National Instruments

Applications Engineer

http://www.ni.com/support 

0 Kudos
Message 15 of 17
(982 Views)

IMSargon wrote:
And another question. Is there a graceful way to get all my loops to shut down when a stop button is pressed? Or is the answer just "Stop using all those parallel loops and you won't have that problem"

HI IMSargon,

 

The easiest way to stop multiple loops is to use one Stop control button and then create local variables from that control and have those wired to the other loop conditional terminals. You will have to change the mechanical action of the Stop button in order for this to work. I recommend Switch When Released. Here is a simple example:

 

stop_multiple_loops.PNG

 

Hope this helps!

 

Thank you for choosing National Instruments.

 

Aaron Pena

National Instruments

Applications Engineer

http://www.ni.com/support

0 Kudos
Message 16 of 17
(980 Views)

@ Aaron P

 

D'Oh. I was sure I had tried that. Thanks for the tip.

0 Kudos
Message 17 of 17
(972 Views)