LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help setting up some "parallel" loops

Hello,
I'm trying to write a test program in Labview that starts out simple, but ends up a little complicated.
I'll be turning some digital outputs on and off as follows:

DIO 0, turn on
DIO 1, turn on
DIO 1, turn off after 100 ms (this time will vary)
DIO 0 turn off after 1.5 seconds (this time will vary)
wait 3 seconds, repeat...(time will vary)

ok, that's the easy part. this will simply be turning relays on and off..

Two complications:

1) I want to run 8 of these tests independantly of each other, so that I can start/stop any of 8 tests (each with the same sequence). If DIO 1 is about to go on, it must check that none of the other 8 stations will have their DIO "1"s on .. if that makes sense. Basically, they will run independantly but must wait so no two have the first 100 ms "pulse" on at the same time.

2)During this time, on any or all of the selected 8 channels, I may want to scan several analog channels for one or more of the 8 stations. I would need to capture, for example, several analog inputs for station 1 at 1000 HZ as the sequence above is performed. I will store this data to a file.

The thing is, I don't know how or if the DIOs will operate at the same time an analog card is scanning at that high rate. 

Can I just run 8 parallel loops controlling the DIOs and one parallel loop running the analog inputs?

The hardware has not yet been chosen, so I'm flexible there. I have some experience with CompactRIO, PXI.. but I'm mostly concerned with how to start this program..

I appreciate any input or ideas.

Regards,

Jeff
0 Kudos
Message 1 of 7
(2,645 Views)
.

0 Kudos
Message 2 of 7
(2,627 Views)

any ideas?

 

Jeff

0 Kudos
Message 3 of 7
(2,605 Views)
Jeff,

When you talk about only one station having its "DIO 1 on" do you mean that you have 8 ports each with a DIO 0 and DIO 1 or do all the stations somehow "share" the DIO lines?

I would suggest in general that a state machine architecture would be a good starting place. If you have to share resources such as the DIO 1 lines, look into semaphores as a means of controlling the access.

Lynn
0 Kudos
Message 4 of 7
(2,594 Views)

Thanks for the reply Lynn,

These are all independent digital outputs. Each of the 8 station uses 2 digital outputs for control. So, actually it would be DO1 and DO2 for station 1, DO3 and DO4 for station 2, etc..

My problem is that, each set of these I/O must operate independently, (all 8 stations should be running by themselves, with the criteria given in my first post).

All the while these are running, I want to be able to (occasionally) do a high speed data acquisition (yet another set of analog input channels) on any or all of the 8 stations.

 

Jeff

 

 

0 Kudos
Message 5 of 7
(2,587 Views)
Jeff,

I would set up independent, parallel loops for the digital outputs and the analog inputs (DAQ loops). Have the test control loop(s) pass commands to the DAQ loops via queues. Similarly, the analog input data is returned to the test loops via queues of functional globals. It is hard to say whether 8 test control loops or one loop with 8 sets of parameters is better. It depends on how much linkage there is between the 8 tests. You have indicated that the DIO 1 function can only be active on one device at a time. If that is the only constraint (besides common DAQ ports) separate loops with semaphores probably makes more readable and expandable code. If the tests are highly linked, all the interprocess communications could become messy.

This is the kind of project where planning and software design before wiring up LV diagrams is very important. Spend some time with pencil and paper specifying the timing, resource contention, and interprocess communications issues, as well as the user interface, before launching LabVIEW.

Lynn
Message 6 of 7
(2,579 Views)

Thanks Lynn!
I'll look at all the items you suggested.

 

Jeff

0 Kudos
Message 7 of 7
(2,573 Views)