LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with loops, need to pass value each iteration

Dan:  You really need to study up on how DAQs work.  You need to send Reset and Clock.  So you need two digital output lines.  Therefore you need to create a 2D array (as in Ernie's suggestion, backed by Dennis).  The first column in the array will be associated with digital output line 1 and the 2nd column with digital output line 2.  Lets say that the first column belongs to the reset line and the 2nd column to the clock.  Your 2D array would look like:

 

F  F   (No channel selected)

T  F   (reset asserted)

T  T   (clock pulse 1 starts)

T  F   (clock pulse 1 ends)

T  T   (clock 2)

T  F   (clock 2)

and so on until

T  F   (between last clock and no channel selected)

F  F   (no channel selected)

 

Just look at your timing diagram.  The 2D array above matches it perfectly.  Feed this 2D array into the DAQ assistant.  Your DAQ Assistant must be set up for 2 channels and the timing must agree with your timing diagram for T1, T2, and T3.  You can extend timing by holding values for several rows.  Like this:

 

T  F

T  T

T  T

T  T

T  F

 

Here the clock stays high for 3 timing cycles.  You will need to do this because T1 is shorter thatn T2.  You have to set your DAQ timing to no less than the shortest time (T1).  I would set the DAQ sample rate to twice T1.  This should work.  And do as Dennis says, use Ernie's example and get rid of the silly flat sequence structure.

 

To answer why your vi doesn't work:  In frame one you set a boolean high.  But that doesnt' actually set any lines high because DAQ hasn't been called yet.  In the next you seem to define your clock pulses.  Again DAQ hasn't been executed so nothing happens.  In the third you just have a boolean, no action takes place.  After the second frame, all inputs to the Build Array are there, and it executes and sends the array to DAQ.  Then DAQ will execute because all of its inputs are there.  But you are send in a 1D array.  How can you control 2 lines with a 1D array.  I hope you don't think just because you labled a boolean "Reset", that the DAQ will automatically know which line to set.  With your vi, only one line will be activated.  You need a 2D array with 2 columns, one column per line.  If you want to control 4 lines, you need a 2D array with 4 columns.

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 11 of 11
(301 Views)