Files
RCU_C12_Dimming/Listings/PWM15bit.lst
caocong 6ef7f0c503 docs:发布文件
发布生产文件:BLV_C12_Dimm_V19.hex
2025-12-16 16:59:36 +08:00

576 lines
30 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 1
C51 COMPILER V9.01, COMPILATION OF MODULE PWM15BIT
OBJECT MODULE PLACED IN .\Objects\PWM15bit.obj
COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE PWM15bit.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listings\
-PWM15bit.lst) OBJECT(.\Objects\PWM15bit.obj)
line level source
1 /*---------------------------------------------------------------------*/
2 /* --- STC MCU Limited ------------------------------------------------*/
3 /* --- STC 1T Series MCU Demo Programme -------------------------------*/
4 /* --- Mobile: (86)13922805190 ----------------------------------------*/
5 /* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/
6 /* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/
7 /* --- Web: www.STCMCU.com --------------------------------------------*/
8 /* --- Web: www.STCMCUDATA.com ---------------------------------------*/
9 /* --- QQ: 800003751 -------------------------------------------------*/
10 /* 如果要在程序中使用此代码,请在程序中注明使用了STC的资料及程序 */
11 /*---------------------------------------------------------------------*/
12
13 #include "PWM15bit.h"
14
15 u16 code PWMxCR[48] = {
16 0xff14, /* PWM00CR */
17 0xff1c, /* PWM01CR */
18 0xff24, /* PWM02CR */
19 0xff2c, /* PWM03CR */
20 0xff34, /* PWM04CR */
21 0xff3c, /* PWM05CR */
22 0xff44, /* PWM06CR */
23 0xff4c, /* PWM07CR */
24 0xff64, /* PWM10CR */
25 0xff6c, /* PWM11CR */
26 0xff74, /* PWM12CR */
27 0xff7c, /* PWM13CR */
28 0xff84, /* PWM14CR */
29 0xff8c, /* PWM15CR */
30 0xff94, /* PWM16CR */
31 0xff9c, /* PWM17CR */
32 0xffb4, /* PWM20CR */
33 0xffbc, /* PWM21CR */
34 0xffc4, /* PWM22CR */
35 0xffcc, /* PWM23CR */
36 0xffd4, /* PWM24CR */
37 0xffdc, /* PWM25CR */
38 0xffe4, /* PWM26CR */
39 0xffec, /* PWM27CR */
40 0xfc14, /* PWM30CR */
41 0xfc1c, /* PWM31CR */
42 0xfc24, /* PWM32CR */
43 0xfc2c, /* PWM33CR */
44 0xfc34, /* PWM34CR */
45 0xfc3c, /* PWM35CR */
46 0xfc44, /* PWM36CR */
47 0xfc4c, /* PWM37CR */
48 0xfc64, /* PWM40CR */
49 0xfc6c, /* PWM41CR */
50 0xfc74, /* PWM42CR */
51 0xfc7c, /* PWM43CR */
52 0xfc84, /* PWM44CR */
53 0xfc8c, /* PWM45CR */
54 0xfc94, /* PWM46CR */
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 2
55 0xfc9c, /* PWM47CR */
56 0xfcb4, /* PWM50CR */
57 0xfcbc, /* PWM51CR */
58 0xfcc4, /* PWM52CR */
59 0xfccc, /* PWM53CR */
60 0xfcd4, /* PWM54CR */
61 0xfcdc, /* PWM55CR */
62 0xfce4, /* PWM56CR */
63 0xfcec, /* PWM57CR */
64 };
65
66 u16 code PWMxT1[48] = {
67 0xff10, /* PWM00T1 */
68 0xff18, /* PWM01T1 */
69 0xff20, /* PWM02T1 */
70 0xff28, /* PWM03T1 */
71 0xff30, /* PWM04T1 */
72 0xff38, /* PWM05T1 */
73 0xff40, /* PWM06T1 */
74 0xff48, /* PWM07T1 */
75 0xff60, /* PWM10T1 */
76 0xff68, /* PWM11T1 */
77 0xff70, /* PWM12T1 */
78 0xff78, /* PWM13T1 */
79 0xff80, /* PWM14T1 */
80 0xff88, /* PWM15T1 */
81 0xff90, /* PWM16T1 */
82 0xff98, /* PWM17T1 */
83 0xffb0, /* PWM20T1 */
84 0xffb8, /* PWM21T1 */
85 0xffc0, /* PWM22T1 */
86 0xffc8, /* PWM23T1 */
87 0xffd0, /* PWM24T1 */
88 0xffd8, /* PWM25T1 */
89 0xffe0, /* PWM26T1 */
90 0xffe8, /* PWM27T1 */
91 0xfc10, /* PWM30T1 */
92 0xfc18, /* PWM31T1 */
93 0xfc20, /* PWM32T1 */
94 0xfc28, /* PWM33T1 */
95 0xfc30, /* PWM34T1 */
96 0xfc38, /* PWM35T1 */
97 0xfc40, /* PWM36T1 */
98 0xfc48, /* PWM37T1 */
99 0xfc60, /* PWM40T1 */
100 0xfc68, /* PWM41T1 */
101 0xfc70, /* PWM42T1 */
102 0xfc78, /* PWM43T1 */
103 0xfc80, /* PWM44T1 */
104 0xfc88, /* PWM45T1 */
105 0xfc90, /* PWM46T1 */
106 0xfc98, /* PWM47T1 */
107 0xfcb0, /* PWM50T1 */
108 0xfcb8, /* PWM51T1 */
109 0xfcc0, /* PWM52T1 */
110 0xfcc8, /* PWM53T1 */
111 0xfcd0, /* PWM54T1 */
112 0xfcd8, /* PWM55T1 */
113 0xfce0, /* PWM56T1 */
114 0xfce8, /* PWM57T1 */
115 };
116
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 3
117 u16 code PWMxT2[48] = {
118 0xff12, /* PWM00T2 */
119 0xff1a, /* PWM01T2 */
120 0xff22, /* PWM02T2 */
121 0xff2a, /* PWM03T2 */
122 0xff32, /* PWM04T2 */
123 0xff3a, /* PWM05T2 */
124 0xff42, /* PWM06T2 */
125 0xff4a, /* PWM07T2 */
126 0xff62, /* PWM10T2 */
127 0xff6a, /* PWM11T2 */
128 0xff72, /* PWM12T2 */
129 0xff7a, /* PWM13T2 */
130 0xff82, /* PWM14T2 */
131 0xff8a, /* PWM15T2 */
132 0xff92, /* PWM16T2 */
133 0xff9a, /* PWM17T2 */
134 0xffb2, /* PWM20T2 */
135 0xffba, /* PWM21T2 */
136 0xffc2, /* PWM22T2 */
137 0xffca, /* PWM23T2 */
138 0xffd2, /* PWM24T2 */
139 0xffda, /* PWM25T2 */
140 0xffe2, /* PWM26T2 */
141 0xffea, /* PWM27T2 */
142 0xfc12, /* PWM30T2 */
143 0xfc1a, /* PWM31T2 */
144 0xfc22, /* PWM32T2 */
145 0xfc2a, /* PWM33T2 */
146 0xfc32, /* PWM34T2 */
147 0xfc3a, /* PWM35T2 */
148 0xfc42, /* PWM36T2 */
149 0xfc4a, /* PWM37T2 */
150 0xfc62, /* PWM40T2 */
151 0xfc6a, /* PWM41T2 */
152 0xfc72, /* PWM42T2 */
153 0xfc7a, /* PWM43T2 */
154 0xfc82, /* PWM44T2 */
155 0xfc8a, /* PWM45T2 */
156 0xfc92, /* PWM46T2 */
157 0xfc9a, /* PWM47T2 */
158 0xfcb2, /* PWM50T2 */
159 0xfcba, /* PWM51T2 */
160 0xfcc2, /* PWM52T2 */
161 0xfcca, /* PWM53T2 */
162 0xfcd2, /* PWM54T2 */
163 0xfcda, /* PWM55T2 */
164 0xfce2, /* PWM56T2 */
165 0xfcea, /* PWM57T2 */
166 };
167
168 u16 code PWMxHLD[48] = {
169 0xff15, /* PWM00HLD */
170 0xff1d, /* PWM01HLD */
171 0xff25, /* PWM02HLD */
172 0xff2d, /* PWM03HLD */
173 0xff35, /* PWM04HLD */
174 0xff3d, /* PWM05HLD */
175 0xff45, /* PWM06HLD */
176 0xff4d, /* PWM07HLD */
177 0xff65, /* PWM10HLD */
178 0xff6d, /* PWM11HLD */
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 4
179 0xff75, /* PWM12HLD */
180 0xff7d, /* PWM13HLD */
181 0xff85, /* PWM14HLD */
182 0xff8d, /* PWM15HLD */
183 0xff95, /* PWM16HLD */
184 0xff9d, /* PWM17HLD */
185 0xffb5, /* PWM20HLD */
186 0xffbd, /* PWM21HLD */
187 0xffc5, /* PWM22HLD */
188 0xffcd, /* PWM23HLD */
189 0xffd5, /* PWM24HLD */
190 0xffdd, /* PWM25HLD */
191 0xffe5, /* PWM26HLD */
192 0xffed, /* PWM27HLD */
193 0xfc15, /* PWM30HLD */
194 0xfc1d, /* PWM31HLD */
195 0xfc25, /* PWM32HLD */
196 0xfc2d, /* PWM33HLD */
197 0xfc35, /* PWM34HLD */
198 0xfc3d, /* PWM35HLD */
199 0xfc45, /* PWM36HLD */
200 0xfc4d, /* PWM37HLD */
201 0xfc65, /* PWM40HLD */
202 0xfc6d, /* PWM41HLD */
203 0xfc75, /* PWM42HLD */
204 0xfc7d, /* PWM43HLD */
205 0xfc85, /* PWM44HLD */
206 0xfc8d, /* PWM45HLD */
207 0xfc95, /* PWM46HLD */
208 0xfc9d, /* PWM47HLD */
209 0xfcb5, /* PWM50HLD */
210 0xfcbd, /* PWM51HLD */
211 0xfcc5, /* PWM52HLD */
212 0xfccd, /* PWM53HLD */
213 0xfcd5, /* PWM54HLD */
214 0xfcdd, /* PWM55HLD */
215 0xfce5, /* PWM56HLD */
216 0xfced, /* PWM57HLD */
217 };
218
219 //========================================================================
220 // 函数: u8 PWMChannelCtrl(u8 PWM_id, u8 pwm_eno, u8 pwm_ini, u8 pwm_eni, u8 pwm_ent2i, u8 pwm_ent1i)
221 // 描述: PWM通道控制寄存器设置.
222 // 参数: PWM_id: PWM通道序号. 取值 0~57
223 // pwm_eno: pwm输出使能, 0设为GPIO, 1设为PWM输出.
224 // pwm_ini: pwm输出端的初始电平, 0为低电平, 1为高电平.
225 // pwm_eni: pwm通道中断使能控制, 0为关闭PWM中断, 1为使能PWM中断.
226 // pwm_ent2i: pwm通道第二个触发点中断使能控制, 0为关闭PWM第二个触发点中断, 1为使能PWM第二个触发点中断.
227 // pwm_ent1i: pwm通道第一个触发点中断使能控制, 0为关闭PWM第一个触发点中断, 1为使能PWM第一个触发点中断.
228 // 返回: 0:正确, 2:错误.
229 // 版本: V1.0, 2020-09-22
230 //========================================================================
231 u8 PWMChannelCtrl(u8 PWM_id, u8 pwm_eno, u8 pwm_ini, u8 pwm_eni, u8 pwm_ent2i, u8 pwm_ent1i)
232 {
233 1 u8 xdata *pPWMxCR;
234 1
235 1 if(PWM_id > PWM57) return 2; //id错误
236 1 if(pwm_eno > 1) return 2; //输出使能错误
237 1 if(pwm_ini > 1) return 2; //输出端的初始电平错误
238 1 if(pwm_eni > 1) return 2; //中断使能控制错误
239 1 if(pwm_ent2i > 1) return 2; //第二个触发点中断使能控制错误
240 1 if(pwm_ent1i > 1) return 2; //第一个触发点中断使能控制错误
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 5
241 1
242 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */
243 1 pPWMxCR = (u8 *)PWMxCR[PWM_id];
244 1 *pPWMxCR = (pwm_eno << 7) | (pwm_ini << 6) | (pwm_eni << 2)| (pwm_ent2i << 1)| pwm_ent1i;
245 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */
246 1 return 0;
247 1 }
248
249 //========================================================================
250 // 函数: u8 PWMPeriodDuty(u8 PWM_id, u16 Period, u16 dutyL, u16 dutyH)
251 // 描述: PWM周期, 占空比设置.
252 // 参数: PWM_id: PWM通道序号. 取值 0~57
253 // dutyL: pwm输出低电平位置, 取值 0~0x7fff.
254 // dutyH: pwm输出高电平位置, 取值 0~0x7fff.
255 // 返回: 0:正确, 2:错误.
256 // 版本: V1.0, 2020-09-22
257 //========================================================================
258 u8 PWM15Duty(u8 PWM_id,u16 dutyL)
259 {
260 1 u16 xdata *pPWMxT1;
261 1 u16 xdata *pPWMxT2;
262 1
263 1 if(PWM_id > PWM57) return 2; //id错误
264 1 if(dutyL > 0x7fff) return 2; //低电平时间设置错误
265 1 //if(dutyH > 0x7fff) return 2; //高电平时间设置错误
266 1
267 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */
268 1 pPWMxT1 = (u16 *)PWMxT1[PWM_id];
269 1 *pPWMxT1 = dutyL & 0x7fff;
270 1
271 1 pPWMxT2 = (u16 *)PWMxT2[PWM_id];
272 1 *pPWMxT2 = 0x0000 & 0x7fff;
273 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */
274 1 return 0;
275 1 }
276
277 u8 qPWM15Duty(u8 PWM_id,u16 dutyL, u16 dutyH)
278 {
279 1 u16 xdata *pPWMxT1;
280 1 u16 xdata *pPWMxT2;
281 1
282 1 if(PWM_id > PWM57) return 2; //id错误
283 1 if(dutyL > 0x7fff) return 2; //低电平时间设置错误
284 1 if(dutyH > 0x7fff) return 2; //高电平时间设置错误
285 1
286 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */
287 1 pPWMxT1 = (u16 *)PWMxT1[PWM_id];
288 1 *pPWMxT1 = dutyL & 0x7fff;
289 1
290 1 pPWMxT2 = (u16 *)PWMxT2[PWM_id];
291 1 *pPWMxT2 = dutyH & 0x7fff;
292 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */
293 1 return 0;
294 1 }
295 //========================================================================
296 // 函数: u8 PWMOutputSet(u8 PWM_id, u8 pwm_hldl, u8 pwm_hldh)
297 // 描述: PWM通道控制寄存器设置.
298 // 参数: PWM_id: PWM通道序号. 取值 0~57
299 // pwm_hldl: pwm强制输出低电平控制位, 0正常输出, 1强制输出低电平.
300 // pwm_hldh: pwm强制输出高电平控制位, 0正常输出, 1强制输出高电平.
301 // 返回: 0:正确, 2:错误.
302 // 版本: V1.0, 2020-09-22
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 6
303 //========================================================================
304 u8 PWMLevelSet(u8 PWM_id, u8 pwm_hldl, u8 pwm_hldh)
305 {
306 1 u8 xdata *pPWMxHLD;
307 1
308 1 if(PWM_id > PWM57) return 2; //id错误
309 1 if(pwm_hldh > 1) return 2; //输出使能错误
310 1 if(pwm_hldl > 1) return 2; //输出端的初始电平错误
311 1
312 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */
313 1 pPWMxHLD = (u8 *)PWMxHLD[PWM_id];
314 1 *pPWMxHLD = (pwm_hldh << 1) | pwm_hldl;
315 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */
316 1 return 0;
317 1 }
318
319 //========================================================================
320 // 函数: void PWM15_Init(u8 PWM_id, PWM15_InitTypeDef *PWMx)
321 // 描述: 15位增强型PWM初始化程序.
322 // 参数: PWM_id: PWM组号. 取值 PWM0,PWM1,PWM2,PWM3,PWM4,PWM5
323 // PWMx: 结构参数,请参考头文件里的定义.
324 // 返回: none.
325 // 版本: V1.0, 2020-09-22
326 //========================================================================
327 void PWM15_Init(u8 PWM_id, PWM15_InitTypeDef *PWMx)
328 {
329 1 if(PWM_id > PWM5) return; //id错误
330 1
331 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */
332 1 if(PWM_id == PWM0)
333 1 {
334 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM0_Enable(); //使能PWM0
335 2 else PWM15_PWM0_Disable(); //关闭PWM0
336 2 PWM0_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
337 2 PWM0C = PWMx->PWM_Period & 0x7fff;
338 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter0_Enable(); //使能计数器
339 2 else PWM15_Counter0_Disable(); //关闭计数器
340 2 }
341 1
342 1 if(PWM_id == PWM1)
343 1 {
344 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM1_Enable(); //使能PWM1
345 2 else PWM15_PWM1_Disable(); //关闭PWM1
346 2 PWM1_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
347 2 PWM1C = PWMx->PWM_Period & 0x7fff;
348 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter1_Enable(); //使能计数器
349 2 else PWM15_Counter1_Disable(); //关闭计数器
350 2 }
351 1
352 1 if(PWM_id == PWM2)
353 1 {
354 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM2_Enable(); //使能PWM2
355 2 else PWM15_PWM2_Disable(); //关闭PWM2
356 2 PWM2_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
357 2 PWM2C = PWMx->PWM_Period & 0x7fff;
358 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter2_Enable(); //使能计数器
359 2 else PWM15_Counter2_Disable(); //关闭计数器
360 2 }
361 1
362 1 if(PWM_id == PWM3)
363 1 {
364 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM3_Enable(); //使能PWM3
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 7
365 2 else PWM15_PWM3_Disable(); //关闭PWM3
366 2 PWM3_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
367 2 PWM3C = PWMx->PWM_Period & 0x7fff;
368 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter3_Enable(); //使能计数器
369 2 else PWM15_Counter3_Disable(); //关闭计数器
370 2 }
371 1
372 1 if(PWM_id == PWM4)
373 1 {
374 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM4_Enable(); //使能PWM4
375 2 else PWM15_PWM4_Disable(); //关闭PWM4
376 2 PWM4_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
377 2 PWM4C = PWMx->PWM_Period & 0x7fff;
378 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter4_Enable(); //使能计数器
379 2 else PWM15_Counter4_Disable(); //关闭计数器
380 2 }
381 1
382 1 if(PWM_id == PWM5)
383 1 {
384 2 if(PWMx->PWM_Enable == ENABLE) PWM15_PWM5_Enable(); //使能PWM5
385 2 else PWM15_PWM5_Disable(); //关闭PWM5
386 2 PWM5_PS_Set(PWMx->PWM_Clock_PS); //系统时钟分频参数, 0~15
387 2 PWM5C = PWMx->PWM_Period & 0x7fff;
388 2 if(PWMx->PWM_Counter == ENABLE) PWM15_Counter5_Enable(); //使能计数器
389 2 else PWM15_Counter5_Disable(); //关闭计数器
390 2 }
391 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */
392 1 }
393
394
395 //========================================================================
396 // 函数: void PWM0_Handler (void) interrupt PWM0_VECTOR
397 // 描述: PWM0中断处理程序.
398 // 参数: None
399 // 返回: none.
400 // 版本: V1.0, 2020-10-13
401 //========================================================================
402 void PWM0_Handler (void) interrupt PWM0_VECTOR
403 {
404 1 char store;
405 1 store = P_SW2;
406 1 P_SW2 |= 0x80;
407 1
408 1 if(PWMCFG01 & 0x08) //PWM0中断
409 1 {
410 2 PWMCFG01 &= ~0x08; //清PWM0中断标志
411 2 // TODO: 在此处添加用户代码
412 2 }
413 1 if(PWM0IF)
414 1 {
415 2 PWM0IF = 0;
416 2 P27 = ~P27;
417 2 }
418 1 P_SW2 = store;
419 1 }
420 //========================================================================
421 // 函数: void PWM1_Handler (void) interrupt PWM1_VECTOR
422 // 描述: PWM1中断处理程序.
423 // 参数: None
424 // 返回: none.
425 // 版本: V1.0, 2020-10-13
426 //========================================================================
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 8
427 void PWM1_Handler (void) interrupt PWM1_VECTOR
428 {
429 1 char store;
430 1 store = P_SW2;
431 1 P_SW2 |= 0x80;
432 1
433 1 if(PWMCFG01 & 0x80) //PWM1中断
434 1 {
435 2 PWMCFG01 &= ~0x80; //清PWM1中断标志
436 2 // TODO: 在此处添加用户代码
437 2 }
438 1 if(PWM1IF)
439 1 {
440 2 PWM1IF = 0;
441 2 P26 = ~P26;
442 2 }
443 1 P_SW2 = store;
444 1 }
445 //========================================================================
446 // 函数: void PWM2_Handler (void) interrupt PWM2_VECTOR
447 // 描述: PWM2中断处理程序.
448 // 参数: None
449 // 返回: none.
450 // 版本: V1.0, 2020-10-13
451 //========================================================================
452 void PWM2_Handler (void) interrupt PWM2_VECTOR
453 {
454 1 char store;
455 1 store = P_SW2;
456 1 P_SW2 |= 0x80;
457 1
458 1 if(PWMCFG23 & 0x08) //PWM2中断
459 1 {
460 2 PWMCFG23 &= ~0x08; //清PWM2中断标志
461 2 // TODO: 在此处添加用户代码
462 2 }
463 1 if(PWM2IF)
464 1 {
465 2 PWM2IF = 0;
466 2 P25 = ~P25;
467 2 }
468 1 P_SW2 = store;
469 1 }
470 //========================================================================
471 // 函数: void PWM3_Handler (void) interrupt PWM3_VECTOR
472 // 描述: PWM3中断处理程序.
473 // 参数: None
474 // 返回: none.
475 // 版本: V1.0, 2020-10-13
476 //========================================================================
477 void PWM3_Handler (void) interrupt PWM3_VECTOR
478 {
479 1 char store;
480 1 store = P_SW2;
481 1 P_SW2 |= 0x80;
482 1
483 1 if(PWMCFG23 & 0x80) //PWM3中断
484 1 {
485 2 PWMCFG23 &= ~0x80; //清PWM3中断标志
486 2 // TODO: 在此处添加用户代码
487 2 }
488 1 if(PWM3IF)
C51 COMPILER V9.01 PWM15BIT 12/16/2025 16:53:47 PAGE 9
489 1 {
490 2 PWM3IF = 0;
491 2 P24 = ~P24;
492 2 }
493 1 P_SW2 = store;
494 1 }
495 //========================================================================
496 // 函数: void PWM4_Handler (void) interrupt PWM4_VECTOR
497 // 描述: PWM4中断处理程序.
498 // 参数: None
499 // 返回: none.
500 // 版本: V1.0, 2020-10-13
501 //========================================================================
502 void PWM4_Handler (void) interrupt PWM4_VECTOR
503 {
504 1 char store;
505 1 store = P_SW2;
506 1 P_SW2 |= 0x80;
507 1
508 1 if(PWMCFG45 & 0x08) //PWM4中断
509 1 {
510 2 PWMCFG45 &= ~0x08; //清PWM4中断标志
511 2 // TODO: 在此处添加用户代码
512 2 }
513 1 if(PWM4IF)
514 1 {
515 2 PWM4IF = 0;
516 2 P23 = ~P23;
517 2 }
518 1 P_SW2 = store;
519 1 }
520 //========================================================================
521 // 函数: void PWM5_Handler (void) interrupt PWM5_VECTOR
522 // 描述: PWM5中断处理程序.
523 // 参数: None
524 // 返回: none.
525 // 版本: V1.0, 2020-10-13
526 //========================================================================
527 //void PWM5_Handler (void) interrupt PWM5_VECTOR //中断向量号超过31可借助其它中断号跳转方法详见规格书<E6A0BC>
-樯<>
528 //{
529 // if(PWMCFG45 & 0x80) //PWM5中断
530 // {
531 // PWMCFG45 &= ~0x80; //清PWM5中断标志
532 // // TODO: 在此处添加用户代码
533 // }
534 //}
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1058 ----
CONSTANT SIZE = 384 ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- 6
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)