rising edge not working when declared in other function fb

Anonymous
2016-11-16
2016-11-16
  • Anonymous - 2016-11-16

    Originally created by: barkamharikrishna

    Hello all,
    can anyone please help me on this issue.

    I had developed an Fb and it is working fine.
    Some code of FB I Need to run only once . So i am using Function block R_TRIG:
    unfortunately when my R_TRIG Input is false,then R_TRIG output suppose to be false , but it is not Happening .

    Many thanks in advance

     
  • learnetk - 2016-11-16

    Hi
    The Output of R_Trig is active only for 1 cycle so you would Need to do something like this

    FUNCTION_BLOCK FB_Test
    VAR_INPUT
    xInTrigger : BOOL;
    END_VAR
    VAR
    fbRTrig : R_Trig;
    END_VAR

    fbRTrig(clk := xInTrigger);
    IF fbRTrig.Q THEN
    // the code that Needs to work only on Trigger
    END_IF

     
  • Anonymous - 2016-11-16

    Originally created by: barkamharikrishna

    hi learnetk
    thnaks for the reply,

    i had placed R_Trig in if condition and the condition is not true to reset the R_Trig .
    i had chnaged the code and works fine.

    many thΓ‘nks

     

Log in to post a comment.