From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

6509 - Read and Write c#

Hi,

I have a problem with read implementation. I explain you.

I need to read EEprom and so: 3 pin (chipselect, DI, clock) set output mode and 1 set input (DO). 

I initialize read port-pin: 

private struct PortPinSettingRead
 {
    public DigitalSingleChannelReader reader;
    public Task                       digitalInputReadTask;
    public UInt32                     pin;
 }
PortPinSettingRead portPinSettingRead;
portPinSettingRead.digitalInputReadTask = new Task();
portPinSettingRead.digitalInputReadTask.DIChannels.CreateChannel("dev1/port11/line3", "", ChannelLineGrouping.OneChannelForEachLine);
portPinSettingRead.digitalInputReadTask.Control(TaskAction.Verify);
portPinSettingRead.reader = new DigitalSingleChannelReader(portPinSettingRead.digitalInputReadTask.Stream);

//READING
public int readDI(){
 try
 {
      return portPinSettingRead.reader.ReadSingleSamplePortInt32();
 }
 catch (Exception ex) 
 {
    System.Console.WriteLine(ex.Message);
    return -1;
 }
} 

I see by oscilloscope, that when I call readDI() function, the output pin go to 0.

Is it possible? 

Thank you

0 Kudos
Message 1 of 2
(2,327 Views)

Hello chino5,

it's actually a strange behavior, but i would suggest you to try the DAQmx C# examples that you can find into C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.5.1\Digital

 

Do you notice the same behavior?

 

 

0 Kudos
Message 2 of 2
(2,273 Views)