December 2001 PLC Program Example 7 – 51
PLC program example
1
2 *+----------------------------------------------------+
3 *| Main-Program for TNC 430 |
4 *+----------------------------------------------------+
5
6 #plcpath PLC:\EXAMPLE\
7 #pragma symsort
8 #pragma nsc
9 #pragma dl 1
10 *#pragma nsw
11
12 *+----------------------------------------------------+
13 *| Marker range definition |
14 *+----------------------------------------------------+
15
16 #define /MN 3200 3999
17 #define /MR 200 999
18 #define /BN 2048 4095
19 #define /BR 4 127
20
21 *+----------------------------------------------------+
22 *| Gloal file definition |
23 *+----------------------------------------------------+
24
25 #define /g Config.Def
1
2 *+---------------------------------------------------+
3 *| Configuartion file for this PLC program |
4 *+---------------------------------------------------+
5
6 * Number of PL boards
K0 7 #define First_PL 0
8
9 * Input Belegung definieren
K0 10 #define IO_MB410 K+0
K1 11 #define IO_SPG K+1
K0 12 #define IO_Belegung K &IO_MB410
13
14 * Monitoring motor temperature axes 1...5
K255 15 #define Motor_Temp_1 255
K255 16 #define Motor_Temp_2 255
K255 17 #define Motor_Temp_3 255
K255 18 #define Motor_Temp_4 255
K255 19 #define Motor_Temp_5 255
K255 20 #define Motor_Temp_S 255
21
22
23 #ifdef $TNC410M$ or $TNC410MA$ or $TNC410PA$
K0 24 #define NC_Type_Digital 0
25 #endif
26
27 #ifdef $TNC426M$ or $TNC426PB$ or $TNC430M$ or $TNC430PA$
28 #define NC_Type_Digital 0
29 #endif
30
31 #ifdef $TNC410$ or $TNC410M$ or $TNC410M$ or $TNC410MA$ or $TNC410CA$ or $TNC410PA$
K4 32 #define Max_NC_Axis 4 * NC-axis without spindle
33 #else
34 #define Max_NC_Axis 5 * NC-axis without spindle
35 #endif
36
26 #define /g GLB_TCMB.Def
1 *+----------------------------------------------------+
2 *| Global makrker Byte Word DWord |
3 *+----------------------------------------------------+
4
5 #Type M
M3999 6 MG_one_marker
M3998 7 MG_zero_marker
M3997 8 MG_spindle_on_M03
M3996 9 MG_spindle_on_M04
M3995 10 MG_spindle_off_M05
M3994 11 MG_spi_Pos_M19_R_M0X
M3993 12 MG_T_I_N_supervision
M3992 13 MG_Spindle_RPM_Zero
M3991 14 MG_spindle_on_gear
M3990 15 MG_gear_change_activ
16