Control register is read by M_Inw(16) and rewrited to mProgram variable.
Line M_Outw(16)=M_Inw(16) can be used as a confirmation of received value back to PLC (and generally as a communication working confirmation).
Select…Case function compares a value from control register and activate a Case if the value matches to Case value.
Additional information
Callp instruction switches program on specified Slot to called one, for example: Main program is switched to Init program after Callp “Init” instruction.
Called program by Callp instruction is performed only one time, then the previous program is loaded again.
Do not insert any movement command to this program. Movements and other application command insert to programs run by CallP instruction.
II.2 Sample code of first called program (INIT)
This is an example of application program (movements, etc.).
M_Outw(16) commands are introduced here to send out to PLC information of performed steps. Control value was “100”, confirmation values are respectively “101”, “102”, etc.
PLC program, right after receiving confirmation that called program is executed, should change its value (e.g “100” -> “0” or “100” -> “101”). Otherwise the program will be run once again, right after ending.
II.3 Sample code of second called program (SEQ1)
This is an example of application program (movements, etc.).
M_Outw(16) commands are introduced here to send out to PLC information of performed steps. Control value was “200”, confirmation values are respectively “201”, “202”, etc.
PLC program, right after receiving confirmation that called program is executed, should change its value (e.g “200” -> “0” or “200” -> “201”). Otherwise the program will be run once again, right after ending.
III Parameters
III.1 Slot Table
Set below parameters to load the MAIN program to Slot 1 for execution:
1 Open Slot Table parameters
2 Select first Slot
3 Click Set… and confirm next window about reading program list
4 In Slot Table Parameter Setting chose desired program
5 Set condition to START (or ALWAYS)
6 Write parameters and restart robot
III.2 General control
Set general control signals
No needed if the MAIN program is executed in ALWAYS mode
By these signals control the Main program.
After robot power on, set Operation Enable signal and then Start signal. The Main program on Slot 1 will start running.
IV Operation
When MAIN program is running, send right control value to execute desired application program.
When robot confirms the program execution by its output register M_Outw(…) immediately change the PLC control value to other one.
If the control value is 0 or any other than values defined in Select…Case function, robot will not load any program -the only working program will be MAIN.