📄 main.ppl
字号:
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 1
Command : -fmain.pcc
In-file : main.c
PPL-file : main.ppl
Para-file : -cF054780
-yC:\NECTools32\DEV\
-p
-kfiln
-zn
main.c
*/
1 : /*
2 : *******************************************************************************
3 : **
4 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
5 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
6 : **
7 : ** Copyright(C) NEC Electronics Corporation 2002 - 2005
8 : ** All rights reserved by NEC Electronics Corporation.
9 : **
10 : ** This program should be used on your own responsibility.
11 : ** NEC Electronics Corporation assumes no responsibility for any losses
12 : ** incurred by customers or third parties arising from the use of this file.
13 : **
14 : ** Filename : main.c
15 : ** Abstract : This file implements main function
16 : ** APIlib: NEC78K0KX2.lib V1.00 [21 Jul. 2005]
17 : **
18 : ** Device : uPD78F0547
19 : **
20 : ** Compiler: NEC/CC78K0
21 : **
22 : *******************************************************************************
23 : */
24 : #pragma sfr
25 : #pragma ei
26 : /*
27 : *******************************************************************************
28 : ** Include files
29 : *******************************************************************************
30 : */
31 :
32 : /*
33 : *******************************************************************************
34 : **
35 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
36 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
37 : **
38 : ** Filename : timer.h
39 : ** Abstract : This file implements a device driver for the timer module
40 : ** Device : uPD78F0547
41 : ** Compiler: NEC/CC78K0
42 : **
43 : *******************************************************************************
44 : */
45 :
46 :
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 2
*/
47 : /*
48 : *******************************************************************************
49 : **
50 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
51 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
52 : **
53 : ** Filename : timer_config.h
54 : ** Abstract : This file implements a device driver for the timer module
55 : ** Device : uPD78F0547
56 : ** Compiler: NEC/CC78K0
57 : **
58 : *******************************************************************************
59 : */
60 :
61 : /*
62 : *******************************************************************************
63 : ** Case : Square wave output function
64 : **
65 : ** Description : Output squarewave
66 : **
67 : ** Setting : fprs = 8MHz
68 : ** TM00 TM00_Pulse_TI00nAndTI01nFreeRunnin
69 : ** TM01 TM00_Pulse_TI00nFreeRunning
70 : ** TM50
71 : ** TM51
72 : ** TMH0
73 : ** TMH1
74 : **
75 : *******************************************************************************
76 : */
77 :
78 :
79 : /*
80 : *******************************************************************************
81 : **
82 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
83 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
84 : **
85 : ** Filename : timer.h
86 : ** Abstract : This file implements a device driver for the timer module
87 : ** Device : uPD78F0547
88 : ** Compiler: NEC/CC78K0
89 : **
90 : *******************************************************************************
91 : */
92 :
93 :
94 : #define _TIMERMACRO_
95 :
96 : /*
97 : *******************************************************************************
98 : ** Register bit define
99 : *******************************************************************************
100 : */
101 :
102 : /* TM0n register bit define */
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 3
*/
103 :
104 : /* TM0n register TMC0n */
105 : #define TM0n_TMC0n_Operation 0x0c
106 : #define TM0n_TMC0n_Operation_Disable 0x00
107 : #define TM0n_TMC0n_Operation_FreeRunning 0x04
108 : #define TM0n_TMC0n_Operation_ClearByTI00nEdge 0x08
109 : #define TM0n_TMC0n_Operation_ClearByMatchCR00n 0x0c
110 :
111 : #define TM0n_TMC0n_Reverse 0x02
112 : #define TM0n_TMC0n_Reverse_ByMatchCR00n 0x00
113 : #define TM0n_TMC0n_Reverse_ByMatchCR00nAndTI00nInput 0x02
114 :
115 : #define TM0n_TMC0n_OverflowFlag 0x01
116 :
117 : /* TM0n register CRC0n */
118 : #define TM0n_CRC0n_CR01nMode 0x04
119 : #define TM0n_CRC0n_CR01nMode_Compare 0x00
120 : #define TM0n_CRC0n_CR01nMode_Capture 0x04
121 :
122 : #define TM0n_CRC0n_CR00nTrigger 0x02
123 : #define TM0n_CRC0n_CR00nTrigger_TI01nEdge 0x00
124 : #define TM0n_CRC0n_CR00nTrigger_TI00nEdgeReverse 0x02
125 :
126 : #define TM0n_CRC0n_CR00nMode 0x01
127 : #define TM0n_CRC0n_CR00nMode_Compare 0x00
128 : #define TM0n_CRC0n_CR00nMode_Capture 0x01
129 :
130 : /* TM0n register TOC0n */
131 : #define TM0n_TOC0n_OneshotSoftTrigger 0x40 /* write only */
132 :
133 : #define TM0n_TOC0n_OneshotMode 0x20
134 : #define TM0n_TOC0n_OneshotMode_Successive 0x00
135 : #define TM0n_TOC0n_OneshotMode_Oneshot 0x20
136 :
137 : #define TM0n_TOC0n_ReverseTO0nByCR01n 0x10
138 : #define TM0n_TOC0n_ReverseTO0nByCR01n_Disable 0x00
139 : #define TM0n_TOC0n_ReverseTO0nByCR01n_Enable 0x10
140 :
141 : #define TM0n_TOC0n_TO0nOutStatus 0x0C
142 : #define TM0n_TOC0n_TO0nOut_NoChange 0x00
143 : #define TM0n_TOC0n_TO0nOut_Clear0 0x04
144 : #define TM0n_TOC0n_TO0nOut_Set1 0x08
145 : #define TM0n_TOC0n_TO0nOut_Prohibited 0x0C
146 :
147 : #define TM0n_TOC0n_TO0nReverseByCR00n 0x02
148 : #define TM0n_TOC0n_TO0nReverseByCR00n_Disable 0x00
149 : #define TM0n_TOC0n_TO0nReverseByCR00n_Enable 0x02
150 :
151 : #define TM0n_TOC0n_TO0nOutControl 0x01
152 : #define TM0n_TOC0n_TO0nOut_Disable 0x00
153 : #define TM0n_TOC0n_TO0nOut_Enable 0x01
154 :
155 : /* TM0n register PRM0n */
156 : #define TM0n_PRM0n_TI01nEdge 0xc0
157 : #define TM0n_PRM0n_TI01nEdge_Falling 0x00
158 : #define TM0n_PRM0n_TI01nEdge_Rising 0x40
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 4
*/
159 : #define TM0n_PRM0n_TI01nEdge_Prohibited 0x80
160 : #define TM0n_PRM0n_TI01nEdge_Both 0xc0
161 :
162 : #define TM0n_PRM0n_TI00nEdge 0x30
163 : #define TM0n_PRM0n_TI00nEdge_Falling 0x00
164 : #define TM0n_PRM0n_TI00nEdge_Rising 0x10
165 : #define TM0n_PRM0n_TI00nEdge_Prohibited 0x20
166 : #define TM0n_PRM0n_TI00nEdge_Both 0x30
167 :
168 : #define TM0n_PRM0n_CountClock 0x03
169 : #define TM0n_PRM0n_CountClock_Internal0 0x00 /* TM00 = fprs, TM00 = fprs */
170 : #define TM0n_PRM0n_CountClock_Internal1 0x01 /* TM00 = fprs/2^2, TM00 = fprs/2^4 */
171 : #define TM0n_PRM0n_CountClock_Internal2 0x02 /* TM00 = fprs/2^8, TM00 = fprs/2^6 */
172 : #define TM0n_PRM0n_CountClock_TI00nEdge 0x03
173 :
174 : /* TM5n register bit define */
175 :
176 : /* TM5n register TCL5n */
177 : #define TM5n_TCL5n_CountCloc 0x07
178 : #define TM5n_TCL5n_CountClock_TI5nFalling 0x00
179 : #define TM5n_TCL5n_CountClock_TI5nRising 0x01
180 : #define TM5n_TCL5n_CountClock_Internal0 0x02 /* TM50 = fprs, TM51 = fprs */
181 : #define TM5n_TCL5n_CountClock_Internal1 0x03 /* TM50 = fprs/2, TM51 = fprs/2 */
182 : #define TM5n_TCL5n_CountClock_Internal2 0x04 /* TM50 = fprs/2^2, TM51 = fprs/2^4 */
183 : #define TM5n_TCL5n_CountClock_Internal3 0x05 /* TM50 = fprs/2^6, TM51 = fprs/2^6 */
184 : #define TM5n_TCL5n_CountClock_Internal4 0x06 /* TM50 = fprs/2^8, TM51 = fprs/2^8 */
185 : #define TM5n_TCL5n_CountClock_Internal5 0x07 /* TM50 = fprs/2^13, TM51 = fprs/2^12 */
186 :
187 : /* TM5n register TMC5n */
188 : #define TM5n_TMC5n_Operation 0x80
189 : #define TM5n_TMC5n_Operation_Disable 0x00
190 : #define TM5n_TMC5n_Operation_Start 0x80
191 :
192 : #define TM5n_TMC5n_Mode 0x40
193 : #define TM5n_TMC5n_Mode_ClearByMatchCR5n 0x00
194 : #define TM5n_TMC5n_Mode_PWMFreeRunning 0x40
195 :
196 : #define TM5n_TMC5n_OutPutStatus 0x0C
197 : #define TM5n_TMC5n_OutPut_NoChange 0x00
198 : #define TM5n_TMC5n_OutPut_Clear0 0x04
199 : #define TM5n_TMC5n_OutPut_Set1 0x08
200 : #define TM5n_TMC5n_OutPut_Prohibited 0x0C
201 :
202 : #define TM5n_TMC5n_OutPutActiveLevel 0x02
203 : #define TM5n_TMC5n_OutPut_NoInversionActiveHigh 0x00
204 : #define TM5n_TMC5n_OutPut_InversionActiveLow 0x02
205 :
206 : #define TM5n_TMC5n_OutPutControl 0x01
207 : #define TM5n_TMC5n_OutPut_Disable 0x00
208 : #define TM5n_TMC5n_OutPut_Enable 0x01
209 :
210 : /* TMHn register bit define */
211 :
212 : /* TMHn register TMHMDn */
213 : #define TMHn_TMHMDn_Operation 0x80
214 : #define TMHn_TMHMDn_Operation_Stop 0x00
/*
78K/0 Series C Compiler V3.60 Preprocess List Date: 9 Oct 2005 Page: 5
*/
215 : #define TMHn_TMHMDn_Operation_Enable 0x80
216 :
217 : #define TMHn_TMHMDn_CountClock 0x70
218 : #define TMHn_TMHMDn_CountClock_Internal0 0x00 /* TMH0 = fprs, TMH1 = fprs */
219 : #define TMHn_TMHMDn_CountClock_Internal1 0x10 /* TMH0 = fprs/2, TMH1 = fprs/2 */
220 : #define TMHn_TMHMDn_CountClock_Internal2 0x20 /* TMH0 = fprs/2^2, TMH1 = fprs/2^4 */
221 : #define TMHn_TMHMDn_CountClock_Internal3 0x30 /* TMH0 = fprs/2^6, TMH1 = fprs/2^6 */
222 : #define TMHn_TMHMDn_CountClock_Internal4 0x40 /* TMH0 = fprs/2^8, TMH1 = fprs/2^8 */
223 : #define TMHn_TMHMDn_CountClock_Internal5 0x50 /* TMH0 = fprs/2^13, TMH1 = frl/2^7 */
224 : #define TMHn_TMHMDn_CountClock_Internal6 0x60 /* TMH0 = fprs/2^13, TMH1 = frl/2^9 */
225 : #define TMHn_TMHMDn_CountClock_Internal7 0x70 /* TMH0 = fprs/2^13, TMH1 = frl */
226 :
227 : #define TMHn_TMHMDn_Mode 0x0c
228 : #define TMHn_TMHMDn_Mode_Interval 0x00
229 : #define TMHn_TMHMDn_Mode_Carrier 0x04
230 : #define TMHn_TMHMDn_Mode_PWM 0x08
231 :
232 : #define TMHn_TMHMDn_Level_Low 0x00
233 : #define TMHn_TMHMDn_Level_High 0x02
234 :
235 : #define TMHn_TMHMDn_OutPut_Disable 0x00
236 : #define TMHn_TMHMDn_Output_Enable 0x01
237 :
238 : /* TMHn register TMCYC1(TMH1 only) */
239 : #define TMHn_TMCYC1_Remote 0x06
240 : #define TMHn_TMCYC1_Remote_Low 0x00
241 : #define TMHn_TMCYC1_Remote_High 0x02
242 : #define TMHn_TMCYC1_Remote_Low2 0x04
243 : #define TMHn_TMCYC1_Remote_Carrier 0x06
244 :
245 : #define TMHn_TMCYC1_CarrierStatus 0x01
246 : #define TMHn_TMCYC1_Carrier_Disable 0x00
247 : #define TMHn_TMCYC1_Carrier_Enable 0x01
248 :
249 :
250 :
251 :
252 : #define _TIMERCFG_
253 :
254 : /*
255 : *******************************************************************************
256 : ** User control macro define
257 : *******************************************************************************
258 : */
259 :
260 : /*
261 : ***************************************
262 : ** TM00 configure
263 : **
264 : ** Please set operation mode here
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -