How Could I Desactivated The Watchdog ?

jagomez340
2012-07-23
2024-08-13
  • jagomez340 - 2012-07-23

    I DO NOT have a PLC at this Right Moment But While It comes I have Simulated lots of things but there is one of these as far it has been very Hard because of the Watchdog. the exercise is so Easy, When I press down a Button , then = do not do anything ,but, If I leave press down the button, Then = Turn on a Light, Here is the Code :

    IF button THEN ( I press Down the Button)
    WHILE button Do ; ( While I pressing Down The Button do not do Anything) END_WHILE
    light:= TRUE; (If I have left press Dow the button Turn on the Light)

    END_IF
    WHEN I SIMULATED IT THERE IS AN ERROR
    IT SAYS := ERROR : WATCHDOG COMPUTING OF PROCESSOR CYCLE TAKE TOO LONG. ENDLESS LOOP ASSUMED!
    I HAVE READ AT THE MANUAL BUT IT SAYS THAT I HAVE TO DESACTIVATE A bEnable of the SysWdgEnable Function From The Library SysLibPlcCtrl.libSysWdgEnable
    This function (see library SysLibPlcCtrl.lib) of type BOOL can be used to activate resp. deactivate the watchdog for a specified task. It will return TRUE in case of success, otherwise FALSE.

    Variable
    Data type
    Description

    bEnable
    BOOL
    if TRUE: The watchdog functionality gets activated
    if FALSE: The watchdog functionality gets deactivated

    byIECTaskIndex
    BYTE
    Index of the IEC task, for which the watchdog should be activated/deactivated

    stIECTaskName
    POINTER TO STRING
    Name of the IEC task, can be a pointer to zero

    Codesys Do not have that Library

    So I add a FESTO CPX-CEC-C1 LIBRARY (SysLibPlcCtrl.lib) BUT WHEN I WANT TO CALL IT WITH AN INTANCE IT DOESN´T FUNCTION.
    IT SAYS: ERROR3740 : Unkwonw Type 'SysWdgEnablé'

    Could You help me How could I Desactived the Watchdog PLeasE?
    I hope Your Answer !.
    The Lord God almighty Bless your Life In Jesús name ! Amén.

     
  • shooter - 2012-07-27

    The warning is correct, and you should change your program according.

    You have an endless loop in the while structure, if button is pressed the loop is active (doing nothing) but any other program is not being processed at all.

    You do not have to worry what the processor should be doing, only program what it should change.

    IF button THEN ( I press Down the Button)
    WHILE button Do ; ( While I pressing Down The Button do not do Anything) END_WHILE
    light:= TRUE; (If I have left press Dow the button Turn on the Light)

    In real you want the light true when button is released.
    This is done with function R_TRIG in util.lib
    also in oscat.lib available
    And you can write your own.

    if (button=false and flag=true) then light:=true; end_if;
    if button then flag:=true else flag:=false; end_if;

    take warnings serious as it will be your fault, you are a beginner the program knows it better
    The only thing you will need a PLC is when timing gets critical or you have a big program, the simulation time is slower as the real PLC.
    In the PLC the program is compiled and in the simulation it is interpreted.

     

Log in to post a comment.