📄 pwm_515c.lst
字号:
C51 COMPILER V6.10 PWM_515C 04/19/2001 12:02:07 PAGE 1
C51 COMPILER V6.10, COMPILATION OF MODULE PWM_515C
OBJECT MODULE PLACED IN .\PWM_515C.OBJ
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE .\PWM_515C.C OPTIMIZE(6,SPEED) BROWSE DEBUG OBJECTEXTEND
stmt level source
1 /*------------------------------------------------------------------*-
2
3 PWM_515c.c (v1.00)
4
5 ------------------------------------------------------------------
6
7 Rudimentary PWM library for 80c515c.
8
9 Created with help from DaVE.
10
11 Uses T2 / Capture / Compare unit.
12
13
14 COPYRIGHT
15 ---------
16
17 This code is from the book:
18
19 PATTERNS FOR TIME-TRIGGERED EMBEDDED SYSTEMS by Michael J. Pont
20 [Pearson Education, 2001; ISBN: 0-201-33138-1].
21
22 This code is copyright (c) 2001 by Michael J. Pont.
23
24 See book for copyright details and other information.
25
26 -*------------------------------------------------------------------*/
27
28
29 #include "Main.h"
30 #include "PWM_515c.h"
31
32 /*------------------------------------------------------------------*-
33
34 PWM_Init_T2()
35
36 Prepare on-chip PWM unit on the c515c.
37
38 -*------------------------------------------------------------------*/
39 void PWM_Init_T2(void)
40 {
41 1 // ---------- T2 Mode ---------------------------
42 1 // Mode 1 = Timerfunction
43 1
44 1 // Prescaler: Fcpu/6
45 1
46 1 // ---------- T2 reload mode selection ----------
47 1 // Mode 0 = auto-reload upon timer overflow
48 1 // Preset the timer register with autoreload value ! 0x0000;
49 1 TL2 = 0x00;
50 1 TH2 = 0xFF;
51 1
52 1 // ---------- T2 general compare mode ----------
53 1 // Mode 0 for all channels
54 1 T2CON |= 0x11;
55 1
C51 COMPILER V6.10 PWM_515C 04/19/2001 12:02:07 PAGE 2
56 1 // ---------- T2 general interrupts ------------
57 1 // timer 2 overflow interrupt is disabled
58 1 ET2=0;
59 1 // timer 2 external reload interrupt is disabled
60 1 EXEN2=0;
61 1
62 1 // ---------- Compare/capture Channel 0 ---------
63 1 // disabled
64 1 // Set Compare Register CRC on: 0xFF00;
65 1 CRCL = 0x00;
66 1 CRCH = 0xFF;
67 1
68 1 // CC0/ext3 interrupt is disabled
69 1 EX3=0;
70 1
71 1 // ---------- Compare/capture Channel 1 ---------
72 1 // Compare enabled
73 1 // Set Compare Register CC1 on: 0xFF80;
74 1 CCL1 = 0x80;
75 1 CCH1 = 0xFF;
76 1
77 1 // CC1/ext4 interrupt is disabled
78 1 EX4=0;
79 1
80 1 // ---------- Compare/capture Channel 2 ---------
81 1 // disabled
82 1 // Set Compare Register CC2 on: 0x0000;
83 1 CCL2 = 0x00;
84 1 CCH2 = 0x00;
85 1 // CC2/ext5 interrupt is disabled
86 1 EX5=0;
87 1
88 1 // ---------- Compare/capture Channel 3 ---------
89 1 // disabled
90 1 // Set Compare Register CC3 on: 0x0000;
91 1 CCL3 = 0x000;
92 1 CCH3 = 0x000;
93 1
94 1 // CC3/ext6 interrupt is disabled
95 1 EX6=0;
96 1
97 1 // Set all above mentioned modes for channel 0-3
98 1 CCEN = 0x08;
99 1 }
100
101 /*------------------------------------------------------------------*-
102
103 PWM_Update_T2()
104
105 Update the PWM output value (capture/compare Channel 1)
106
107 Output is on Pin 1.1.
108
109 NOTE: Hardware will continue to produce this value (indefinitely),
110 without software intervention, until the next update.
111
112 -*------------------------------------------------------------------*/
113 void PWM_Update_T2(const tByte New_PWM_value)
114 {
115 1 CCL1 = New_PWM_value;
116 1 }
117
C51 COMPILER V6.10 PWM_515C 04/19/2001 12:02:07 PAGE 3
118 /*------------------------------------------------------------------*-
119 ---- END OF FILE -------------------------------------------------
120 -*------------------------------------------------------------------*/
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 47 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -