LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simultaneous operations

I need to find a good way to have a program that will update data at adifferent rate that it records data.  The data coming from a i/o motor control.   I need to record position at for example 1 Hz, but simultaneously grab that data at a much faster rate of 50 Hz to put into an algorithm that will update the velocity of the motor in order to keep constant strain rate in a specimen to be tested.   Any help with this would be greatly appreciated, keep in mind Im new with this!
 
Thanks
0 Kudos
Message 1 of 2
(2,458 Views)
 

You have at the very least two basic options Cramer that I can think of. You can either stick with a single-loop architecture, or switch to a two loop architecture.

  1. Single Loop: Read in the data at 50Hz in your loop. Since you want to record the position at 1Hz, you could decide to only record the position once every fifty iterations of the loop. You can do this by having a counter value that counts up to 50 then resets, or by modding the Iteration terminal of the loop by 50 (Quotient & Remainder function) and checking if the remainder is zero. Have a Case Structure in your loop that records the position if it's the 50th iteration, and does nothing in all other cases.
  2. Two Loops: Have 2 parallel loops. Since you're new to LabVIEW, you should know that one of it's biggest advantages is built-in parallelism. Two loops that aren't connected by a wire (specifically, an output wire from one loop to the other) will automatically run in parallel. That means you can have one loop continuously read in data at 50Hz, and another loop running at 1Hz that records the position. This will in general have much better performance for you, because you won't have to hold up your acquisition while you record your position data (which might be a slower operation).

The biggest difficulty with a 2 loop architecture is transfering data from the acquisition loop to the recording loop. Remember you can't use a direct wire connection, or your loops won't run in parallel. Check out some of the links below to learn about some basic and intermediate design architectures. If you're using LabVIEW 7 or higher, there are templates for them so you don't have to start from scratch. Select File >> New to go to the template browser.

Application Design Patterns: State Machine
Producer Consumer
Master Slave

 

Message Edited by Jarrod S. on 02-02-2007 10:22 AM

Jarrod S.
National Instruments
0 Kudos
Message 2 of 2
(2,453 Views)