07-16-2021 01:05 PM - edited 07-16-2021 01:05 PM
Hello object developers,
I created object+interface+peripheral for a device which provides heartbeat (alive) Bit. I read this bit in OnEcUpdateIntputs of my peripheral object and now I would like to display an error event if the alive Bit is not changing.
I have some idea how to deal with that, but I am not sure what is the right way. So here is my proposal:
Is it right or should I do that differently?
Solved! Go to Solution.
07-19-2021 10:12 AM
You can set the error directly in your peripheral with method SetDeviceError.
If you using SetDeviceError method you must clear the error in the base to.
SUPER^.ClearError();
In your unit you check for example in the method OnUnitOperational is the error set in peripheral and than you set wit the method SetExtEvent the error on HMI and bring your unit to state ERROR.
VAR
_deviceError : OpconDeviceError;
END_VAR
_deviceError := YourInterfaceToPeripheral.LastError;
SetExtEvent(OpconEventClass.Error,_deviceError.Number,_deviceError.AddText,_deviceError.ObjectId,TRUE/FALSE);
07-20-2021 08:53 AM - edited 07-20-2021 09:45 AM
Thanks for the very useful hint.
I have additional question to SetDeviceError. What is usual place for call of this method? Should I place it directly to OnEcUpdateInputs where I am receiving information about missing heartbeat? Or to OnEcOnline?
And what is the meaning of EventStdFlags of SetDeviceError?
07-20-2021 05:20 PM
I would call the method where the error occurs.