Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Dynamic Alarm Message

2018-10-27
2018-11-07
  • LouisPijpers - 2018-10-27

    Hi There,

    I am wondering if it possible to configure an alarm message string dynamically.
    What I mean by this is in the alarm configuration, I want to have the message display a string from a text list dynamically at runtime.
    Does anyone know how to achieve this?

    Cheers,

    Louis.

    IMG: Untitled.jpg

     
  • alwoso - 2018-10-29

    Hi Louis!

    I don't know, if there is a way directly in the alarmmanager. I would solve it with a short piece of program, like this:

    VAR
       asMessageText:      ARRAY[0..8]OF STRING := ['No Message', 'Message 1', 'Message 2',
                                         'Message 3', 'Message 4', 'Message 5',
                                         'Message 6', 'Message 7', 'Message 8'];
       sAlarmMessage:      STRING;
    END_VAR
    IF byPowerPackEStopDiag <> 0 THEN
       sAlarmMessage:= asMessageText[byPowerPackEStopDiag];
    END_IF
    

    In the Alarmconfiguration you can use <latch1> as a placeholder for the text:</latch1>

    Maybe this helps?

    Good luck

    Alfred

    IMG: Alarm.png

     
  • LouisPijpers - 2018-10-31

    Hi,

    Thanks for the reply,
    Yes I ended up doing this (something very similar), In theory it should work fine as the documentation says you can define a STRING as a latch variable. I tried it in the simulation but it would not display the STRING value. I also tried a unicode WSTRING with no success. I will try this method once I have some hardware in front of me to try it on.

    Thanks for your help.

    Regards,

    Louis.

     
  • hermsen

    hermsen - 2018-10-31

    Dear poster,

    I tried the of the dynamic string alarm texts via <latch1> and it works wonderful in v3.5.11.50 based hardware.</latch1>

    Thanks for sharing!

     
  • LouisPijpers - 2018-11-07

    Hi Hermsen,

    Much appreciated!

    Regards,
    Louis.

     

Log in to post a comment.