Hi,
I am using RelayISOx16 module and I have problem with its initialization. Everytime, when the constructor runs, all relays are turned on for a short time and then turned off. Then everything works fine.
I have found out, that the problem is on the line, where field latch is initialized. So I decided to make some experiments
Original constructor:
public RelayISOx16(int socketNumber)
{
Socket socket = Socket.GetSocket(socketNumber, true, this, null);
socket.EnsureTypeIsSupported('Y', this);
data = new GTI.DigitalOutput(socket, Socket.Pin.Seven, false, this);
clock = new GTI.DigitalOutput(socket, Socket.Pin.Nine, false, this);
// the next line makes the problem
latch = new GTI.DigitalOutput(socket, Socket.Pin.Five, false, this);
enable = new GTI.DigitalOutput(socket, Socket.Pin.Three, true, this);
clear = new GTI.DigitalOutput(socket, Socket.Pin.Four, true, this);
...
}
When I changed the constructor, the problem disappeared!
[em](edit: corrected code, was the same as original )
[/em]
public RelayISOx16(int socketNumber)
{
Socket socket = Socket.GetSocket(socketNumber, true, this, null);
socket.EnsureTypeIsSupported('Y', this);
data = new GTI.DigitalOutput(socket, Socket.Pin.Seven, false, this);
clock = new GTI.DigitalOutput(socket, Socket.Pin.Nine, false, this);
enable = new GTI.DigitalOutput(socket, Socket.Pin.Three, true, this);
// switched with 'enable'
latch = new GTI.DigitalOutput(socket, Socket.Pin.Five, false, this);
clear = new GTI.DigitalOutput(socket, Socket.Pin.Four, true, this);
...
}
I switched lines where latch and enable fileds are initialized. I have tried that manytimes, and everythnig seems working
Does the order of fields initialization matter? Is this change allowed?
I also have some proposal of minor changes and additions. Who can I consult that with? Or can I make changes in source control (on codeplex) where someone would approve them before final check in?
Lubos