Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

read/write DIO-Port every second with 6229 PCI

Hello,

i would like to write a number of samples. A sample should be aquired every second. For Example on port 0 should be written. Data should come out of a data array like:
data[10]={0x000f00f, 0xffffffff,......}. Each Element of this array should be written to the port 0 one time. So the complete session should last 10 seconds.

And the other way round i would like to do it, too. Do a sample from port 0, store it into an array, wait a second....

i tried it this way but it wouldn't work:


    uInt32      data[2]={0x000f00f, 0xffffffff;...};       
    int32        written;

    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines));
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"OnboardClock",1.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,10));

    /*********************************************/
    // DAQmx Start Code
    /*********************************************/
    DAQmxErrChk (DAQmxStartTask(taskHandle));

    /*********************************************/
    // DAQmx Write Code
    /*********************************************/
    DAQmxErrChk (DAQmxWriteDigitalU32(taskHandle,10,1,10.0,DAQmx_Val_GroupByChannel,&data,&written,NULL));


Documentation says if i want to use the internal clock of the device i should use OnboardClock or NULL. Both doesn't work.


Thanks forward for every information
Greetings
Andreas

0 Kudos
Message 1 of 2
(3,392 Views)
On a M-Series device like the 6229 you are using, you can not use hardware timed DIO directly, but use "correlated DIO" instead. Check out this link for more information about this:
 
You could use simple software-timing as well (crerate a loop that writes new data to the port every second), if 1 Hz is your acquisition/generation rate this should work as well, but the jitter is higher using software timing then using correlated DIO of course.
 
Hope this helps!
 
André
 
0 Kudos
Message 2 of 2
(3,380 Views)