11-20-2013 09:51 AM
Hello
Is it possible to read the status of a digital output line with a PCI 6509 board.
When i set a output line and read it back the output switches off because it set to input.
with kind regards
Tonnie
11-21-2013 12:49 PM
Hi,
Try this. Read back the values on the same task
using (Task digitalWriteTask = new Task())
{
// Create an Digital Output channel and name it.
digitalWriteTask.DOChannels.CreateChannel("Dev1/port0", "port0",
ChannelLineGrouping.OneChannelForAllLines);
// Write digital port data. WriteDigitalSingChanSingSampPort writes a single sample
// of digital data on demand, so no timeout is necessary.
DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);
writer.WriteSingleSamplePort(true, (UInt16)this.numericEdit1.Value );
// Create the reader
DigitalSingleChannelReader reader = new DigitalSingleChannelReader(digitalWriteTask.Stream);
// Read back the value
this.textBox1.Text = reader.ReadSingleSamplePortByte().ToString();
}
Hope this helps
Curt