11-22-2019 03:33 PM
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
Solved! Go to Solution.
11-22-2019 04:59 PM
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.
11-24-2019 04:38 PM
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?
11-24-2019 07:00 PM
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 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 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).
11-25-2019 03:21 PM
Awesome. This works perfect for me.
Thanks a lot for your help!