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

Initialisation TimerSwitch of Util Codesys 3.5 Library

jf89
2021-06-05
2021-06-07
  • jf89

    jf89 - 2021-06-05

    Hello,
    I would like to use the outputs DATE,TOD,WEEKDAY of that functionblock .

    But I unable to initialise the parameter asISchedule.
    It's a pointer of schedule, and I don't know howdoes it works.

    Have you any idea how to set that parameter ?

    Thanks for your help

     
  • jf89

    jf89 - 2021-06-05

    other attachments

     
  • jf89

    jf89 - 2021-06-05

    and the last

     
  • sgronchi

    sgronchi - 2021-06-05

    It is a pointer to the first element of an array.
    Declare an array in your code, like

    mySchedule : ARRAY [1..32] OF Schedule := [(usiSwitch := 1, todFirstOn := ..., todLastOn := ..., byDayFlags := 2#0010_1001), ...]; 
    

    and then assign ADR(mySchedule[1]) to aslSchedule.

    A tip: instead of posting screenshots of online help, post the link.

     

    Related

    Talk.ru: 1

  • jf89

    jf89 - 2021-06-07

    Hello Sgronchi,
    Thanks for your help.

    All the mecanism of pointer to schedule seems to be difficult to understand for me .

    I probably not correctly set the pointer to asISchedule input of the function block.

    Here is a screenshot of what i received.

    Can you tell me where is my mistake ?

    The aim of that function block , is to receive DATE,TOD,WEEKDAY and to compare with an array [1..7,1..4] of boolean corresponding of [1..4,1..2] TOD ON and OFF (validation for each day of week of 4 schedule) (a sort of multischeduler but only 4 schedules and 1 binary output.

    So I don't know how to force the input asISchedule.

    Best regards

     
  • sgronchi

    sgronchi - 2021-06-07

    Ooook, did not try but just looked the docs.
    From the error it seems that aslSchedule is VAR_IN_OUT, so just put the array without ADR and [1].

     

    Related

    Talk.ru: 1

  • jf89

    jf89 - 2021-06-07

    Well, with the last indications the program compile.

    But with the same settings , one program is working and the other no !

    I don't understand the error of pointer !

    Does someone have any idea ?

     
  • jf89

    jf89 - 2021-06-07

    timerswitch running

     
  • jf89

    jf89 - 2021-06-07

    settings

     
  • sgronchi

    sgronchi - 2021-06-07

    You can see in the CFC part that aslSchedule is 0, so the function block did not receive "mySchedule" position in memory.
    Maybe the culprit is a stale connection (shown connected but actually not), try to delete and reconnect it.

     

Log in to post a comment.