4.3.1. Main program
4.3.1. Main program
The main program is divided into the following 4 sections.
(1) To initialize processes and variables
(2) To record tool control and shift variables
(3) To judge and execute palletizing conditions
(4) To process errors
When it is necessary to run processes by using the standard program, the user must run the main program at least once. This is because the main program processes signals and carries out initialization. Up to 16th lines in [Program 1 Main program configuration] are related to the basic initialization. If the initialization section is run at least once and the relevant data are saved, the job programs such as pallet movement and slip sheet movement can be run normally without additional processing.
Program 1 Main program configuration
Program File Format Version : 1.6 MechType: _MECHTYPE TotalAxis: _TOTAL_AX AuxAxis: _AUX_AX 1 ''Main Job Program 2 '------------------------ 3 CONTPATH 2 4 '------------------------ 5 V%[98]=0 'JOB PROGRAM ERROR INITIALIZING 6 '------------------------ 7 CALL 100 'Process initializing 8 CALL 200 'Variable initializing 9 CALL 300 'Signal initializing 10 CALL 400 'Home position initializing 11 '------------------------ 12 CALL 451 '1 Process tool control recording 13 CALL 501 '1 Process pallet shift recording 14 … 15 16 '------------------------ 17 CALL 1001 'Simulation setting 18 V![8] = TIMER 19 100 WAIT V%[1] = 1 'START 20 '------------------------ 21 SELECT V%[5] 22 CASE 1 'Work #1 23 IF V%[6]<>V%[5] THEN 24 CALL 601 'User CRD 25 ENDIF 26 CALL 751 '1 Process pallet moving 27 V%[6] = V%[5] 'Previous process saving 28 … 29 CASE ELSE 30 V%[98]=1 ''Process not registered 31 GOTO 200 32 END_SELECT 33 '------------------------ 34 CALL 1002 'Simulation completion setting 35 IF V%[566]=9999 THEN 300 36 '------------------------ 37 'Normal processing 38 GOTO 100 39 '------------------------ 40 'Error Handling 41 '------------------------ 42 200 CALL 999 'Error function 43 300 PRINT #0, "Total Cycle Time= " ; TIMER - V![8] 44 END |