09-29-2017 05:46 AM
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
10-18-2017 07:49 AM
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?