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

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:



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

Command   : -ftimer_user.pcc
In-file   : timer_user.c
PPL-file  : timer_user.ppl
Para-file : -cF054780
            -yC:\NECTools32\DEV\
            -p
            -kfiln
            -zn
            timer_user.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 : **  Filename :  timer_user.c
    8 : **  Abstract :  This file implements a device driver for the timer module
    9 : **  Device :    uPD78F0547
   10 : **  Compiler:   NEC/CC78K0
   11 : **
   12 : *******************************************************************************
   13 : */
   14 : #pragma sfr
   15 : 
   16 : 
   17 : /*
   18 : *******************************************************************************
   19 : **
   20 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
   21 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
   22 : **
   23 : **  Filename :  timer_config.h
   24 : **  Abstract :  This file implements a device driver for the timer module
   25 : **  Device :    uPD78F0547
   26 : **  Compiler:   NEC/CC78K0
   27 : **
   28 : *******************************************************************************
   29 : */
   30 : 
   31 : /*
   32 : *******************************************************************************
   33 : **  Case : Square wave output function
   34 : **
   35 : **  Description : Output squarewave
   36 : **
   37 : **  Setting : fprs = 8MHz
   38 : **  TM00 TM00_Pulse_TI00nAndTI01nFreeRunnin
   39 : **  TM01 TM00_Pulse_TI00nFreeRunning
   40 : **  TM50
   41 : **  TM51
   42 : **  TMH0
   43 : **  TMH1
   44 : **  
   45 : *******************************************************************************
   46 : */



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

   47 : 
   48 : 
   49 : /*
   50 : *******************************************************************************
   51 : **
   52 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
   53 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
   54 : **
   55 : **  Filename :  timer.h
   56 : **  Abstract :  This file implements a device driver for the timer module
   57 : **  Device :    uPD78F0547
   58 : **  Compiler:   NEC/CC78K0
   59 : **
   60 : *******************************************************************************
   61 : */
   62 : 
   63 : 
   64 : #define _TIMERMACRO_
   65 : 
   66 : /*
   67 : *******************************************************************************
   68 : **  Register bit define
   69 : *******************************************************************************
   70 : */
   71 : 
   72 : /* TM0n register bit define */
   73 : 
   74 : /* TM0n register TMC0n */
   75 : #define TM0n_TMC0n_Operation    0x0c
   76 :         #define TM0n_TMC0n_Operation_Disable    0x00
   77 :         #define TM0n_TMC0n_Operation_FreeRunning        0x04
   78 :         #define TM0n_TMC0n_Operation_ClearByTI00nEdge   0x08
   79 :         #define TM0n_TMC0n_Operation_ClearByMatchCR00n  0x0c
   80 : 
   81 : #define TM0n_TMC0n_Reverse      0x02
   82 :         #define TM0n_TMC0n_Reverse_ByMatchCR00n 0x00
   83 :         #define TM0n_TMC0n_Reverse_ByMatchCR00nAndTI00nInput    0x02
   84 : 
   85 : #define TM0n_TMC0n_OverflowFlag 0x01
   86 : 
   87 : /* TM0n register CRC0n */
   88 : #define TM0n_CRC0n_CR01nMode    0x04
   89 :         #define TM0n_CRC0n_CR01nMode_Compare    0x00
   90 :         #define TM0n_CRC0n_CR01nMode_Capture    0x04
   91 : 
   92 : #define TM0n_CRC0n_CR00nTrigger 0x02
   93 :         #define TM0n_CRC0n_CR00nTrigger_TI01nEdge       0x00
   94 :         #define TM0n_CRC0n_CR00nTrigger_TI00nEdgeReverse        0x02
   95 : 
   96 : #define TM0n_CRC0n_CR00nMode    0x01
   97 :         #define TM0n_CRC0n_CR00nMode_Compare    0x00
   98 :         #define TM0n_CRC0n_CR00nMode_Capture    0x01
   99 : 
  100 : /* TM0n register TOC0n */
  101 : #define TM0n_TOC0n_OneshotSoftTrigger   0x40    /* write only */
  102 : 



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

  103 : #define TM0n_TOC0n_OneshotMode  0x20
  104 :         #define TM0n_TOC0n_OneshotMode_Successive       0x00
  105 :         #define TM0n_TOC0n_OneshotMode_Oneshot  0x20
  106 : 
  107 : #define TM0n_TOC0n_ReverseTO0nByCR01n   0x10
  108 :         #define TM0n_TOC0n_ReverseTO0nByCR01n_Disable   0x00
  109 :         #define TM0n_TOC0n_ReverseTO0nByCR01n_Enable    0x10
  110 : 
  111 : #define TM0n_TOC0n_TO0nOutStatus        0x0C
  112 :         #define TM0n_TOC0n_TO0nOut_NoChange     0x00
  113 :         #define TM0n_TOC0n_TO0nOut_Clear0       0x04
  114 :         #define TM0n_TOC0n_TO0nOut_Set1 0x08
  115 :         #define TM0n_TOC0n_TO0nOut_Prohibited   0x0C
  116 : 
  117 : #define TM0n_TOC0n_TO0nReverseByCR00n   0x02
  118 :         #define TM0n_TOC0n_TO0nReverseByCR00n_Disable   0x00
  119 :         #define TM0n_TOC0n_TO0nReverseByCR00n_Enable    0x02
  120 : 
  121 : #define TM0n_TOC0n_TO0nOutControl       0x01
  122 :         #define TM0n_TOC0n_TO0nOut_Disable      0x00
  123 :         #define TM0n_TOC0n_TO0nOut_Enable       0x01
  124 : 
  125 : /* TM0n register PRM0n */
  126 : #define TM0n_PRM0n_TI01nEdge    0xc0
  127 :         #define TM0n_PRM0n_TI01nEdge_Falling    0x00
  128 :         #define TM0n_PRM0n_TI01nEdge_Rising     0x40
  129 :         #define TM0n_PRM0n_TI01nEdge_Prohibited 0x80
  130 :         #define TM0n_PRM0n_TI01nEdge_Both       0xc0
  131 : 
  132 : #define TM0n_PRM0n_TI00nEdge    0x30
  133 :         #define TM0n_PRM0n_TI00nEdge_Falling    0x00
  134 :         #define TM0n_PRM0n_TI00nEdge_Rising     0x10
  135 :         #define TM0n_PRM0n_TI00nEdge_Prohibited 0x20
  136 :         #define TM0n_PRM0n_TI00nEdge_Both       0x30
  137 : 
  138 : #define TM0n_PRM0n_CountClock   0x03
  139 :         #define TM0n_PRM0n_CountClock_Internal0 0x00    /* TM00 = fprs, TM00 = fprs */
  140 :         #define TM0n_PRM0n_CountClock_Internal1 0x01    /* TM00 = fprs/2^2, TM00 = fprs/2^4 */
  141 :         #define TM0n_PRM0n_CountClock_Internal2 0x02    /* TM00 = fprs/2^8, TM00 = fprs/2^6 */
  142 :         #define TM0n_PRM0n_CountClock_TI00nEdge 0x03
  143 : 
  144 : /* TM5n register bit define */
  145 : 
  146 : /* TM5n register TCL5n */
  147 : #define TM5n_TCL5n_CountCloc    0x07
  148 :         #define TM5n_TCL5n_CountClock_TI5nFalling       0x00
  149 :         #define TM5n_TCL5n_CountClock_TI5nRising        0x01
  150 :         #define TM5n_TCL5n_CountClock_Internal0 0x02    /* TM50 = fprs, TM51 = fprs */
  151 :         #define TM5n_TCL5n_CountClock_Internal1 0x03    /* TM50 = fprs/2, TM51 = fprs/2 */
  152 :         #define TM5n_TCL5n_CountClock_Internal2 0x04    /* TM50 = fprs/2^2, TM51 = fprs/2^4 */
  153 :         #define TM5n_TCL5n_CountClock_Internal3 0x05    /* TM50 = fprs/2^6, TM51 = fprs/2^6 */
  154 :         #define TM5n_TCL5n_CountClock_Internal4 0x06    /* TM50 = fprs/2^8, TM51 = fprs/2^8 */
  155 :         #define TM5n_TCL5n_CountClock_Internal5 0x07    /* TM50 = fprs/2^13, TM51 = fprs/2^12 */
  156 : 
  157 : /* TM5n register TMC5n */
  158 : #define TM5n_TMC5n_Operation    0x80



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

  159 :         #define TM5n_TMC5n_Operation_Disable    0x00
  160 :         #define TM5n_TMC5n_Operation_Start      0x80
  161 : 
  162 : #define TM5n_TMC5n_Mode 0x40
  163 :         #define TM5n_TMC5n_Mode_ClearByMatchCR5n        0x00
  164 :         #define TM5n_TMC5n_Mode_PWMFreeRunning  0x40
  165 : 
  166 : #define TM5n_TMC5n_OutPutStatus 0x0C
  167 :         #define TM5n_TMC5n_OutPut_NoChange      0x00
  168 :         #define TM5n_TMC5n_OutPut_Clear0        0x04
  169 :         #define TM5n_TMC5n_OutPut_Set1  0x08
  170 :         #define TM5n_TMC5n_OutPut_Prohibited    0x0C
  171 : 
  172 : #define TM5n_TMC5n_OutPutActiveLevel    0x02
  173 :         #define TM5n_TMC5n_OutPut_NoInversionActiveHigh 0x00
  174 :         #define TM5n_TMC5n_OutPut_InversionActiveLow    0x02
  175 : 
  176 : #define TM5n_TMC5n_OutPutControl        0x01
  177 :         #define TM5n_TMC5n_OutPut_Disable       0x00
  178 :         #define TM5n_TMC5n_OutPut_Enable        0x01
  179 : 
  180 : /* TMHn register bit define */
  181 : 
  182 : /* TMHn register TMHMDn */
  183 : #define TMHn_TMHMDn_Operation   0x80
  184 :         #define TMHn_TMHMDn_Operation_Stop      0x00
  185 :         #define TMHn_TMHMDn_Operation_Enable    0x80
  186 : 
  187 : #define TMHn_TMHMDn_CountClock  0x70
  188 :         #define TMHn_TMHMDn_CountClock_Internal0        0x00    /* TMH0 = fprs, TMH1 = fprs */
  189 :         #define TMHn_TMHMDn_CountClock_Internal1        0x10    /* TMH0 = fprs/2, TMH1 = fprs/2 */
  190 :         #define TMHn_TMHMDn_CountClock_Internal2        0x20    /* TMH0 = fprs/2^2, TMH1 = fprs/2^4 */
  191 :         #define TMHn_TMHMDn_CountClock_Internal3        0x30    /* TMH0 = fprs/2^6, TMH1 = fprs/2^6 */
  192 :         #define TMHn_TMHMDn_CountClock_Internal4        0x40    /* TMH0 = fprs/2^8, TMH1 = fprs/2^8 */
  193 :         #define TMHn_TMHMDn_CountClock_Internal5        0x50    /* TMH0 = fprs/2^13, TMH1 = frl/2^7 */
  194 :         #define TMHn_TMHMDn_CountClock_Internal6        0x60    /* TMH0 = fprs/2^13, TMH1 = frl/2^9 */
  195 :         #define TMHn_TMHMDn_CountClock_Internal7        0x70    /* TMH0 = fprs/2^13, TMH1 = frl */
  196 : 
  197 : #define TMHn_TMHMDn_Mode        0x0c
  198 :         #define TMHn_TMHMDn_Mode_Interval       0x00
  199 :         #define TMHn_TMHMDn_Mode_Carrier        0x04
  200 :         #define TMHn_TMHMDn_Mode_PWM    0x08
  201 : 
  202 : #define TMHn_TMHMDn_Level_Low   0x00
  203 : #define TMHn_TMHMDn_Level_High  0x02
  204 : 
  205 : #define TMHn_TMHMDn_OutPut_Disable      0x00
  206 : #define TMHn_TMHMDn_Output_Enable       0x01
  207 : 
  208 : /* TMHn register TMCYC1(TMH1 only) */
  209 : #define TMHn_TMCYC1_Remote      0x06
  210 :         #define TMHn_TMCYC1_Remote_Low  0x00
  211 :         #define TMHn_TMCYC1_Remote_High 0x02
  212 :         #define TMHn_TMCYC1_Remote_Low2 0x04
  213 :         #define TMHn_TMCYC1_Remote_Carrier      0x06
  214 : 



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

  215 : #define TMHn_TMCYC1_CarrierStatus       0x01
  216 :         #define TMHn_TMCYC1_Carrier_Disable     0x00
  217 :         #define TMHn_TMCYC1_Carrier_Enable      0x01
  218 : 
  219 : 
  220 : 
  221 : 
  222 : #define _TIMERCFG_
  223 : 
  224 : /*
  225 : *******************************************************************************
  226 : **  User control macro define
  227 : *******************************************************************************
  228 : */
  229 : 
  230 : /*
  231 : ***************************************
  232 : **  TM00 configure
  233 : **
  234 : **  Please set operation mode here
  235 : ***************************************
  236 : */
  237 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  238 : #define TM00_NotUse     0
  239 : #define TM00_Interval   0
  240 : #define TM00_ExternalEvent      0
  241 : #define TM00_SquareOut  0
  242 : #define TM00_PPGOut     0

⌨️ 快捷键说明

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