4-123
Multitask function
4MELFA-BASIC IV
(2) Procedures to multitask execution
*Procedure 1: Program creation
<1> Movement program (Program name: 1)
1 Cnt 1
'Validate path connected movement
2 Mov P2,10
'Move to +10mm above P2
3 Mov P1,10
'Move to +10mm above P1
4 Mov P1
'Move to P1 workpiece pickup position
5 M_Out(10)=0
'Pickup workpiece
6 Dly 0.05
'Timer 0.05 second
7 Mov P1,10
'Move to +10mm above P1
8 Mov P3
'Move to vision pre-position P3
9 Spd 500
'Set linear speed to 500mm/sec.
10 Mvs P4
'Start vision lead-in with P4 passage
11 M_02#=0
'Start data lead-in with background process at interlock variable
(M_01=1/M_02=0)
18 M_01#=1
'Start data load-in with background process
19 Mvs P2,10
'Move to +10mm above P2
20 *L
21 If M_02#=0 Then GoTo *L
'Wait for interlock variable M_02 to reach 1
22 P20=P2*P_01
'Add vision compensation P_01 to P20, and move to +10mm above
23 Mov P20,10
'Move to +10mm above P20
24 Mov P20
'Go to P20 workpiece placing position
24 M_Out(10)=1
'Place workpiece
25 Dly 0.05
'Timer 0.05 second
26 Mov P20,10
'Move to +10mm above P20
27 Cnt 0
'Invalidate path connected movement
28 End
'End one cycle
<2> Position data lead-in program (Program name: 2)
1 *R
2 If M_01#=0 Then GoTo *R
'Wait for interlock variable M_01 to reach 1
3 Open "COM1:" AS #1
'Open RS-232-C line
4 Dly M_03#
'Hypothetical process timer (0.05 second)
5 Print #1,"SENS"
'Transmit character string "SENS" to RS-232-C (vision side)
6 Input #1,M1,M2,M3
'Wait to lead-in vision compensation value (relative data)
7 P_01.X=M1
'Substitute delta X coordinate
8 P_01.Y=M2
'Substitute delta Y coordinate
9 P_01.Z=0.0
'
10 P_01.A=0.0
'
11 P_01.B=0.0
'
12 P_01.C=Rad(M3)
'Substitute delta C coordinate
13 Close
'Close RS-232-C line
14 M_01#=0
'Interlock variable M_01 = 0
15 M_02#=1
'Interlock variable M_02 = 0
16 End
'End process
*Procedure 2: Setting the slot parameters
Set the slot parameters as shown below.
*Procedure 3: Reflecting the slot parameters
Turn the power OFF and ON to validate the slot parameters.
Parameters
Program name
Operation mode
Operation format
Number of executed lines
SLT1
1
REP
START
1
SLT2
2
REP
START
1