LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital output multiple channels with multiple samples

Solved!
Go to solution

Hi,

 

I am writing a LabVIEW program to generate 4 channels (line2:5) digital outputs. Each channel has multiple samples. However, except line2, line 3:5 has no signals. Can anyone help to check what the problem is?

 

Both of my VI and screenshot were attached here.

 

 

Thanks a lot,

Elliot

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

Put a probe on the array that's inputting the signals to DAQmx Write. All of the lines except for the first one are at 5 all the time, so lines 3:5 are just a constant "5".

 

Also, you don't write Boolean data to lines like that, it's trying to write it to a Port. Writing 0 and 5 don't make it go to 0V and 5V. You can only write True or False to a Line, so even if the 5's are changing it won't work. Note that the mode is "Port format", which means each integer is trying to write to a whole Port. For example, a U8 would correspond to 8 different Lines in a Port, so 0b00100110 would write a True to lines 1, 2, and 6.

 

Look in Help -> Example Finder -> Hardware I/O -> DAQmx -> Digital Output for some example code you can copy.

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

Hi  BertMcMahan,

 

Thanks for your reply. 

 

For DAQmx digital boolean write, I did NOT see an option like "multiple channels multiple samples boolean array in DAQmx Write.

 

I tried a simple scheme of writing one channel (line2) with 0101.....(TTL) at a specified sampling rate. I also did NOT see "single channels multiple samples boolean array" in DAQmx Write. Any advice to do this?

 

 

0 Kudos
Message 3 of 5
(5,371 Views)
Solution
Accepted by topic author ElliotYY

If you can place all of the lines you need in a single channel (by setting the Create Virtual Channel as "One channel for all lines", then the following should do what you want:

Boolean Array to Digital WaveformBoolean Array to Digital Waveform

 

If you can't do this, then you need a waveform for each channel, and you could modify the code to the following:

Add a For loop to create an array of waveformsAdd a For loop to create an array of waveforms

In this case, I added an extra Build Array inside the For loop, because the Boolean Array to Digital Waveform requires a 2D array, and the columns give lines (a new row gives the next value, hence the transposes).


GCentral
0 Kudos
Message 4 of 5
(5,359 Views)

Awesome. This works perfect for me. 

 

Thanks a lot for your help!

0 Kudos
Message 5 of 5
(5,320 Views)