Ruzz
2008-05-13 10:10:09 UTC
Hi to everyone, I have defined a simulated PCI-6503 card for testing examples in C#. As base of my example, im using the ReadDigPort.2005 and WriteDigPort.2005.The following code is what im trying to do for write in the port0 of my device the value 00000001 using (Task tareaWrite = new Task()) { // Create an Digital Output channel and name it. tareaWrite.DOChannels.CreateChannel("Device1/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(tareaWrite.Stream); writer.WriteSingleSamplePort(true, (UInt32)1); }After this, im doing the reading using (Task tareaRead = new Task()) { tareaRead.DIChannels.CreateChannel("Device1/port0", "port0", ChannelLineGrouping.OneChannelForAllLines); DigitalSingleChannelReader reader = new DigitalSingleChannelReader(tareaRead.Stream); UInt32 data = reader.ReadSingleSamplePortUInt32(); //Update the Data Read box hexData.Text = data.toString(); }But i alwais get 0's, so it seems im not writting on the desired port. I have tried writting only one line, and lot of combinations, but i have not succes. I dont know what im doing wrong, because i have just started.Any tip will help me a lot, Thanks to everyone in advance.