LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read data sequentially from an array

I have a 2D array of Boolean controls. Which is 6 columns wide by 23 rows long. What I am struggling to do is to read the first row and pass its data to a digital I/O then read the next row and pass its data to the digital I/O and do this for the 23 rows then stop. I have connected an indicator to the subset array function and this will sequentially indicate the data in each row but when i try to output the data from the for loop it only outputs the last row.

 

Is there a better way to do this ? i have attached the code that i have created so far.

 

When you click automatic test it should output the 23 bits of data sequentially

 

Download All
0 Kudos
Message 1 of 5
(2,381 Views)

You need to put your DAQmx Write inside of the FOR loop.

 

You also shouldn't constantly create and destroy your DAQmx task.  Create it once at the start and clear it once during your shutdown.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,370 Views)

The U32 array exiting the For Loop has a Tunnel Mode=Last Value.

0 Kudos
Message 3 of 5
(2,366 Views)

Thanks for the replies,  your have to bare with me as I'm still quite new to labview. i can see what your are saying about sorting the task once and closing it at the end but when ever i try and and rearange the DAQmx task this is the only format that seems to work. I.e if i move the digital ouput function outside the while loop or the stop and clear functions it doesent work.

 

when i changethe mode to indexing in creates a brocken wire and says i am connecting two diffrent types of arrays.

0 Kudos
Message 4 of 5
(2,353 Views)

You need to be much more specific than "it doesn't work". Show us your modified code.

 

Once you enable indexing, you need to wire to an array indicator or some function that accepts arrays.

0 Kudos
Message 5 of 5
(2,346 Views)