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

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
  251 : */
  252 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  253 : #define TM00_NotUse     0
  254 : #define TM00_Interval   0
  255 : #define TM00_ExternalEvent      0
  256 : #define TM00_SquareOut  0
  257 : #define TM00_PPGOut     1
  258 : #define TM00_OneshotOut 0
  259 : #define TM00_PulseMeasurement   0
  260 :         /* if no use some method of pulse measurement set method = 1 */ 
  261 :         #define TM00_Pulse_TI00nAndTI01nFreeRunning     0
  262 :         #define TM00_Pulse_TI00nFreeRunning     0
  263 :         #define TM00_Pulse_TI00nRestart 1
  264 :         
  265 : /* macro for setting of different functions */
  266 : 
  267 :         /*
  268 :         ***************************************
  269 :         **  TM00 PPG output
  270 :         **



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

  271 :         **  user set cycle = 0.003s, duty = 30%
  272 :         ***************************************
  273 :         */
  274 :         
  275 :         /* Count clock and compare value */
  276 :         /* Use register bit macro
  277 :                 TM0n_PRM0n_CountClock_Internal0 :       fprs    or
  278 :                 TM0n_PRM0n_CountClock_Internal1 :       fprs/2^2        or
  279 :                 TM0n_PRM0n_CountClock_Internal2 :       fprs/2^8        or
  280 :                 TM0n_PRM0n_CountClock_TI00nEdge
  281 :                         TM0n_PRM0n_TI00nEdge_Falling    or
  282 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  283 :                         TM0n_PRM0n_TI01nEdge_Both
  284 :                 Note :  Please select the higher frequency you can,
  285 :                         so the precision will be higher.
  286 :         */
  287 :         #define TM00_Clock      TM0n_PRM0n_CountClock_Internal0
  288 :         /* 
  289 :                 Value range :   0x0001 - 0xffff
  290 :                 Pulse cycle = (CR00n_value + 1) * count_clock
  291 :                 Duty = (CR01n_value + 1) / (CR00n_value + 1)
  292 :                 CR01n_value < CR00n_value
  293 :         */
  294 :         #define TM00_CR00nValue 0x5dbf
  295 :         #define TM00_CR01nValue 0x1c1f
  296 :         
  297 :         /* Register settings */
  298 :         #define TM00_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
  299 :         #define TM00_PRM0nValue TM00_Clock
  300 :         #define TM00_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|                                                   TM0n_CRC0n_C
      : R00nMode_Compare
  301 :         #define TM00_TOC0nValue TM0n_TOC0n_OneshotMode_Successive|                                                      TM0n
      : _TOC0n_ReverseTO0nByCR01n_Enable|                                                       /* Value selection
  302 :                                                                 TM0n_TOC0n_TO0nOut_NoChange
  303 :                                                                 TM0n_TOC0n_TO0nOut_Clear0
  304 :                                                                 TM0n_TOC0n_TO0nOut_Set1
  305 :                                                         */                                                      TM0n_TOC0n_T
      : O0nOut_Clear0|                                                  TM0n_TOC0n_TO0nReverseByCR00n_Enable|                       
      :                         TM0n_TOC0n_TO0nOut_Enable
  306 :         
  307 :         /* Interrupt settings */
  308 :         #define TM00_INTTM000   0
  309 :         #define TM00_INTTM010   0
  310 : 
  311 : 
  312 : /*
  313 : ***************************************
  314 : **  TM01 configure
  315 : **
  316 : **  Please set operation mode here
  317 : ***************************************
  318 : */
  319 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  320 : #define TM01_NotUse     0
  321 : #define TM01_Interval   0
  322 : #define TM01_ExternalEvent      0



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

  323 : #define TM01_SquareOut  0
  324 : #define TM01_PPGOut     1
  325 : #define TM01_OneshotOut 0
  326 : #define TM01_PulseMeasurement   0
  327 :         /* if no use some method of pulse measurement set method = 1 */ 
  328 :         #define TM01_Pulse_TI00nAndTI01nFreeRunning     0
  329 :         #define TM01_Pulse_TI00nFreeRunning     0
  330 :         #define TM01_Pulse_TI00nRestart 1
  331 :         
  332 : /* macro for setting of different functions */
  333 : 
  334 :         /*
  335 :         ***************************************
  336 :         **  TM01 PPG output
  337 :         **
  338 :         **  user set cycle = 0.006s, duty = 60%
  339 :         ***************************************
  340 :         */
  341 :         
  342 :         /* Count clock and compare value */
  343 :         /* Use register bit macro
  344 :                 TM0n_PRM0n_CountClock_Internal0 :       fprs    or
  345 :                 TM0n_PRM0n_CountClock_Internal1 :       fprs/2^4        or
  346 :                 TM0n_PRM0n_CountClock_Internal2 :       fprs/2^6        or
  347 :                 TM0n_PRM0n_CountClock_TI00nEdge
  348 :                         TM0n_PRM0n_TI00nEdge_Falling    or
  349 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  350 :                         TM0n_PRM0n_TI01nEdge_Both
  351 :                 Note :  Please select the higher frequency you can,
  352 :                         so the precision will be higher.
  353 :         */
  354 :         #define TM01_Clock      TM0n_PRM0n_CountClock_Internal0
  355 :         /* 
  356 :                 Value range :   0x0001 - 0xffff
  357 :                 Pulse cycle = (CR00n_value + 1) * count_clock
  358 :                 Duty = (CR01n_value + 1) / (CR00n_value + 1)
  359 :                 CR01n_value < CR00n_value
  360 :         */
  361 :         #define TM01_CR00nValue 0xbb7f
  362 :         #define TM01_CR01nValue 0x707f
  363 :         
  364 :         /* Register settings */
  365 :         #define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
  366 :         #define TM01_PRM0nValue TM01_Clock
  367 :         #define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|                                                   TM0n_CRC0n_C
      : R00nMode_Compare
  368 :         #define TM01_TOC0nValue TM0n_TOC0n_OneshotMode_Successive|                                                      TM0n
      : _TOC0n_ReverseTO0nByCR01n_Enable|                                                       /* Value selection
  369 :                                                                 TM0n_TOC0n_TO0nOut_NoChange
  370 :                                                                 TM0n_TOC0n_TO0nOut_Clear0
  371 :                                                                 TM0n_TOC0n_TO0nOut_Set1
  372 :                                                         */                                                      TM0n_TOC0n_T
      : O0nOut_Clear0|                                                  TM0n_TOC0n_TO0nReverseByCR00n_Enable|                       
      :                         TM0n_TOC0n_TO0nOut_Enable
  373 :         
  374 :         /* Interrupt settings */



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

  375 :         #define TM01_INTTM001   0
  376 :         #define TM01_INTTM011   0
  377 : 
  378 : 
  379 : /*
  380 : ***************************************
  381 : **  TM50 configure
  382 : **
  383 : **  Please set operation mode here
  384 : ***************************************
  385 : */
  386 : /* if no use set nouse = 1, if use some function set function = 1 */
  387 : #define TM50_NotUse     0
  388 : #define TM50_Interval   0
  389 : #define TM50_ExternalEvent      0
  390 : #define TM50_SquareOut  0
  391 : #define TM50_PWMOut     1
  392 : 
  393 : 
  394 :         /*
  395 :         ***************************************
  396 :         **  TM50 PWM output
  397 :         **
  398 :         **  user set cycle = 0.002048s, duty = 40%
  399 :         ***************************************
  400 :         */
  401 :         
  402 :         /* Count clock and compare value */
  403 :         /* Use register bit macro
  404 :                 TM5n_TCL5n_CountClock_Internal0 :       fprs
  405 :                 TM5n_TCL5n_CountClock_Internal1 :       fprs/2
  406 :                 TM5n_TCL5n_CountClock_Internal2 :       fprs/2^2
  407 :                 TM5n_TCL5n_CountClock_Internal3 :       fprs/2^6
  408 :                 TM5n_TCL5n_CountClock_Internal4 :       fprs/2^8
  409 :                 TM5n_TCL5n_CountClock_Internal5 :       fprs/2^13
  410 :                 Note :  Please select the higher frequency you can,
  411 :                         so the precision will be higher.
  412 :         */
  413 :         #define TM50_Clock      TM5n_TCL5n_CountClock_Internal3
  414 :         /* 
  415 :                 Value range :   0x00 - 0xff
  416 :                 Pulse cycle = 256 * count_clock
  417 :                 Duty = CR5n_value / 256
  418 :         */
  419 :         #define TM50_CR5nValue 0x66
  420 :         
  421 :         /* Register settings */
  422 :         #define TM50_TCL5nValue TM50_Clock      /* internal count clock only*/
  423 :         #define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_PWMFreeRunning|                                                     /* Value selection
  424 :                                                                 TM5n_TMC5n_OutPut_NoChange
  425 :                                                                 TM5n_TMC5n_OutPut_Clear0
  426 :                                                                 TM5n_TMC5n_OutPut_Set1
  427 :                                                         */                                                      TM5n_TMC5n_O
      : utPut_Clear0|                                                   /* Value selection
  428 :                                                                 TM5n_TMC5n_OutPut_NoInversionActiveHigh



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

  429 :                                                                 TM5n_TMC5n_OutPut_InversionActiveLow
  430 :                                                         */                                                      TM5n_TMC5n_O
      : utPut_InversionActiveLow|                                                       TM5n_TMC5n_OutPut_Enable
  431 : 
  432 :         /* Interrupt settings */
  433 :         #define TM50_INTTM50    0
  434 : 
  435 : 
  436 : /*
  437 : ***************************************
  438 : **  TM51 configure
  439 : **
  440 : **  Please set operation mode here
  441 : ***************************************
  442 : */
  443 : /* if no use set nouse = 1, if use some function set function = 1 */
  444 : #define TM51_NotUse     0
  445 : #define TM51_Interval   0
  446 : #define TM51_ExternalEvent      0
  447 : #define TM51_SquareOut  0
  448 : #define TM51_PWMOut     1
  449 : 
  450 : 
  451 :         /*
  452 :         ***************************************
  453 :         **  TM51 PWM output
  454 :         **
  455 :         **  user set cycle = 0.002048s, duty = 80%
  456 :         ***************************************
  457 :         */
  458 :         
  459 :         /* Count clock and compare value */
  460 :         /* Use register bit macro
  461 :                 TM5n_TCL5n_CountClock_Internal0 :       fprs
  462 :                 TM5n_TCL5n_CountClock_Internal1 :       fprs/2
  463 :                 TM5n_TCL5n_CountClock_Internal2 :       fprs/2^4
  464 :                 TM5n_TCL5n_CountClock_Internal3 :       fprs/2^6
  465 :                 TM5n_TCL5n_CountClock_Internal4 :       fprs/2^8
  466 :                 TM5n_TCL5n_CountClock_Internal5 :       fprs/2^12
  467 :                 Note :  Please select the higher frequency you can,
  468 :                         so the precision will be higher.
  469 :         */
  470 :         #define TM51_Clock      TM5n_TCL5n_CountClock_Internal3
  471 :         /* 
  472 :                 Value range :   0x00 - 0xff
  473 :                 Pulse cycle = 256 * count_clock
  474 :                 Duty = CR01n_value / 256
  475 :         */
  476 :         #define TM51_CR5nValue  0xcc
  477 :         
  478 :         /* Register settings */
  479 :         #define TM51_TCL5nValue TM51_Clock      /* internal count clock only*/
  480 :         #define TM51_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_PWMFreeRunning|                                                     /* Value selection
  481 :                                                                 TM5n_TMC5n_OutPut_NoChange
  482 :                                                                 TM5n_TMC5n_OutPut_Clear0



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

  483 :                                                                 TM5n_TMC5n_OutPut_Set1
  484 :                                                         */                                                      TM5n_TMC5n_O
      : utPut_Clear0|                                                   /* Value selection
  485 :                                                                 TM5n_TMC5n_OutPut_NoInversionActiveHigh
  486 :                                                                 TM5n_TMC5n_OutPut_InversionActiveLow
  487 :                                                         */                                                      TM5n_TMC5n_O
      : utPut_InversionActiveLow|                                                       TM5n_TMC5n_OutPut_Enable
  488 :                                                         
  489 :         /* Interrupt settings */
  490 :         #define TM51_INTTM51    0
  491 : 
  492 : 
  493 : /*
  494 : ***************************************
  495 : **  TMH0 configure
  496 : **

⌨️ 快捷键说明

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