Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

USB6509 - Read 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,415 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,361 Views)