Not sure where to ask this. Please point me in the right direction if I am in the wrong place.
I have a NI USB 6501 that I am using for various tasks, both reading and writing.
It has taken me a while to get writing working as expected and I think it is because of a lack of understanding of the relationship to tasks, channels and the DAQmxBaseWriteDigitalU8.
The set up I have is an opto coupler on a single line on the 6501. I want to be able to turn a single device on and off, but may extend it to more later. For testing I wanted to send all the lines (24) high and low.
I started with the example code writeDigMultiplePorts.c This code sets up one task, 3 channels, creates a 3 byte buffer and makes a single write call.
This didn't do anything, none of the lines went high. If I set the numSampsPerChan in the write function to 3 the lines went high (when I wrote 255) but then I couldn't get the lines low again (when sending 0) But, when I sent another the 255 the lines momentarily went low before going high again.
I struggled with various combinations of buffer sizes, auto start values and numSampsPerChan with no change until I changed the code to only create one channel. Then everything worked as expected. I can turn the device on and off as expected.
So my question is, what is the relationship between channels, output data and the numSampsPerChan parameter to the DAQmxBaseWriteDigitalU8 function? What parameters would I need to switch arbitrary lines on the device?