Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Confused about DAQmxWriteDigitalU32

First, English is not my native language, if it's hard to comprehend, I'm really sorry.

I'm trying to use PXI6537 to control hs3282(arinc429 IC), port0,port1 are used as data lines, other for controlling, and the frequency is 1MHz.
A uInt32 variable stands for a moment that all singals' level. Such as port2/line1 is connected to IC's EN pin and port3/line7 is connected to RESET pin, if both pins are high level, the uInt32 variable is 0x80020000, am I right?
So all timing sequences lead to a uInit32 array, then using DAQmxWriteDigitalU32 to send it to output.
But DAQmxWriteDigitalU32 seems to write the array continuously loop by loop (is it?), however, I just want it to output once.
For more detials, if there is a array data[1000]={0,1,2,3,..,998,999}, I hope the output is 0,1,2,3,...,999. Then the output stops at 999, there is no loop. If I stop the task after writing immediately, the output seems to be at a random position.

Here is the main code for your analysis,

uInt32 writeData[10000]

DAQmxCreateTask("",taskHandle);
DAQmxCreateDOChan(taskHandle, "PXI6537/port0/line0:7,PXI6537/port1/line0:7,PXI6537/port2/line3,PXI6537/port2/line5,PXI6537/port3/line1,PXI6537/port3/line3,PXI6537/port3/line5,PXI6537/port3/line7")
DAQmxCfgSampClkTiming(taskHandle,NULL,1000000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,10000);
/* Set the writeData Array */
DAQmxWriteDigitalU32(taskHandle,10000,1,10.0,DAQmx_Val_GroupByChannel,writeData,NULL,NULL);
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);

Thanks for your help!

0 Kudos
Message 1 of 2
(5,139 Views)

How stupid I am, sampleMode should be set to DAQmx_Val_FiniteSamps

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