https://www.youtube.com/watch?v=Kex2vtqS8ic Good tutorial for getting the event logger and alarms system working. However I wasn't able to get the HMI side of things to work. https://cookncode.com/twincat/2020/11/03/twincat-eventlogger-plc-part.html https://cookncode.com/twincat/2021/01/20/twincat-eventlogger-hmi-part.html#sending-messages https://hellotwincat.dev/category/twincat-hmi/ I initially had trouble getting the EventLogger HMI to work. I was using an incompatible version of the software. By default the NuGet Package Manager uses nuget.org as the Package Source. However that will grab the latest version of the packages even if they are incompatible with the TE2000 server that is installed. I had to change the source to TwinCAT HMI Official instead and then change each package to which ever version was recommended from there (installed versions weren't removed but the list to choose from dropped down to just the ones that are compatible). Add the Tc3_EventLogger to the PLC projects References ### Event Clases We need to create an event class for each message or alarm we want to use. You need to open the Type System section in the Solutions Editor then open the Event Classes tab and create a new class by right clicking and selecting new. You then need to Edit the new class, then right click on Events and add a new Event. The Display text is important. It will be what the user sees in the HMI. You can add arguments, {0}, which allows you to programatically add more text when the message is generated. There is a Severity setting for your message containing the options - Verbose - Info - Warning - Error - Critical ### Alarms Messages are quite simple as they are simply a note that something has happened. Alarms have an extra feature where they can record if they have been confirmed or not. ## Code For every event you need to create a Message or Alarm object. ``` VAR fbStopMessage : FB_TcMessage; fbCommsAlarm : FB_TcAlarm; END_VAR ``` You then need to initialise it. The stEventEntry is the item you created in the Type System > Event Classes. The ipSourceInfo can give some information on the source of the message (which part of the machine raised the message). However this is difficult to see in the HMI so I have left it as the default value (0) in these examples. ``` CASE sm.state OF E_States.STARTUP : fbMessage.CreateEx(stEventEntry:=TC_Events.MyEvents.CartonPrinted, ipSourceInfo:=0); fbCommsAlarm.CreateEx(stEventEntry:=TC_Events.MyEvents.CommsAlarm, bWithConfirmation:=TRUE, ipSourceInfo:=0); E_States.IDLE : IF sm.bFirst THEN fbMessage.Send(nTimeStamp:=0); fbCommsAlarm.ipArguments.Clear().AddString('Time Out'); fbCommsAlarm.Raise(nTimeStamp:=0); END_IF ``` The ipArguments.AddString string is shown in the Text column in the HMI if we added and argument {0} to the display text field in the Event Classes. nTimeStamp is a number that represents 100 nanoseconds since January 1st, 1601 (UTC). If the value is 0 then it takes the current time.