INITonce

alex87
2011-09-15
2011-09-16
  • alex87 - 2011-09-15

    Hello!

    I have to make a FB or PRG which will initialise only on PLC start, that will start only once, not in the cycle. In the PRG will be system timer which can not be reset with task cycle.
    Any suggestions?

    Thanks in advance!

    Alex

     
  • t.lundahl - 2011-09-16

    Hi Alex!

    To make a first scan is easy, but in my examples the code doesn't execute more than one scan
    cycle. So to have a system timer here doesn't work.

    I usually do a like to use a trigger, TRUE will be active when the system start and to it stops.

    R_TRIG(CLK:=TRUE, Q=>);

    or if you are making funktionblocks I do this:

    IF EN AND NOT ENO THEN
    ...firstscan code
    END_IF;

    code
    ...

    ENO:=EN;

    ( You need to make the input EN and the output ENO first. )

     
  • shooter - 2011-09-16

    in source there is a special task for this called start

     
  • alex87 - 2011-09-16

    hmmm......

    It's not realy "system timer", it is timer for dislpay lightning. I have in mind this option, but it doesn't really work:


    IF done THEN
    RETURN;
    END_IF
    (NetzDummy;)
    SysSetLighting(disp_time:=30);
    (SystemSetParameter(3010, rgb);)
    done:=TRUE;


    If i put only SysSetLighting in FB, the FB resets timer every cycle.

    regards, alex

     

Log in to post a comment.