From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Array Analog output across 4 Lines (PCI 6711)

Solved!
Go to solution

Hello,

I would like to design a user interface where the user can define the analog voltage level of a specific analog channel for a certain amount of time.  Essentially, I need a 2D array where the columns represent each channel on the PCI 6711 board (Ao 0:3) and the rows represent a specific amount of time for each row to last.  I'm assuming there would need to be another 1D verical array with integers representing the number of clock ticks each row will last for.  I can't seem to find any example code where this is implemented, so examples or suggestions would be grealty appreciated.  I have included a picture of a different program that performs this and I would like to mimic this setup. 

0 Kudos
Message 1 of 12
(2,887 Views)

The simple way to control the output level is by using the "In Range and Coerce" function, where you can control the minimum and maximum levels. You may have to build a timer where you check the time depending on an array of values one by one and at the same time set the min and max values. So whenever the timer reaches the specified time, you can go to the next element in the array and set the min and max values.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 12
(2,858 Views)
Solution
Accepted by topic author EESteve1992
Pass the array through a for loop. This gets each row. You can then use the array subset function to get the columns with the voltage setting. This gets wired to a DAQmx Write set for n channels 1 sample. Index the time column and wire it to a delay. Try it and post back of you get stuck.

Sorry, but the above answer does not make any sense to me.
Message 3 of 12
(2,837 Views)

I think i prefer the for loop method as i have built a similar program for digital output.  I seem to be having an issue with the buffer for some reason.  When running this program (attached), it immediately says;

 

Generation cannot be started, because the selected buffer size is too small.

Increase the buffer size.

Selected Buffer Size: 1
Minimum Required Buffer Size: 2

 

i'm not quite sure how to adjust this.

Also i was a little confused by the line where you said to index the time column and wire it to a delay, I wasn't sure if you meant to run it through its own index array or use it as the index of the array subset. 

0 Kudos
Message 4 of 12
(2,822 Views)
Can you attach an image? I'm posting by phone.

Use its own index array. You need a scalar to pass to the delay.
0 Kudos
Message 5 of 12
(2,815 Views)

Should the delay be inside the for loop?

0 Kudos
Message 6 of 12
(2,810 Views)
The DAQmx Write and the delay should be inside the for loop. Your array manipulation with the shift register and the second 1D array does not make any sense. Your original post had a single 2D array with time values in column 0. I have no idea what you are doing now.
0 Kudos
Message 7 of 12
(2,802 Views)
You are also using a different write than what I said and continuous mode is incorrect.

Note also that if your waits are more than a couple of seconds, instead of a simple delay, you might want to use the elapsed time express VI so you can stop the VI in a reasonable fashion.
0 Kudos
Message 8 of 12
(2,798 Views)

Admittedly, I got pretty lost when trying to correctly manipulate this array.  I thought adding a second 1D array to determine time might work.  I think this new setup is closer, but for some reason the array it makes is a vertical 1D array with 60 rows.

0 Kudos
Message 9 of 12
(2,788 Views)
Please pay attention to what I've said. You do NOT use a separate for and while loop. You do you NOT use a build array function and a shift register. You simply pass in the 2D array to a for loop with the DAQmx Write inside. Inside the for loop, the 2D array becomes a 1D array and you get a subset of that to pass as a 1D array to the DAQmx Write set for n channels 1 sample.
0 Kudos
Message 10 of 12
(2,781 Views)