Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

C# read status of digital output line

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

0 Kudos
Message 1 of 2
(5,688 Views)

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

0 Kudos
Message 2 of 2
(5,671 Views)