01-23-2008 01:18 PM
01-24-2008 04:36 PM
Hello Elizabeth,
It looks like the way you have configured your task is what is causing the trouble. I noticed that you want to write to port0/line8 on your device, yet specified data as 1. The method WriteSingleSamplePort attempts to write to an entire port at once. Since you have specified only one line in your task, DAQmx is ignoring all of the bits that would be assigned to other lines. In your case, a 0 will make port0/line0 go low while a 1 will make port0/line0 go high. Since you have specified port0/line8, the changes to line0 are ignored. If you try running your code with a number that will cause line 8 to return high (such as 128) the output value will change from low to high.
The method WriteSingleSampleSingleLine will only affect the line configured in the CreateChannel method, so that is why this line works when you specify port0/line8.
If you specify a group of lines when you are configuring the task (this can be done with the syntax dev/port0) all of the lines in the port will be affected when the WriteSingleSamplePort method is called.