📄 main.lst
字号:
190 1 /// ---------------------------------------------------------------------
191 1
192 1 //// this register must be set in the start-up file
193 1 //// EBCMOD1 = 0x003F
194 1
195 1 /// EBC is enabled
196 1 /// pin #BHE is enabled
197 1 /// #WR and #BHE retain their normal function
198 1 /// pin ALE is enabled
199 1 /// as segment address are 2 pins enabled ( A[17] .. A[16] )
200 1 /// #CS2 .. #CS0 are enabled
201 1 /// pin #READY is enabled
202 1 /// #READY is active low
203 1 /// bus arbitration is disabled, P6.7 .. P6.5 may used for general
204 1 /// purpose IO
205 1
206 1 //// this register must be set in the start-up file
207 1 //// EBCMOD0 = 0x0032
208 1
209 1 /// ---------------------------------------------------------------------
210 1 /// ---------- chip select 0 is enabled ----------
211 1 /// ---------------------------------------------------------------------
212 1 /// - 16-bit Multiplexed Bus
213 1 /// access time is controlled by bitfield PHE0
214 1
215 1 //// this register must be set in the start-up file
216 1 //// FCONCS0 = 0x0031
217 1
218 1 /// Phase A: 3 clock cycles
219 1 /// Phase B: 1 clock cycles
220 1 /// Phase C: 0 clock cycles
221 1 /// Phase D: 0 clock cycles
222 1 /// Phase E: 10 clock cycles
223 1 /// Read Phase F: 0 clock cycles
224 1 /// Write Phase F: 3 clock cycles
225 1
226 1 //// this register must be set in the start-up file
227 1 //// TCONCS0 = 0x6243
228 1
229 1 /// ---------------------------------------------------------------------
230 1 /// ---------- chip select 1 is disabled ----------
231 1 /// ---------------------------------------------------------------------
232 1
233 1
234 1 /// ---------------------------------------------------------------------
235 1 /// ---------- chip select 2 is disabled ----------
236 1 /// ---------------------------------------------------------------------
237 1
238 1
239 1 /// ---------------------------------------------------------------------
240 1 /// ---------- chip select 3 is disabled ----------
241 1 /// ---------------------------------------------------------------------
C166 COMPILER V6.04, MAIN 09/04/2007 08:12:56 PAGE 5
242 1
243 1
244 1 /// ---------------------------------------------------------------------
245 1 /// ---------- chip select 4 is disabled ----------
246 1 /// ---------------------------------------------------------------------
247 1
248 1
249 1 //// -----------------------------------------------------------------------
250 1 //// End of Important Settings for the Start-Up File
251 1 //// -----------------------------------------------------------------------
252 1
253 1
254 1 // -----------------------------------------------------------------------
255 1 // Initialization of the Peripherals:
256 1 // -----------------------------------------------------------------------
257 1
258 1 // USER CODE BEGIN (Init,3)
259 1
260 1 // USER CODE END
261 1
262 1 // globally enable interrupts
263 1 PSW_IEN = 1;
264 1
265 1 } // End of function MAIN_vInit
266
267
268 //****************************************************************************
269 // @Function void MAIN_vUnlockProtecReg(void)
270 //
271 //----------------------------------------------------------------------------
272 // @Description This function makes it possible to write one protected
273 // register. After calling of this function and write on the
274 // protected register is the security level set to low
275 // protected mode.
276 //
277 //----------------------------------------------------------------------------
278 // @Returnvalue None
279 //
280 //----------------------------------------------------------------------------
281 // @Parameters None
282 //
283 //----------------------------------------------------------------------------
284 // @Date 2007-9-3
285 //
286 //****************************************************************************
287
288 // USER CODE BEGIN (UnlockProtecReg,1)
289
290 // USER CODE END
291
292 void MAIN_vUnlockProtecReg(void)
293 {
294 1 uword uwPASSWORD;
295 1
296 1 if((SCUSLS & 0x1800) == 0x0800) // if low protected mode
297 1 {
298 2
299 2 uwPASSWORD = SCUSLS & 0x00FF;
300 2 uwPASSWORD = (~uwPASSWORD) & 0x00FF;
301 2 SCUSLC = 0x8E00 | uwPASSWORD; // command 4
302 2
303 2 } // end if low protected mode
C166 COMPILER V6.04, MAIN 09/04/2007 08:12:56 PAGE 6
304 1
305 1 if((SCUSLS & 0x1800) == 0x1800) // if write protected mode
306 1 {
307 2 SCUSLC = 0xAAAA; // command 0
308 2 SCUSLC = 0x5554; // command 1
309 2
310 2 uwPASSWORD = SCUSLS & 0x00FF;
311 2 uwPASSWORD = (~uwPASSWORD) & 0x00FF;
312 2
313 2 SCUSLC = 0x9600 | uwPASSWORD; // command 2
314 2 SCUSLC = 0x0800; // command 3; new PASSWOR is 0x00
315 2
316 2 uwPASSWORD = SCUSLS & 0x00FF;
317 2 uwPASSWORD = (~uwPASSWORD) & 0x00FF;
318 2 SCUSLC = 0x8E00 | uwPASSWORD; // command 4
319 2
320 2 } // end if write protected mode
321 1
322 1 } // End of function MAIN_vUnlockProtecReg
323
324
325 //****************************************************************************
326 // @Function void main(void)
327 //
328 //----------------------------------------------------------------------------
329 // @Description This is the main function.
330 //
331 //----------------------------------------------------------------------------
332 // @Returnvalue None
333 //
334 //----------------------------------------------------------------------------
335 // @Parameters None
336 //
337 //----------------------------------------------------------------------------
338 // @Date 2007-9-3
339 //
340 //****************************************************************************
341
342 // USER CODE BEGIN (Main,1)
343
344 // USER CODE END
345
346 void main(void)
347 {
348 1 // USER CODE BEGIN (Main,2)
349 1
350 1 // USER CODE END
351 1
352 1 MAIN_vInit();
353 1
354 1 // USER CODE BEGIN (Main,4)
355 1
356 1 // USER CODE END
357 1
358 1 } // End of function main
359
360
361
362 // USER CODE BEGIN (MAIN_General,10)
363
364 // USER CODE END
365
C166 COMPILER V6.04, MAIN 09/04/2007 08:12:56 PAGE 7
MODULE INFORMATION: INITIALIZED UNINITIALIZED
CODE SIZE = 152 --------
NEAR-CONST SIZE = -------- --------
FAR-CONST SIZE = -------- --------
HUGE-CONST SIZE = -------- --------
XHUGE-CONST SIZE = -------- --------
NEAR-DATA SIZE = -------- --------
FAR-DATA SIZE = -------- --------
XHUGE-DATA SIZE = -------- --------
IDATA-DATA SIZE = -------- --------
SDATA-DATA SIZE = -------- --------
BDATA-DATA SIZE = -------- --------
HUGE-DATA SIZE = -------- --------
BIT SIZE = -------- --------
INIT'L SIZE = -------- --------
END OF MODULE INFORMATION.
C166 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -