Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Port is resetting the value after DAQmxStopTask is called.

Solved!
Go to solution

Hello? My device is PCI-6025E and I used to reset it by sending 0x00 on digital output port#0 with DAQ. It needs to be reset if power down button of VC++ software is pressed.

 

But after a simple testing of DAQmx, even after I sent 0x00, it automatically resets 0x00 value to 0xFF after DAQmxStopTask is called. I want to know how I can know it is 0x00 before DAQmxStopTask is executed.

 

I've tried to read the port #0 while writing 0x00 on it, but it hangs or it returns error; it said the port is reserved and can't read the port until the task (writing) is done. 

 

 

Here is the code I tested.

 

 

 int         error=0;
 TaskHandle taskHandle=0;
 TaskHandle DItaskHandle=0;
 uInt8  data=0x00; 
 char        errBuff[2048]={'\0'};
 int32  written;
 int32  read;
 uInt8  dataToRead;
 bool32  bTaskStatus;
 

 

DAQmxErrChk (DAQmxWriteDigitalU8(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,&data,&written,NULL)); //creaded 6.5.2009
DAQmxErrChk (DAQmxIsTaskDone(taskHandle, &bTaskStatus));
//DAQmxErrChk (DAQmxWaitUntilTaskDone(taskHandle, 1.5)); // 6.5.2009
 

if(bTaskStatus){
 ///------------------DI reading test on written port0-----------------------/// 6.5.2009
 DAQmxErrChk (DAQmxCreateTask("",&DItaskHandle));  //6.5.2009           
 DAQmxErrChk (DAQmxCreateDIChan(DItaskHandle,"Dev1/port0","",DAQmx_Val_ChanForAllLines)); //6.5.2009
 DAQmxErrChk (DAQmxStartTask(DItaskHandle)); //6.5.2009
 DAQmxErrChk (DAQmxReadDigitalU32(DItaskHandle,1,10.0,DAQmx_Val_GroupByChannel,&dataToRead,1,&read,NULL)); //6.5.2009
 printf("Data acquired: 0x%X\n",dataToRead); //6.5.2009

}

 

 

 

I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 1 of 2
(3,129 Views)
Solution
Accepted by topic author anarkie

Try using the DAQmx property node to invert the Digital lines.

 

Depending on the whether you are configuring DI/DO use the following

 

int32 __CFUNC DAQmxSetDOInvertLines(TaskHandle taskHandle, const char channel[], bool32 data);

int32 __CFUNC DAQmxSetDIInvertLines(TaskHandle taskHandle, const char channel[], bool32 data);

 

Regards,

Glenn

Applications Engineer

National Instruments

 

 

 


Regards,
Glenn
0 Kudos
Message 2 of 2
(3,100 Views)