⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
  485 : **  Please set operation mode here
  486 : ***************************************
  487 : */
  488 : /* if no use set nouse = 1, if use some function set function = 1 */
  489 : #define TMH0_NotUse     0
  490 : #define TMH0_Interval   0
  491 : #define TMH0_SquareOut  1
  492 : #define TMH0_PWMOut     0
  493 : 
  494 : 
  495 :         /*
  496 :         ***************************************
  497 :         **  TMH0 square wave out
  498 :         **
  499 :         **  user set square width = 0.015s
  500 :         ***************************************
  501 :         */
  502 :         
  503 :         /* Count clock and compare value */
  504 :         /* Use register bit macro
  505 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  506 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  507 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^2
  508 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  509 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^10
  510 :                 TMHn_TMHMDn_CountClock_Internal5        :       TM50Output
  511 :                 Note :  Please select the higher frequency you can,
  512 :                         so the precision will be higher.
  513 :         */
  514 :         #define TMH0_Clock      TMHn_TMHMDn_CountClock_Internal4
  515 :         /* 
  516 :                 Value range :   0x00 - 0xfe
  517 :                 Square width = (CMP0n_value + 1) * count_clock
  518 :         */
  519 :         #define TMH0_CMP0nValue 0x74
  520 :         
  521 :         /* Register settings */
  522 :         #define TMH0_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH0_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 /* Value selection
  523 :                                                                         TMHn_TMHMDn_Level_Low
  524 :                                                                         TMHn_TMHMDn_Level_High
  525 :                                                                 */                                                          
      :     TMHn_TMHMDn_Level_Low|                                                              TMHn_TMHMDn_Output_Enable
  526 :         
  527 :         /* Interrupt settings */
  528 :         #define TMH0_INTTMH0    0
  529 : 
  530 : 
  531 : /*
  532 : ***************************************
  533 : **  TMH1 configure
  534 : **
  535 : **  Please set operation mode here
  536 : ***************************************
  537 : */



/*
78K/0 Series C Compiler V3.60 Preprocess List                                                           Date: 9 Oct 2005 Page:  11
*/

  538 : /* if no use set nouse = 1, if use some function set function = 1 */
  539 : #define TMH1_NotUse     0
  540 : #define TMH1_Interval   0
  541 : #define TMH1_SquareOut  1
  542 : #define TMH1_PWMOut     0
  543 : #define TMH1_CarrierOut 0
  544 : 
  545 : 
  546 :         /*
  547 :         ***************************************
  548 :         **  TMH1 square wave out
  549 :         **
  550 :         **  user set square width = 0.02s
  551 :         ***************************************
  552 :         */
  553 :         
  554 :         /* Count clock and compare value */
  555 :         /* Use register bit macro
  556 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  557 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  558 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^4
  559 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  560 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^12
  561 :                 TMHn_TMHMDn_CountClock_Internal5        :       frl/2^7
  562 :                 TMHn_TMHMDn_CountClock_Internal6        :       frl/2^9
  563 :                 TMHn_TMHMDn_CountClock_Internal7        :       frl
  564 :                 Note :  Please select the higher frequency you can,
  565 :                         so the precision will be higher.
  566 :         */
  567 :         #define TMH1_Clock      TMHn_TMHMDn_CountClock_Internal4
  568 :         /* 
  569 :                 Value range :   0x00 - 0xfe
  570 :                 Square width = (CMP0n_value + 1) * count_clock
  571 :         */
  572 :         #define TMH1_CMP0nValue  0x27   /* User set 0.125s */
  573 :         
  574 :         /* Register settings */
  575 :         #define TMH1_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH1_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 /* Value selection
  576 :                                                                         TMHn_TMHMDn_Level_Low
  577 :                                                                         TMHn_TMHMDn_Level_High
  578 :                                                                 */                                                          
      :     TMHn_TMHMDn_Level_Low|                                                              TMHn_TMHMDn_Output_Enable
  579 :         
  580 :         /* Interrupt settings */
  581 :         #define TMH1_INTTMH1    0
  582 : 
  583 : 
  584 : 
  585 : 
  586 : 
  587 : #define _HDTIMER_
  588 : 
  589 : /*
  590 : *******************************************************************************



/*
78K/0 Series C Compiler V3.60 Preprocess List                                                           Date: 9 Oct 2005 Page:  12
*/

  591 : **  Function proto type
  592 : *******************************************************************************
  593 : */
  594 : 
  595 : 
  596 : void TM00_Init(void);
  597 : void TM00_Enable(void);
  598 : void TM00_Disable(void);
  599 : 
  600 : 
  601 : 
  602 : void TM01_Init(void);
  603 : void TM01_Enable(void);
  604 : void TM01_Disable(void);
  605 : 
  606 : 
  607 : 
  608 : void TM50_Init(void);
  609 : void TM50_Enable(void);
  610 : void TM50_Disable(void);
  611 : 
  612 : 
  613 : 
  614 : void TM51_Init(void);
  615 : void TM51_Enable(void);
  616 : void TM51_Disable(void);
  617 : 
  618 : 
  619 : 
  620 : void TMH0_Init(void);
  621 : void TMH0_Enable(void);
  622 : void TMH0_Disable(void);
  623 : 
  624 : 
  625 : 
  626 : void TMH1_Init(void);
  627 : void TMH1_Enable(void);
  628 : void TMH1_Disable(void);
  629 : 
  630 : 
  631 : 
  632 : 
  633 : /*
  634 : *******************************************************************************
  635 : **
  636 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
  637 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
  638 : **
  639 : **  Filename :  timer_config.h
  640 : **  Abstract :  This file implements a device driver for the timer module
  641 : **  Device :    uPD78F0547
  642 : **  Compiler:   NEC/CC78K0
  643 : **
  644 : *******************************************************************************
  645 : */
  646 : 



/*
78K/0 Series C Compiler V3.60 Preprocess List                                                           Date: 9 Oct 2005 Page:  13
*/

  647 : /*
  648 : *******************************************************************************
  649 : **  Case : Square wave output function
  650 : **
  651 : **  Description : Output squarewave
  652 : **
  653 : **  Setting : fprs = 8MHz
  654 : **  TM00 cycle = 0.003s, duty = 30%
  655 : **  TM01 cycle = 0.006s, duty = 60%
  656 : **  TM50 cycle = 0.002048s, duty = 40%
  657 : **  TM51 cycle = 0.002048s, duty = 80%
  658 : **  TMH0 cycle = 0.005s, duty = 25%
  659 : **  TMH1 cycle = 0.01s, duty = 50%
  660 : **  
  661 : *******************************************************************************
  662 : */
  663 : 
  664 : 
  665 : /*
  666 : *******************************************************************************
  667 : **
  668 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
  669 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
  670 : **
  671 : **  Filename :  timer.h
  672 : **  Abstract :  This file implements a device driver for the timer module
  673 : **  Device :    uPD78F0547
  674 : **  Compiler:   NEC/CC78K0
  675 : **
  676 : *******************************************************************************
  677 : */
  678 : 
  679 : 
  680 : 
  681 : 
  682 : 
  683 : 
  684 : 
  685 : 
  686 : 
  687 : 
  688 : 
  689 : 
  690 : 
  691 : 
  692 : 
  693 : 
  694 : 
  695 : 
  696 : 
  697 : 
  698 : 
  699 : 
  700 : 
  701 : /*
  702 : *******************************************************************************



/*
78K/0 Series C Compiler V3.60 Preprocess List                                                           Date: 9 Oct 2005 Page:  14
*/

  703 : **  Include files
  704 : *******************************************************************************
  705 : */
  706 : 
  707 : /*
  708 : *******************************************************************************
  709 : **  MacroDefine
  710 : *******************************************************************************
  711 : */
  712 : 
  713 : 
  714 : 
  715 : 
  716 : 
  717 : 
  718 : 
  719 : 
  720 : 
  721 : 
  722 : 
  723 : 
  724 : 
  725 : 
  726 : 
  727 : 
  728 : 
  729 : 
  730 : 


/*
 Target chip : uPD78F0547_80
 Device file : V2.00 
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -