IF Statement Syntax

  • Hello,

    I am using an E controller and trying to call subroutines from my master program using conditional if statements and individual inputs from a Mitsubishi PLC. However I haven't been able to sort out the correct syntax to get it working correctly.

    This is what I have so far:


    1

    HOME

    CALL reset_io

    ;

    IF 13 THEN; TIP EXCHANGE

    CALL tip_exchange

    GOTO 999

    END

    ;

    IF 17 THEN; TIP DRESS

    CALL tip_dress

    GOTO 999

    END

    ;

    IF 33 THEN; Call RH Part

    CALL rh_part

    GOTO 999

    END

    ;

    IF 34 THEN; Call LH Part

    CALL lh_part

    GOTO 999

    END

    ;

    999

    HOME

    CALL reset_io

    GOTO 1


    The controller accepts a number of different configurations including

    IF 33==ON THEN; Call RH Part

    CALL rh_part

    GOTO 999

    END


    However the robot will not enter the above routine when input 33 is in fact turned on.

    Any feedback is greatly appreciated, its my first time working with a Kawasaki robot.


    Cheers,

  • AD
  • I would study the IF statement in the AS Manual, and also the correct input and output numerical references the Kawasaki uses this will highlight your syntax issues.


    The key here is you are not telling the controller to evaluate the state of a SIGNAL or using the correct numerical references to distinguish between inputs and outputs.

    There are many variations to argument evaluations when it comes to SIGNALS, so you can pick your preferred flavours.


    Output 1 for example:


    IF SIG(1) THEN

    END


    IF SIG(-1) THEN

    END


    IF NOT SIG(1) THEN

    END


    IF (SIG(1)==TRUE) THEN

    END


    IF (SIG(1)==FALSE) THEN

    END


    Input 1 for example:


    IF SIG(1001) THEN

    END


    IF SIG(-1001) THEN

    END


    IF NOT SIG(1001) THEN

    END


    IF (SIG(1001)==TRUE) THEN

    END


    IF (SIG(1001)==FALSE) THEN

    END


    As for myself when scanning my code I prefer the following flavours as they are easier to distinguish:

    IF (SIG(1)==TRUE) THEN

    END

    IF (SIG(1001)==FALSE) THEN

    END

  • Thank you for your input Kwakisaki, I believe I have found the error in my syntax.

    Where do I set the master job? or in other words, id like to set my main job to start every time the robot is started.


    Edit- I found an existing post of starting a master job using pg0, RPS ON and pulsing the program reset input. I will be trying it out sometime today.

    Edited once, last by Shearzy ().

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