Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2167

USB6509 - Read c#

$
0
0

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

 


Viewing all articles
Browse latest Browse all 2167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>