Modbus modified, UniCB Init. modified, RunDeviceAfter() called in reversed order, ver. 3.1.1597
This commit is contained in:
@@ -33,10 +33,10 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
int ticketNumber; /// 1 .. number of devices registered for regular polling
|
||||
|
||||
public Analyzer()
|
||||
{
|
||||
}
|
||||
|
||||
public Analyzer() { }
|
||||
|
||||
public Analyzer(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
@@ -66,6 +66,7 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
|
||||
}
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
ticketNumber = modbus.RegisterForPolling();
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
@@ -107,11 +108,13 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
|
||||
Debug.WriteLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
byte[] msg = new byte[8]; /// Buffer for data to send
|
||||
|
||||
if ((StateMachine.Time % 10) == 0) /// Each 10 seconds
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (myCfg.DebugLevel != Config.Entities.DebugMode.Simulate &&
|
||||
myCfg.DebugLevel != Config.Entities.DebugMode.FailureDuringOperation &&
|
||||
modbus.IsMyTurn(ticketNumber))
|
||||
{
|
||||
///
|
||||
/// Send command to request 1 float value in 2 registers at addresses 0x50 and 0x51 from Modbus.WaterAnalyzer
|
||||
@@ -120,6 +123,7 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
|
||||
UInt16 count = 2;
|
||||
|
||||
/// Prepare data to be sent
|
||||
byte[] msg = new byte[8]; /// Buffer for data to send
|
||||
msg[0] = myCfg.ModbusAddress;
|
||||
msg[1] = 3; /// CMD =
|
||||
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
@@ -131,7 +135,6 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user