10-06-2005 08:20 AM
status = DAQmxCreateTask(tempName, &tempHandle);
I give each task a name based on port number, and tempHandle is TaskHandle variable which is then stored in an array of TaskHandles. Next, for the ports I actually use, I have a function to configure them to input or output.
status = DAQmxCreateDOChan(tempHandle, chan, virtualChan, DAQmx_Val_ChanForAllLines);
or
status = DAQmxCreateDIChan(tempHandle, chan, virtualChan, DAQmx_Val_ChanForAllLines);
tempHandle is the handle I retrieved from the array. chan is the physical channel name (ex: /Dev0/port0), virtualChan is a name I generate to go along with that. The channels seem to be created just fine. The problems arise when I read from these ports or write to them the first time. Note that I only have a problem on the very first action I attempt to perform on a port. Every action after the first action works just fine. If I read from a port I have configured, the port value will drop to zero. I have used a multimeter to confirm the the voltage across all lines of the port drops from 5v to zero the first time I try and read a value.
status = DAQmxReadDigitalU8(tempHandle,
1,10.0,DAQmx_Val_GroupByChannel,dataArray,1,&read,NULL);I am using this function to get the values from both my input and output ports. I have confirmed I'm using the correct taskhandle. Trying to read 1 reading, with a 10ms timeout. dataArray is a 1 byte array I am reading into, and &read confirms I have read one reading.
If this weren't confusing enough, I am getting a different sort of error if my first action is writing to a port.
status = DAQmxWriteDigitalU8(tempHandle,
1,1,10.0,DAQmx_Val_GroupByChannel,dataArray,&written,NULL);Lets say I write a value to port 1. The value writes just fine to port 1, but will zero out the lines in port 0. It seems that whenever I write any value to a certain port, the port below that value gets zeroed out. I have tried downloading the 7.5 drivers, but the installer just hangs when I start it up. If anyone has any suggestions, they would be greatly appreciated
10-17-2005 04:31 PM
mhouglum,
Unfortunately this is a limitation of the DIO-96 (see the linked knowledgebase article) -- basically the hardware resets any ports not being actively configured by a command. You are either going to have to configure all the ports at the same time, or you are going to need to look at using something like a PCI-6509. Refer to the link for the complete background information. Best of luck with your application!
Regards,
Erik F -- Applications Engineer
Controlling ports of PCI DIO-96:
http://digital.ni.com/public.nsf/websearch/B0E19607502D8B3986256EBE000A9119?OpenDocument