I've been working in a machine that has no PLC, so the robot (FS100) controls the cylinders.
As part of a client request, one of the cylinders should attempt to move forward at least 3 times before throwing an alarm.
To do this, I use an I variable (CylinderAtempts ) to count how many attempts have been performed so far.
However, when the cylinder fails to reach a forward position and I increment the variable, the program just stops.
No alarms, Green light still on and Subprograms are still happily running. Just the Main program stopped at that line.
Program:
/JOB
//NAME CYL_VIB_VT
//POS
///NPOS 0,0,0,0,0,0
//ALIAS
///IN 3
0098 xButtonReset
0123 xCylFeedVertBW
0124 xCylFeedVertFW
///OT 3
0027 Alarm
0044 yFeedCylVertFW
0045 yCylFeedVertBW
///GVARS 1,0,0,0,0,0,0,0
B006 CylinderAtempts
//ARGINFO
///ARGTYPE B,,,,,,,
//INST
///DATE 2021/08/16 12:17
///COMM ANBC
///ATTR SC,RW
///LVARS 1,0,0,0,0,0,0,0
NOP
'********************************
'* SUBPROGRAMA *
'* Cil. Alimentador Vertical *
'* Avancar / Recuar *
'********************************
'
*Begin
' Load Arguments
GETARG LB000 IARG#(1)
' Reset Atempts
SET CylinderAtempts 0
'Select Order
JUMP *FW IF LB000=1
'--------------------------------
*BW
' Move cylinder Backward
DOUT OT#(yFeedCylVertFW) OFF
DOUT OT#(yCylFeedVertBW) ON
WAIT IN#(xCylFeedVertBW)=ON T=3.000
JUMP *End IF IN#(xCylFeedVertBW)=ON
' Failure Moving Backward
DOUT OT#(yCylFeedVertBW) OFF
DOUT OT#(yFeedCylVertFW) ON
WAIT IN#(xCylFeedVertFW)=ON T=3.000
ADD CylinderAtempts 1
' Retry
JUMP *BW IF CylinderAtempts<3
' Backward Alarm
MSG "Cil. Bloq. Cupholder Encravado"
DOUT OT#(Alarm) ON
WAIT IN#(xButtonReset)=ON
DOUT OT#(Alarm) OFF
JUMP *Begin
'--------------------------------
*FW
' Move Forward
DOUT OT#(yCylFeedVertBW) OFF
DOUT OT#(yFeedCylVertFW) ON
WAIT IN#(xCylFeedVertFW)=ON T=3.000
JUMP *End IF IN#(xCylFeedVertFW)=ON
' Failed when Advancing
DOUT OT#(yFeedCylVertFW) OFF
DOUT OT#(yCylFeedVertBW) ON
WAIT IN#(xCylFeedVertBW)=ON T=3.000
ADD CylinderAtempts 1
' Retry movement.
JUMP *FW IF CylinderAtempts<3
' Alarm when advancing
MSG "Cil. Bloq. Bupholder Encravado"
DOUT OT#(Alarm) ON
WAIT IN#(xButtonReset)=ON
DOUT OT#(Alarm) OFF
JUMP *Begin
*End
END
Display More
Sorry for the portuguese bits.
The program takes an argument to know if I'm requesting a Forward or backward movement.
If the movement suceeds, it ends. If it doesn't, it moves in the oposite direction (to reset) and attempts to perform the movement once more.
The line where it stops is the "ADD CylinderAtempts 1".
If I switch the key to "TEACH", move the cursor one or two lines above it and move the key back to "REMOTE" or "PLAY", the program resumes execution, executes the prior lines and once again stops at that line.
If I switch the key back to "TEACH", I can use Interlock+FWD to execute the line without any problem.
Things we've tried:
-changing Cylinder attempts to a Byte variable.
-changing the name to a shorter one (CylAtp)
-using INC to increment
-using SET CylinderAtempts CylinderAtempts + 1
Nothing has worked so far. The robot simply reaches that line and does not execute anything further.
Has this ever happened to someone?
Not sure if it matters, but:
When I call the program directly, it works without issues.
But it fails when called during normal execution. The only diference I could see here is how deep it is within the Stack:
>Test Program -> Cylinder Program - This works
>Main Program -> Part Handling -> Riveting Program -> Cylinder Program - This does not
Is there some kind of difficulty when using ARITH functions if the stack is too large?
There's also a Subprogram waiting for a Variable to take a certain value (indicating the part has been completed). Does a WAIT on a Subprogram also halt the main Program?