User key

  • Hello all.

    I am using KR300R2700 - 2F / FLR

    With KRC 4 Controller

    Application - Pick & Place. (Material Handling)


    First i am using separate user keys for gripper open & gripper close. I am using this keys as


    In SPS.


    IF Is_Key_Pressed(14) THEN

    Gripper Open pulse.

    ENDIF


    IF Is_Key_Pressed(15) THEN

    Gripper Close pulse.

    ENDIF


    I want to open & close gripper on same (single) button.

    As like, if gripper is open then it will be close & if gripper is close then it will be open.


    I think, setting a flag is better option, but please suggest best way to use a single button.

  • Hello;


    First of all, you should have sensors that see the open and closed position of the gripper. your sample program should be like this;


    $IN[1] : Your Gripper Open/Close Button/Command

    $IN[2] : Gripper Opened

    $IN[3] : Gripper Closed


    $OUT[1] : Gripper Open, Output *

    $OUT[2] : Gripper Close, Output *


    IF ($IN[1]==TRUE) THEN

    IF ($IN[2]==TRUE) THEN

    $OUT[2]=FALSE; *

    WAIT 0.1;

    $OUT[1]=TRUE; *

    ELSEIF ($IN[3]==TRUE) THEN

    $OUT[1]=FALSE; *

    WAIT 0.1;

    $OUT[2]=TRUE; *

    ENDIF

    ENDIF


    * if your valve is permanent type, not spring return PULSE can be used. Etc;


    IF ($IN[1]==TRUE) THEN

    IF ($IN[2]==TRUE) THEN


    PULSE($OUT[1],TRUE,0.5)


    ELSEIF ($IN[3]==TRUE) THEN


    PULSE($OUT[2],TRUE,0.5)


    ENDIF

    ENDIF

    Think before you talk, Read it before you think about it.


    Fran Lebowitz.

  • I want to open & close gripper on same (single) button.

    You'll need some sort of memory latch to create an edge-trigger on the button.


    This should flip the True/False states of both outputs when the button is pressed, but not keep flipping them every SPS loop if someone hold the button down. The idea of the memory BOOL is to make the IF statement only trigger once, when someone presses the button. Then it cannot trigger again until the button is released, then pressed again.

  • I Already have sensors,

    But i does not understand that , how can i get $IN[1] ??


    How to get input after preessing certain status key ??

  • You'll need some sort of memory latch to create an edge-trigger on the button.


    This should flip the True/False states of both outputs when the button is pressed, but not keep flipping them every SPS loop if someone hold the button down. The idea of the memory BOOL is to make the IF statement only trigger once, when someone presses the button. Then it cannot trigger again until the button is released, then pressed again.

    You mean, first of all, i have to declare an BOOL i.e. bButtonMemory. Inside confg.

    & then i will write all your logic in SPS.

    Am I right ?? ?(

  • you cannot get input activated by pressing status key. at least not directly because inputs are read-only.


    you could write code that activates output... the output could be wired to input (or echoed back in a PLC for example...)... then you have input that corresponds to status key state


    yes all variables need to be declared before use. where and how you declare and initialize them will have impact on life and scope of the given variable.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now