DynamicTextGetText Watchdog Fault

ben1
2023-02-24
2023-02-27
  • ben1 - 2023-02-24

    Hello,

    I am running this code to grab text from an Alarm Config Text List so that I can send the same text in an Email:

    (Program)
    AlarmID := GetText(sID := GVL.sAlarmID, sTextList := TextList);
    AlarmMessage := VisuElems.cmpDynamictext.DynamicTextGetDefaultText(ADR(TextList), ADR(GVL.sAlarmID))^;

    (Function)
    GetText := VisuElems.CmpDynamicText.DynamicTextGetText(pstTextList:=ADR(sTextList),pstTextIndex:=ADR(sID))^;

    My problem is that it seems sometimes (and only sometimes) I end up with a watchdog fault which points to the GetText Functions. Any ideas why?

    Thanks.

     
  • TimvH

    TimvH - 2023-02-25

    You should use the TextListUtils library for this which already has a GetText function. See https://faq.codesys.com/display/CDSFAQ/Access+to+Text+Lists+from+the+IEC+Code

    The problem you have with this (old) code is probably because you don't call it from the VISU_TASK. With the TestListUtils library function this is not necessary.

     
  • ben1 - 2023-02-27

    Thank you so much timvh, you have helped me a lot!

     

Log in to post a comment.