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

Wait until?

freedumz
2017-01-26
2017-01-26
  • freedumz

    freedumz - 2017-01-26

    Hi everyone,
    I'm doing a small programm with a wago which is able to send sms. I'm browsing an array which contains alarm message and alarm status, but the problem is due to the delay of the sending (between 2 and 5 secondes), it's possible that my loop has been increased by one or two so I've an offset between the sent sms
    So my question is: is there a way to force the programm to wait untill the sms is sent?

    Many thanks in advance for your help

     
  • Joan M

    Joan M - 2017-01-26

    When programming PLCs you are in front of deterministic and realtime systems, this means that you can't pause or loop infinitely till an event happens,

    But, you can do this like:

    sms := 0;
    CASE state of
    1: send the current sms.
    Β  Β  state := state + 1;
    2: if (sms is sent)
    Β  Β  then
    Β  Β  Β  sms:=sms+1;
    Β  Β  Β  state := 1;
    Β  Β  end_if
    

    That will allow you to wait the needed amount of time without locking the task as any PLC task will automatically start from the beginning again once it has finished.

    PS: If you are interested on knowing the flags or so that can be used to know if the sms has been sent... then you should give us more information about the instructions you are using...

    Hope this helps.

     

Log in to post a comment.