Hi,
I'm trying to work on a "driver" for an NI 6501 (and down the road, 6509) DIO device. We've got a method that sets the state of a pin and creates all the necessary digital out channel calls. It appears that the command works fine, by having LED's connected up to the pins.
However, when I run this code:
public virtual byte ReadLineInput(int channel) { if (IsSimulated) { return 0; } var readTask = (Task) taskChannels.GetValue(channel); var reader = new DigitalSingleChannelReader(readTask.Stream); var data = reader.ReadSingleSamplePortByte(); CheckForErrors(); return data; }
where "taskChannels" is where we stored the tasks set up for 3 8 bit ports to be Digital Outputs...
I don't get the values I'd expect. I'm reading from a Digital Output, so I'd expect it just to tell me what pins are on and off. However, I have noticed it's actually switching them to Digital Inputs, and then it is setting all the pins to high (which I'd expect with the pullup resistor and nothing hooked to the pins) except for the pins which are connect via LED's... They go low (because they're connected to ground) and I get 0's.
How do I view the state of Digital Output pins without storing them in the driver? For all intents and purposes, this device will be all digital out.... there are no commands to change the channels to Digital In... so the "read" is doing that on it's own... Is there a "Peek" or "View" on the digital outputs?
Thanks,
Rich