It's a bit odd to replay to my own posts, but I believe some people read this forum so maybe it will help someone.
Here is the constructor for my DigitalInputPort class:
public DigitalInputPort(string lines) : base(lines)
{
// Create an digital input channel
m_PortChannel = PortTask.DOChannels.CreateChannel(lines, String.Empty,
ChannelLineGrouping.OneChannelForAllLines);
// Create channel writer object which will be used to read data from the port
m_PortReader = new DigitalSingleChannelReader(PortTask.Stream);
PortTask.Start(); // PortTask is a Task object created in the base class
}Can you see the bug? 🙂
S
P
O
I
L
E
R
S
P
A
C
E
Yes, it is the following line:
m_PortChannel = PortTask.DOChannels.CreateChannel(lines, String.Empty,
ChannelLineGrouping.OneChannelForAllLines);
As I'm interested in reading data (after all the class name - DigitalInputPort - wasn't chosen by a mistake) I should have used Digital Input Channel, hence the corrected code looks like this:
m_PortChannel = PortTask.DIChannels.CreateChannel(lines, String.Empty,
ChannelLineGrouping.OneChannelForAllLines);
The question is why the original code worked at all? It looks like you can read from task's stream even if there is only an output channel associated with this task. Seems to be a bit strange to me... Anyway I'm happy I have solved the problem.
Greetings from Poland/Europe. 🙂
B.
Message Edited by Bartek G. on 03-01-2006 03:48 AM