Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxWriteDigitalLines Problem

my device is USB6009

uInt8 data[100];
data[1]=1;
DAQmxCreateTask(" ",&taskHandle1);
DAQmxCreateDOChan(taskHandle1, "Dev1/port0/line2", "",DAQmx_Val_ChanForAllLines);
DAQmxStartTask(taskHandle1);
DAQmxWriteDigitalLines(taskHandle1,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL);

When i execute the following code which is written in Visual C++6.0  the bulb on the circuit  does not glow which it should.But i'm able 2 read from line2 which means there is no problem with the line.The write digital line is working perfectly in Visual Basic where it is something like this
 
DAQmxErrChk DAQmxCreateTask(" ", taskHandle1)
 DAQmxErrChk DAQmxCreateDOChan(taskHandle1, "Dev1/port0/line4", "", DAQmx_Val_ChanForAllLines)
 DAQmxErrChk DAQmxStartTask(taskHandle1)
DAQmxErrChk DAQmxWriteDigitalLines(taskHandle1, 1, True, 10#, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, ByVal 0 & )



Can somebody help me.

Message Edited by perk_bud on 12-08-2006 05:54 PM

0 Kudos
Message 1 of 4
(3,206 Views)

I even tried this example given in the examples section with the NIDAQ software.

#include <stdio.h>
#include <NIDAQmx.h>

#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int main(void)
{
    int32       error=0;
    TaskHandle  taskHandle=0;
    uInt8       data[2]={1,0};
    char        errBuff[2048]={'\0'};

    /*********************************************/
    // DAQmx Configure Code
    /*********************************************/
    DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
    DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0/line1:2","",DAQmx_Val_ChanForAllLines));

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

    /*********************************************/
    // DAQmx Write Code
    /*********************************************/
    DAQmxErrChk (DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));

Error:
    if( DAQmxFailed(error) )
        DAQmxGetExtendedErrorInfo(errBuff,2048);
    if( taskHandle!=0 ) {
        /*********************************************/
        // DAQmx Stop Code
        /*********************************************/
        DAQmxStopTask(taskHandle);
        DAQmxClearTask(taskHandle);
    }
    if( DAQmxFailed(error) )
        printf("DAQmx Error: %s\n",errBuff);
    printf("End of program, press Enter key to quit\n");
    getchar();
    return 0;
}

What i cant understand weather the glowing of the bulb happens so fast that i can't see or is there a problen with the code.By the way the bulbs on line 1 and 2 are in off state and i'm trying to on them.


Message Edited by perk_bud on 12-08-2006 06:07 PM

0 Kudos
Message 2 of 4
(3,199 Views)
Plz help

0 Kudos
Message 3 of 4
(3,171 Views)
Sorry guys my mistake i found out that the wire was a bit loose now it's working perfectly.Thanx anywaySmiley Happy
0 Kudos
Message 4 of 4
(3,169 Views)