i have IO ports on my test hardware, and i need to (1) read the current
state of the IO pins, then (2) write new values to the pins based on
current values
(1) to read a port, i have a function that does this:
DAQmxCreateTask(...);
DAQmxCreateDIChan(...);
DAQmxStartTask(...);
DAQmxReadDigitalU32(...);
DAQmxStopTask(...);
DAQmxClearTask(...);
(2) to write a port, another function does this:
DAQmxCreateTask(...);
DAQmxCreateDOChan(...);
DAQmxStartTask(...);
DAQmxWriteDigitalU32(...);
DAQmxStopTask(...);
DAQmxClearTask(...);
both of these functions work, individually.
they also work when i call my write function after having called the read function, *the first time*
but on subsequent tries (within a program loop), when i go to re-read
the IO port, "DAQmxStartTask()" clears the digital port so all lines
are 0 (zeros). Hence, the DAQmxReadDigitalU32() reads all
zeros, and my program fails to work as expected.
why is this happening and what can i do to fix it?
thanks