Hi to all,
I'm trying to write a KRL program that reads data from the user and executing the robot accordingly.
I have realized that KRL has some hard limit regarding the number of elements per array that cannot be exceeded and i want the number of data to be infinite.
Therefor i'm trying to solve the issue by seperating the part of my code that is in-charge on getting data from the user using EthernetKRLXML and putting it in a background process.
I've learned that it is possible to do that by writing that part of the code in the SPS.SUB (Answer which i got from KUKA Hotline)
I tried testing it by simply writing code on the SPS.SUB that all it does is initiate the KRI and once a client is connected it will send it a welcome message (XML).
There are several compilation errors that i don't understand and would like you guys to help me out.
But first - this is the code i written in SPS.SUB
&ACCESS RVO
&COMMENT PLC on control
DEF SPS ( )
;FOLD DECLARATIONS
;FOLD BASISTECH DECL
;Automatik extern
DECL STATE_T STAT
DECL MODUS_T MODE
;ENDFOLD (BASISTECH DECL)
;FOLD USER DECL
; Please insert user defined declarations
;ENDFOLD (USER DECL)
;ENDFOLD (DECLARATIONS)
;FOLD INI
;FOLD AUTOEXT INIT
INTERRUPT DECL 91 WHEN $PRO_STATE1==#P_FREE DO RESET_OUT ()
INTERRUPT ON 91
$LOOP_MSG[]=" "
MODE=#SYNC
$H_POS=$H_POS
;Automatik extern
IF $MODE_OP==#EX THEN
CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
ENDIF
;ENDFOLD (AUTOEXT INIT)
;FOLD BACKUPMANAGER PLC INIT
BM_ENABLED = FALSE
BM_OUTPUTVALUE = 0
;ENDFOLD (BACKUPMANAGER PLC INIT)
;FOLD TQM_INIT
TorqueDefinitions()
;ENDFOLD (TQM_INIT)
;FOLD USER INIT
; Please insert user defined initialization commands
INTERRUPT DECL 40 WHEN $FLAG[555] == TRUE DO ETHERTESTConnectionSucceded()
INTERRUPT DECL 41 WHEN $FLAG[555] == FALSE DO ETHERTESTConnectionLost()
INTERRUPT ON 40
INTERRUPT ON 41
IF ($FLAG[555] == FALSE) THEN
EKI_INIT("ETHERTESTKRLV2")
EKI_OPEN("ETHERTESTKRLV2")
ENDIF
;ENDFOLD (USER INIT)
;ENDFOLD (INI)
LOOP
WAIT FOR NOT($POWER_FAIL)
TORQUE_MONITORING()
;FOLD BACKUPMANAGER PLC
IF BM_ENABLED THEN
BM_OUTPUTSIGNAL = BM_OUTPUTVALUE
ENDIF
;ENDFOLD (BACKUPMANAGER PLC)
;FOLD USER PLC
;Make your modifications here
;ENDFOLD (USER PLC)
ENDLOOP
;FOLD ;%{H}
;FOLD
IF ($FLAG[555] == TRUE) THEN
EKI_CLEAR("ETHERTESTKRLV2")
ENDIF
END
;ENDFOLD
DEF RESET_OUT ( )
INT N
MsgLoop(" ")
IF REFLECT_PROG_NR == 1 THEN
FOR N = 0 TO PGNO_LENGTH - 1
$OUT[PGNO_FBIT_REFL + N] = FALSE
ENDFOR
ENDIF
IF (PGNO_REQ>0) THEN
$OUT[PGNO_REQ]=FALSE
ELSE
IF (PGNO_REQ<0) THEN
$OUT[-PGNO_REQ]=TRUE
ENDIF
ENDIF
END
;FOLD USER SUBROUTINE
; Integrate your user defined subroutines
DEF ETHERTESTConnectionSucceded()
EKI_SETINT("ETHERTESTKRLV2", "ROBOT/Welcome/SessionId", 0)
EKI_SETINT("ETHERTESTKRLV2", "ROBOT/Welcome/RobotId", 1)
IF ($FLAG[555] == TRUE) THEN
EKI_SEND("ETHERTESTKRLV2", "ROBOT/Welcome")
ENDIF
END
DEF ETHERTESTConnectionLost()
IF $FLAG[555]==FALSE THEN
EKI_CLEAR("ETHERTESTKRLV2")
EKI_INIT("ETHERTESTKRLV2")
EKI_OPEN("ETHERTESTKRLV2")
ENDIF
END
;ENDFOLD (USER SUBROUTINE)
;ENDFOLD
Display More
and these are the compliation errors
Error no. 2347: Value for PRIO inadmissible - Line 34, Column 21
*** INTERRUPT DECL 40 WHEN $FLAG[555] == TRUE DO ETHERTESTConnectionSucceded()
Error no. 2347: Value for PRIO inadmissible - Line 35, Column 21
*** INTERRUPT DECL 41 WHEN $FLAG[555] == FALSE DO ETHERTESTConnectionLost()
Error no. 2347: Value for PRIO inadmissible - Line 36, Column 19
*** INTERRUPT ON 40
Error no. 2347: Value for PRIO inadmissible - Line 37, Column 19
*** INTERRUPT ON 41
Error no. 2135: Name not declared as subprogram - Line 40, Column 1
*** EKI_INIT("ETHERTESTKRLV2")
Error no. 2135: Name not declared as subprogram - Line 41, Column 1
*** EKI_OPEN("ETHERTESTKRLV2")
Error no. 2135: Name not declared as subprogram - Line 63, Column 1
*** EKI_CLEAR("ETHERTESTKRLV2")
Error no. 2135: Name not declared as subprogram - Line 89, Column 1
*** EKI_SETINT("ETHERTESTKRLV2", "ROBOT/Welcome/SessionId", 0)
Error no. 2135: Name not declared as subprogram - Line 90, Column 1
*** EKI_SETINT("ETHERTESTKRLV2", "ROBOT/Welcome/RobotId", 1)
Error no. 2135: Name not declared as subprogram - Line 93, Column 1
*** EKI_SEND("ETHERTESTKRLV2", "ROBOT/Welcome")
Error no. 2135: Name not declared as subprogram - Line 101, Column 1
*** EKI_CLEAR("ETHERTESTKRLV2")
Error no. 2135: Name not declared as subprogram - Line 102, Column 1
*** EKI_INIT("ETHERTESTKRLV2")
Error no. 2135: Name not declared as subprogram - Line 103, Column 1
*** EKI_OPEN("ETHERTESTKRLV2")
The first compilation errors regarding the Interrupts - I have no idea how to fix them
The last compilation errors regarding the EKI_* methods are probably because i need some how to let the SPS.SUB include the EKI library but I have no clue how to do it.
Any help will be welcomed - Thanks