December 2001 PLC Program Example 7 – 59
1
2 *+----------------------------------------------------+
3 *| M-function |
4 *+----------------------------------------------------+
5
6 GLOBAL M_Function
7
175 LBL M_FUNCTION 8 LBL M_Function
176 L W260 9 L NP_W260_M_code
177 < K30 10 < K+30
178 IFT 11 IFT
179 L W260 12 L NP_W260_M_code
180 =X 13 =X
181 L KF M_FUNK_TAB[X] 14 L KF M_Funk_Tab[X]
182 =X 15 =X
183 L M4072 16 L NP_M4072_strobe_M_function
184 = M0[X] 17 = M0[X]
185 ENDI 18 ENDI
186 EM 19 EM
20
188 KFIELD M_FUNK_TAB 21 KFIELD M_Funk_Tab
189 K3995 ; 0 22 K &MG_spindle_off_M05 ; 0
190 K4805 ; 1 23 K &PN_error_not_used_M_function ; 1
191 K3995 ; 2 24 K &MG_spindle_off_M05 ; 2
192 K3997 ; 3 25 K &MG_spindle_on_M03 ; 3
193 K3996 ; 4 26 K &MG_spindle_on_M04 ; 4
194 K3995 ; 5 27 K &MG_spindle_off_M05 ; 5
195 K4805 ; 6 28 K &PN_error_not_used_M_function ; 6
196 K4805 ; 7 29 K &PN_error_not_used_M_function ; 7
197 K4805 ; 8 30 K &PN_error_not_used_M_function ; 8
198 K4805 ; 9 31 K &PN_error_not_used_M_function ; 9
199 K4805 ;10 32 K &PN_error_not_used_M_function ;10
200 K4805 ; 1 33 K &PN_error_not_used_M_function ; 1
201 K4805 ; 2 34 K &PN_error_not_used_M_function ; 2
202 K3997 ; 3 35 K &MG_spindle_on_M03 ; 3
203 K3996 ; 4 36 K &MG_spindle_on_M04 ; 4
204 K4805 ; 5 37 K &PN_error_not_used_M_function ; 5
205 K4805 ; 6 38 K &PN_error_not_used_M_function ; 6
206 K4805 ; 7 39 K &PN_error_not_used_M_function ; 7
207 K4805 ; 8 40 K &PN_error_not_used_M_function ; 8
208 K3994 ; 9 41 K &MG_spi_Pos_M19_R_M0X ; 9
209 K4805 ;20 42 K &PN_error_not_used_M_function ;20
210 K4805 ; 1 43 K &PN_error_not_used_M_function ; 1
211 K4805 ; 2 44 K &PN_error_not_used_M_function ; 2
212 K4805 ; 3 45 K &PN_error_not_used_M_function ; 3
213 K4805 ; 4 46 K &PN_error_not_used_M_function ; 4
214 K4805 ; 5 47 K &PN_error_not_used_M_function ; 5
215 K4805 ; 6 48 K &PN_error_not_used_M_function ; 6
216 K4805 ; 7 49 K &PN_error_not_used_M_function ; 7
217 K4805 ; 8 50 K &PN_error_not_used_M_function ; 8
218 K4805 ; 9 51 K &PN_error_not_used_M_function ; 9
219 K3995 ;30 52 K &MG_spindle_off_M05 ;30
220 ENDK 53 ENDK
________________________________ Local Labels ________________________________
M_FUNK_TAB : 21
14
1
2 *+----------------------------------------------------+
3 *| Reference endswitch |
4 *+----------------------------------------------------+
5
6 GLOBAL reference_endswitch
7
M3200 8 #define Inputs M[16]
M3200 9 #define /c Input_Bit0 M &Inputs + 0
M3201 10 #define /c Input_Bit1 M &Inputs + 1
M3202 11 #define /c Input_Bit2 M &Inputs + 2
M3203 12 #define /c Input_Bit3 M &Inputs + 3
M3204 13 #define /c Input_Bit4 M &Inputs + 4
14
221 LBL REFERENCE_ENDSWI 15 LBL reference_endswitch
222 L I0 16 L I_Ref_Endswitch_1_axis
223 = M3200 17 = Input_Bit0
224 L I1 18 L I_Ref_Endswitch_2_axis
225 = M3201 19 = Input_Bit1
226 L I2 20 L I_Ref_Endswitch_3_axis
227 = M3202 21 = Input_Bit2
228 L I4 22 L I_Ref_Endswitch_4_axis
229 = M3203 23 = Input_Bit3
230 L I6 24 L I_Ref_Endswitch_5_axis
231 = M3204 25 = Input_Bit4
26
233 LB M3200 27 LB Inputs
234 = W1054 28 = PN_W1054_reference_endswitch
235 EM 29 EM
30
PLC program example