06-05-2009 12:41 PM
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
}
Solved! Go to Solution.
06-08-2009 03:54 PM
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