Machine Automation Forum
A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-02-14 08:32 AM
I am trying to make alarms visible on a "pop-up" screen in M172 HMI. I do it by using a "Message" instead of a regular page. An example code is available here .
I define a couple of status variables to do this and use them in a GlobalOnTimer procedure. ActiveAlarm is ON whenever at least one alarm is active, and AlarmIgnore is used to tell the PLC to stop sending alarms for some time:
//ActiveAlarm : at least one alarm is active
uiret:=Video_GetParam(0,Addr_ActiveAlarm,0,?ActiveAlarm,tyBool); // See if alarms are active
//AlarmIgnore : tell the PLC not to cycle alarms
uiret:=Video_GetParam(0,Addr_AlarmIgnore,0,?IgnoreAlarm,tyBool); // See if alarms are acknowledged
//Alarm Pop Up screen
IF ActiveAlarm THEN
IF NOT AcknowledgeAlarm THEN
msg_id_opened:=1; //Make sure what page number is loaded
uiret:=Video_SendEvent(kWM_MSG,msg_id_opened);
END_IF;
ELSE
IF HMI_usiPosition = 1 THEN
msg_id_opened:=0;
uiret:=Video_SendEvent(kWM_KEY,kKEY_VK_F3); //Close pop up
//Define global virtual key VK_F3 as close
END_IF;
AcknowledgeAlarm := FALSE;
END_IF;
There´s a couple of minor corrections needed but the code works both in simulation and on a physical target (TM172PDG18R), as long as I connect to the target and "Download all" the project.
However, if I need to correct the HMI code or screens, I can connect to the PLC but when I finish the process of downloading the new HMI code, PLC hangs and I get either WDT3 or HMI can not be loaded error when the PLC starts.
So, the problem lies on the GlobalOnTimer procedure. If I remove the Video_SendEvent function and open the screen with a button instead, there are no issues.
Any comments on how to improve this will be welcome.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-02-14 09:26 AM
Thanks Bastian for the tip.
Do you remember if there´s anyway to close the popup from programming ? I tried setting the input to a not valid value but it does not close it. Or do I need to write an OnTimer procedure in the message screen ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-02-17 02:13 PM
Hi,
the limit of sysHmi_Message() is that it works only on local display and not on the remote TM17xDGRP.
The reason of the watchdog I think is that the code tries to open infinite time the popup.
I haven't tested it, but try to modify the code more or less in this way:
GLOBAL TIMER SCRIPT:
//ActiveAlarm : at least one alarm is active
uiret:=Video_GetParam(0,Addr_ActiveAlarm,0,?ActiveAlarm,tyBool); // See if alarms are active
//AlarmIgnore : tell the PLC not to cycle alarms
uiret:=Video_GetParam(0,Addr_AlarmIgnore,0,?IgnoreAlarm,tyBool); // See if alarms are acknowledged
//Alarm Pop Up screen
IF ActiveAlarm THEN
IF NOT AcknowledgeAlarm AND NOT(xMsg1Open) THEN
msg_id_opened:=1; //Make sure what page number is loaded
xMsg1Open:=TRUE;
uiret:=Video_SendEvent(kWM_MSG,msg_id_opened);
END_IF;
ELSE
AcknowledgeAlarm := FALSE;
END_IF;
ONTIMER SCRIPT of the Message:
IF NOT(ActiveAlarm) THEN
xMsg1Open:=FALSE;
uiret:=Video_SendEvent(kWM_KEY,kKEY_VK_F3); //Close pop up
END_IF;
Close button of the Message must call the same script linked to OnTimer
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.