Search code examples
embeddedplctwincatethercat

TwinCAT 3 console message display


ADSLOGSTR(msgCtrlMask := ADSLOG_MSGTYPE_LOG, msgFmtStr := 'OSIO: %s', strArg := 'Autostrsys');

I'm using this function in TwinCAT 3, but when I'm running my code it's getting hanged because of ADSLOGSTR function. If I'm commenting this then it's working fine but in that case I'm not able to see messages.

Why system is hanging because of this message display function(ADSLOGSTR)?


Solution

  • My guess is that you are calling the function at every cycle. You need to make sure to only call it once, like so:

    IF NOT bAdsLogStrBeenCalled THEN
        ADSLOGSTR(...);
        bAdsLogStrBeenCalled := TRUE;
    END_IF