HI all ,
I'm looking to add some code to my SPS.Sub file that runs in the background to handle sending data to a ethercat Motor . Everything works well if I run the commands for the motor inside the main program until I need to change the speed between points. the program is no longer smooth (the movement is jerky).
I did some tests and if I just set the speed without the IO connection everything is smooth in the program. So... If I run the IO from the SPS.sub i hope my problem is solved.
I this is the code that works in the main program.
This is what makes the program run slowly
VEL={CP 0.04171,ORI1 90.000,ORI2 90.000}
LIN {X 1128.20, Y 1025.18, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
$VEL={CP 0.04171,ORI1 90.000,ORI2 90.000}
LIN {X 1133.31, Y 1024.48, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
SPEED = -5.478 ; SCREW SPEED AFTER THE GEAR BOX CHANGE
JOG_SPEED = SPEED/60 * 8000 *10 *25
$VEL={CP 0.04144,ORI1 90.000,ORI2 90.000}
LIN {X 1137.82, Y 1021.83, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
SPEED = -5.467 ; SCREW SPEED AFTER THE GEAR BOX CHANGE
JOG_SPEED = SPEED/60 * 8000 *10 *25
$VEL={CP 0.04136,ORI1 90.000,ORI2 90.000}
;Programme snippit
Display More
This runs well (but needs to work with the SPS.SUB or a loop program to handle the IOs switching 32 bit )
VEL={CP 0.04171,ORI1 90.000,ORI2 90.000}
LIN {X 1128.20, Y 1025.18, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
$VEL={CP 0.04171,ORI1 90.000,ORI2 90.000}
LIN {X 1133.31, Y 1024.48, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
SPEED = -5.478 ; SCREW SPEED AFTER THE GEAR BOX CHANGE
$VEL={CP 0.04144,ORI1 90.000,ORI2 90.000}
LIN {X 1137.82, Y 1021.83, Z 31.00, A 90.00, B -0.00, C 0.00} C_DIS
SPEED = -5.467 ; SCREW SPEED AFTER THE GEAR BOX CHANGE
$VEL={CP 0.04136,ORI1 90.000,ORI2 90.000}
;Programme snippit
Display More
This is what i tried to add to the SPS.Sub but i get the error : 'Submit interpreter is not active' When I run the main program
WHILE TRUE
JOG_SPEED = SPEED / 60 * 8000 * 10 * 25;
WAIT MSEC 100; ; // Wait for 100ms to prevent the loop from running too quickly and consuming too many resources
ENDWHILE
I have Delarded everything and I do not get an error in work visual on the inserted code.
I welcome any feedback.
Thanks Martin