sps.sub user PLC section

  • Hi

    I need to add in sps.sub, user PLC section some permanent condionalities for Inputs and Outputs to manage a spindle sensors behaviour.

    For example:

    IF $IN[2]==#TRUE THEN ;TOOL RELEASED

        $OUT[1]=FALSE ; SPINDLE STOPPED

    ENDIF


    They are placed in field LOOP-ENDLOOP to be permanently active.


    When deploy project in KRC4 8.3.18, Submit button is stopped (red) and message $IN variable is write protected in line X. code KSS10388


    Should I use this command only in src file program?

    Ty



  • And do really have two equal signs '=='?

    The message says that there is only one, like:

    Code
    If $in[2]=true.. ;this is wrong
    If $in[2]==true then ; correct 
    If $in[2] then ; same as above
  • Does the message actually say the $IN is write-protected? That should only happen if you try to set a $IN -- reading a $IN should never produce an error.


    If the error is that the $OUT is write-protected, that's more normal. Usually this is caused when that particular $OUT has been assigned to a system signal, usually in /STEU/MADA/$MACHINE.DAT.

  • Yes the message is $IN[1] IS WRITE PROTECTED. What means I try to set $IN reading?

    IF $IN[1]==TRUE THEN

    $OUT[1]=FALSE

    ENDIF


    Is that syntax in a reading way? What is the difference between write protected and read only, I understand the words sense , but is expected to happen in one case, what in next?


    $OUT IS NOT WRITE PROTECTED and neither assigned to any signal in STEU.

  • ... What means I try to set $IN reading?

    .

    Missunderstandig:

    Does the message actually say the $IN is write-protected? That should only happen if you try to set a $IN -- reading a $IN should never produce an error.

    ..

    There is a break "--" between '$IN' and 'reading'. Would have been better to use a dot. :winking_face:


    What's about :

    Show (upload) original code, and original message (Screenshot).

  • Read only are inputs generally, as you can't write to any input.

    Write protected is an output that is assigned to a system signal, as the system output can't be written by user. But if he is not assigned to a system signat, the output can be set by user.

  • Can't see a problem with writing to an input.

    Original error message?

    Code
    If $in[1] then
    ; do nothing
    Else
    ; do something
    .... 
    Endif

    Can be done by:

    Code
    If not $in[1] then
    ; do something
    .... 
    Endif
  • ;IF $IN[2]==#TRUE THEN ; extra # character is the only problem


    IF $IN[2]==TRUE THEN ;TOOL RELEASED

        $OUT[1]=FALSE ; SPINDLE STOPPED

    ENDIF

    after removing # character, above code is fine and should work in any program and interpreter. so yes it is fine to use that in SPS.SUB.


    there is no message 10388. more likely that is message 1388.

    either way, please provide screenshot of the message.


    maybe you are misinterpreting message and checking different code line. KUKA does manipulate line numbers which is not helpful.

    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

  • You could also write

    $OUT[1]=NOT $IN[2]

    Sorry, that's not the same. As it also will set the output to true, but the original only sets to false. :winking_face:

    Standard, not safe resetting f. E. a spindle on error, and you will not have automatic restart of the spindle.

  • that's my new code based on your sugestions :

    IF NOT $IN[1] THEN ; TOOL NOT LOCKED (S1)

    $OUT[1]=FALSE ; SPINDLE STOPPED

    IF $IN[2] THEN ; TOOL RELEASED (S2)

    $OUT[1]=FALSE ; SPINDLE STOPPED

    IF $IN[3] THEN ; IF SPINDLE ROTATING

    $OUT[2]=FALSE AND NOT $IN[4] ; TOOL CHANGE AND TOOL CHANGE PUSHBUTTON NOT ALLOWED

    $IN[4]=TRUE ; TOOL PUSHBUTTON CAN BE USED

    IF NOT $IN[5] THEN ; SPINDLE OVERHEATED

    $OUT[1]=FALSE ; SPINDLE STOPPED

    ENDIF

    ENDIF

    ENDIF

    ENDIF


    Will try tomorrow.

    On the other hand, still have to add a safe condition while running, if spindle stop, robot must stop too, to not destroy workpiece, tool,etc. Is that correct so:


    IF $MODE_OP==#AUT THEN

    IF $OUT[1]==FALSE THEN ;IF SPINDLE STOP

    $OV_PRO = 0 ;ROBOT STOP TOO IN AUTOMATIC MODE

    ENDIF

    ENDIF

  • If a solution in KRL is feasible at all due to safety regulations in your country you should use BRAKE or BRAKE F or BRAKE FF. At best from inside an Interrupt possibly combined with RESUME.


    Fubini

Advertising from our partners