📄 timer_user.ppl
字号:
293 : #define TM50_Interval 0
294 : #define TM50_ExternalEvent 0
295 : #define TM50_SquareOut 0
296 : #define TM50_PWMOut 0
297 :
298 :
299 : /* Interrupt settings */
300 : #define TM50_INTTM50 0
301 :
302 :
303 : /*
304 : ***************************************
305 : ** TM51 configure
306 : **
307 : ** Please set operation mode here
308 : ***************************************
309 : */
310 : /* if no use set nouse = 1, if use some function set function = 1 */
311 : #define TM51_NotUse 0
312 : #define TM51_Interval 1
313 : #define TM51_ExternalEvent 0
314 : #define TM51_SquareOut 0
315 : #define TM51_PWMOut 0
316 :
317 :
318 : /*
319 : ***************************************
320 : ** TM51 interval
321 : **
322 : ** user set interval time = 0.125s
323 : ***************************************
324 : */
/*
78K/0 Series C Compiler V3.70 Preprocess List Date:15 Jul 2007 Page: 7
*/
325 :
326 : /* Count clock and compare value */
327 : /* Use register bit macro
328 : TM5n_TCL5n_CountClock_TI5nFalling
329 : TM5n_TCL5n_CountClock_TI5nRising
330 : TM5n_TCL5n_CountClock_Internal0 : fprs
331 : TM5n_TCL5n_CountClock_Internal1 : fprs/2
332 : TM5n_TCL5n_CountClock_Internal2 : fprs/2^4
333 : TM5n_TCL5n_CountClock_Internal3 : fprs/2^6
334 : TM5n_TCL5n_CountClock_Internal4 : fprs/2^8
335 : TM5n_TCL5n_CountClock_Internal5 : fprs/2^12
336 : Note : Please select the higher frequency you can,
337 : so the precision will be higher.
338 : */
339 : #define TM51_Clock TM5n_TCL5n_CountClock_Internal5
340 : /*
341 : Value range : 0x00 - 0xff
342 : Interval time = (CR5n_value + 1) * count_clock
343 : */
344 : #define TM51_CR5nValue 0xf3
345 :
346 : /* Register settings */
347 : #define TM51_TCL5nValue TM51_Clock
348 : #define TM51_TMC5nValue TM5n_TMC5n_Operation_Start| TM5n_TMC5n_M
: ode_ClearByMatchCR5n
349 :
350 : /* Interrupt settings */
351 : #define TM51_INTTM51 1
352 :
353 :
354 : /*
355 : ***************************************
356 : ** TMH0 configure
357 : **
358 : ** Please set operation mode here
359 : ***************************************
360 : */
361 : /* if no use set nouse = 1, if use some function set function = 1 */
362 : #define TMH0_NotUse 1
363 : #define TMH0_Interval 0
364 : #define TMH0_SquareOut 0
365 : #define TMH0_PWMOut 0
366 :
367 :
368 : /* Interrupt settings */
369 : #define TMH0_INTTMH0 0
370 :
371 :
372 : /*
373 : ***************************************
374 : ** TMH1 configure
375 : **
376 : ** Please set operation mode here
377 : ***************************************
378 : */
379 : /* if no use set nouse = 1, if use some function set function = 1 */
/*
78K/0 Series C Compiler V3.70 Preprocess List Date:15 Jul 2007 Page: 8
*/
380 : #define TMH1_NotUse 0
381 : #define TMH1_Interval 0
382 : #define TMH1_SquareOut 0
383 : #define TMH1_PWMOut 0
384 : #define TMH1_CarrierOut 1
385 :
386 :
387 : /*
388 : ***************************************
389 : ** TMH1 carrier out
390 : **
391 : ** user set cycle = , duty =
392 : ***************************************
393 : */
394 :
395 : /* Count clock and compare value */
396 : /* Use register bit macro
397 : TMHn_TMHMDn_CountClock_Internal0 : fprs
398 : TMHn_TMHMDn_CountClock_Internal1 : fprs/2
399 : TMHn_TMHMDn_CountClock_Internal2 : fprs/2^4
400 : TMHn_TMHMDn_CountClock_Internal3 : fprs/2^6
401 : TMHn_TMHMDn_CountClock_Internal4 : fprs/2^12
402 : TMHn_TMHMDn_CountClock_Internal5 : frl/2^7
403 : TMHn_TMHMDn_CountClock_Internal6 : frl/2^9
404 : TMHn_TMHMDn_CountClock_Internal7 : frl
405 : Note : Please select the higher frequency you can,
406 : so the precision will be higher.
407 : */
408 : #define TMH1_Clock TMHn_TMHMDn_CountClock_Internal3
409 : /*
410 : Value range : 0x00 - 0xff
411 : Carrier cycle = (CMP0n_value + CMP1n_value + 2) * count_clock
412 : Duty = (CMP1n_value + 1) / (CMP0n_value + CMP1n_value + 2)
413 : */
414 : #define TMH1_CMP0nValue 0x63
415 : #define TMH1_CMP1nValue 0x18
416 :
417 : /* Register settings */
418 : #define TMH1_TMHMDnValue TMHn_TMHMDn_Operation_Enable|
: TMH1_Clock| TMHn_TMHMDn_Mode_Carrier|
: /* Value selection
419 : TMHn_TMHMDn_Level_Low
420 : TMHn_TMHMDn_Level_High
421 : */
: TMHn_TMHMDn_Output_Enable
422 : #define TMH1_TMCYC1Value TMHn_TMCYC1_Remote_Carrier|
: TMHn_TMCYC1_Carrier_Enable
423 :
424 : /* Interrupt settings */
425 : #define TMH1_INTTMH1 0
426 :
427 :
428 :
429 :
430 :
431 :
/*
78K/0 Series C Compiler V3.70 Preprocess List Date:15 Jul 2007 Page: 9
*/
432 :
433 :
434 :
435 :
436 :
437 : #pragma interrupt INTTM51 HD_INTTM51
438 :
439 :
440 :
441 :
442 :
443 :
444 : /*
445 : *******************************************************************************
446 : ** Include files
447 : *******************************************************************************
448 : */
449 :
450 :
451 : /*
452 : *******************************************************************************
453 : **
454 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
455 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
456 : **
457 : ** Filename : timer.h
458 : ** Abstract : This file implements a device driver for the timer module
459 : ** Device : uPD78F0547
460 : ** Compiler: NEC/CC78K0
461 : **
462 : *******************************************************************************
463 : */
464 :
465 :
466 : /*
467 : *******************************************************************************
468 : **
469 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
470 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
471 : **
472 : ** Filename : timer_config.h
473 : ** Abstract : This file implements a device driver for the timer module
474 : ** Device : uPD78F0547
475 : ** Compiler: NEC/CC78K0
476 : **
477 : *******************************************************************************
478 : */
479 :
480 : /*
481 : *******************************************************************************
482 : ** Case : Square wave output function
483 : **
484 : ** Description : Output squarewave
485 : **
486 : ** Setting : fprs = 8MHz
487 : ** TM00 cycle = 0.003s, duty = 30%
/*
78K/0 Series C Compiler V3.70 Preprocess List Date:15 Jul 2007 Page: 10
*/
488 : ** TM01 cycle = 0.006s, duty = 60%
489 : ** TM50 cycle = 0.002048s, duty = 40%
490 : ** TM51 cycle = 0.002048s, duty = 80%
491 : ** TM00 cycle = 0.005s, duty = 25%
492 : ** TM01 cycle = 0.01s, duty = 50%
493 : **
494 : *******************************************************************************
495 : */
496 :
497 :
498 : /*
499 : *******************************************************************************
500 : **
501 : ** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
502 : ** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
503 : **
504 : ** Filename : timer.h
505 : ** Abstract : This file implements a device driver for the timer module
506 : ** Device : uPD78F0547
507 : ** Compiler: NEC/CC78K0
508 : **
509 : *******************************************************************************
510 : */
511 :
512 :
513 :
514 :
515 :
516 :
517 : #define _HDTIMER_
518 :
519 : /*
520 : *******************************************************************************
521 : ** Function proto type
522 : *******************************************************************************
523 : */
524 :
525 :
526 :
527 :
528 :
529 :
530 :
531 :
532 : void TM51_Init(void);
533 : void TM51_Enable(void);
534 : void TM51_Disable(void);
535 :
536 :
537 :
538 :
539 :
540 : void TMH1_Init(void);
541 : void TMH1_Enable(void);
542 : void TMH1_Disable(void);
543 :
/*
78K/0 Series C Compiler V3.70 Preprocess List Date:15 Jul 2007 Page: 11
*/
544 :
545 :
546 :
547 : /*
548 : *******************************************************************************
549 : ** MacroDefine
550 : *******************************************************************************
551 : */
552 :
553 :
554 :
555 :
556 :
557 :
558 :
559 :
560 :
561 :
562 :
563 :
564 :
565 :
566 :
567 : /*
568 : **-----------------------------------------------------------------------------
569 : **
570 : ** Abstract:
571 : ** TM51 INTTM51 interrupt service routine
572 : **
573 : ** Parameters:
574 : ** None
575 : **
576 : ** Returns:
577 : ** None
578 : **
579 : **-----------------------------------------------------------------------------
580 : */
581 : __interrupt void HD_INTTM51( )
582 : {
583 : /* TODO */
584 : TMCYC1 = ~TMCYC1;
585 : }
586 :
587 :
588 :
589 :
590 :
591 :
/*
Target chip : uPD78F0547_80
Device file : V2.10
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -