CALL: Difference between revisions

31 bytes added ,  5 years ago
no edit summary
No edit summary
No edit summary
Line 18:
For situations where certain instructions are repetitive or may be seen in many programs, small operation programs may be made for the purpose of being called in larger programs.
 
==== Example: ====
''RO[4:Vacuum] = OFF''
 
''WAIT 1seconds''
RO[4:Vacuum] = OFF
 
''RO[4:Vacuum] = ON''
WAIT 1seconds
 
RO[4:Vacuum] = ON
 
In this example the program has three lines. The first line turns the vacuum system off to let go of a part on the robot's tool. Since there may be a delay in response, a wait instruction is added to ensure the vacuum tool has had a chance to let go of the object. The third line returns the vacuum to its prior state, ready to pick up a new object.
 
==== Note: ====
Note: The called program must eventually reach "END" and not simply CALL the original, as the processor's stack will simply continue filling up and a STACK OVERFLOW error may result.