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

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
  288 : 
  289 : /*
  290 : ***************************************
  291 : **  TM01 configure
  292 : **
  293 : **  Please set operation mode here
  294 : ***************************************
  295 : */
  296 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  297 : #define TM01_NotUse     0
  298 : #define TM01_Interval   1
  299 : #define TM01_ExternalEvent      0
  300 : #define TM01_SquareOut  0
  301 : #define TM01_PPGOut     0
  302 : #define TM01_OneshotOut 0
  303 : #define TM01_PulseMeasurement   0
  304 :         /* if no use some method of pulse measurement set method = 1 */ 
  305 :         #define TM01_Pulse_TI00nAndTI01nFreeRunning     0
  306 :         #define TM01_Pulse_TI00nFreeRunning     1
  307 :         #define TM01_Pulse_TI00nRestart 0
  308 :         
  309 : /* macro for setting of different functions */
  310 : 
  311 :         /*
  312 :         ***************************************
  313 :         **  TM01 interval
  314 :         **
  315 :         **  user set interval time = 0.5s
  316 :         ***************************************
  317 :         */
  318 :                 
  319 :         /* Count clock and compare value */
  320 :         /* Use register bit macro
  321 :                 TM0n_PRM0n_CountClock_Internal0 :       fprs    or
  322 :                 TM0n_PRM0n_CountClock_Internal1 :       fprs/2^4        or
  323 :                 TM0n_PRM0n_CountClock_Internal2 :       fprs/2^6        or
  324 :                 TM0n_PRM0n_CountClock_TI00nEdge
  325 :                         TM0n_PRM0n_TI00nEdge_Falling    or



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

  326 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  327 :                         TM0n_PRM0n_TI01nEdge_Both
  328 :                 Note :  Please select the higher frequency you can,
  329 :                         so the precision will be higher.
  330 :         */
  331 :         #define TM01_Clock      TM0n_PRM0n_CountClock_Internal2
  332 :         /* 
  333 :                 Value range :   0x0001 - 0xffff
  334 :                 Interval time = (CR00n_value + 1) * count_clock
  335 :         */
  336 :         #define TM01_CR00nValue 0xf423
  337 :         #define TM01_CR01nValue 0xffff
  338 :         
  339 :         /* Register settings */
  340 :         #define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
  341 :         #define TM01_PRM0nValue TM01_Clock
  342 :         #define TM01_CRC0nValue TM0n_CRC0n_CR00nMode_Compare
  343 :         
  344 :         /* Interrupt settings */
  345 :         #define TM01_INTTM001   1
  346 :         #define TM01_INTTM011   0
  347 : 
  348 : 
  349 : /*
  350 : ***************************************
  351 : **  TM50 configure
  352 : **
  353 : **  Please set operation mode here
  354 : ***************************************
  355 : */
  356 : /* if no use set nouse = 1, if use some function set function = 1 */
  357 : #define TM50_NotUse     0
  358 : #define TM50_Interval   1
  359 : #define TM50_ExternalEvent      0
  360 : #define TM50_SquareOut  0
  361 : #define TM50_PWMOut     0
  362 : 
  363 : 
  364 :         /*
  365 :         ***************************************
  366 :         **  TM50 interval
  367 :         **
  368 :         **  user set interval time = 0.25s
  369 :         ***************************************
  370 :         */
  371 :                 
  372 :         /* Count clock and compare value */
  373 :         /* Use register bit macro
  374 :                 TM5n_TCL5n_CountClock_TI5nFalling
  375 :                 TM5n_TCL5n_CountClock_TI5nRising
  376 :                 TM5n_TCL5n_CountClock_Internal0 :       fprs
  377 :                 TM5n_TCL5n_CountClock_Internal1 :       fprs/2
  378 :                 TM5n_TCL5n_CountClock_Internal2 :       fprs/2^2
  379 :                 TM5n_TCL5n_CountClock_Internal3 :       fprs/2^6
  380 :                 TM5n_TCL5n_CountClock_Internal4 :       fprs/2^8
  381 :                 TM5n_TCL5n_CountClock_Internal5 :       fprs/2^13



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

  382 :                 Note :  Please select the higher frequency you can,
  383 :                         so the precision will be higher.
  384 :         */
  385 :         #define TM50_Clock      TM5n_TCL5n_CountClock_Internal5
  386 :         /* 
  387 :                 Value range :   0x00 - 0xff
  388 :                 Interval time = (CR5n_value + 1) * count_clock
  389 :         */
  390 :         #define TM50_CR5nValue  0xf3
  391 :         
  392 :         /* Register settings */
  393 :         #define TM50_TCL5nValue TM50_Clock
  394 :         #define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_ClearByMatchCR5n
  395 :         
  396 :         /* Interrupt settings */
  397 :         #define TM50_INTTM50    1
  398 : 
  399 : 
  400 : /*
  401 : ***************************************
  402 : **  TM51 configure
  403 : **
  404 : **  Please set operation mode here
  405 : ***************************************
  406 : */
  407 : /* if no use set nouse = 1, if use some function set function = 1 */
  408 : #define TM51_NotUse     0
  409 : #define TM51_Interval   1
  410 : #define TM51_ExternalEvent      0
  411 : #define TM51_SquareOut  0
  412 : #define TM51_PWMOut     0
  413 : 
  414 : 
  415 :         /*
  416 :         ***************************************
  417 :         **  TM51 interval
  418 :         **
  419 :         **  user set interval time = 0.125s
  420 :         ***************************************
  421 :         */
  422 :         
  423 :         /* Count clock and compare value */
  424 :         /* Use register bit macro
  425 :                 TM5n_TCL5n_CountClock_TI5nFalling
  426 :                 TM5n_TCL5n_CountClock_TI5nRising
  427 :                 TM5n_TCL5n_CountClock_Internal0 :       fprs
  428 :                 TM5n_TCL5n_CountClock_Internal1 :       fprs/2
  429 :                 TM5n_TCL5n_CountClock_Internal2 :       fprs/2^4
  430 :                 TM5n_TCL5n_CountClock_Internal3 :       fprs/2^6
  431 :                 TM5n_TCL5n_CountClock_Internal4 :       fprs/2^8
  432 :                 TM5n_TCL5n_CountClock_Internal5 :       fprs/2^12
  433 :                 Note :  Please select the higher frequency you can,
  434 :                         so the precision will be higher.
  435 :         */
  436 :         #define TM51_Clock      TM5n_TCL5n_CountClock_Internal5



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

  437 :         /* 
  438 :                 Value range :   0x00 - 0xff
  439 :                 Interval time = (CR5n_value + 1) * count_clock
  440 :         */
  441 :         #define TM51_CR5nValue  0xf3
  442 :         
  443 :         /* Register settings */
  444 :         #define TM51_TCL5nValue TM51_Clock
  445 :         #define TM51_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_ClearByMatchCR5n
  446 :         
  447 :         /* Interrupt settings */
  448 :         #define TM51_INTTM51    1
  449 : 
  450 : 
  451 : /*
  452 : ***************************************
  453 : **  TMH0 configure
  454 : **
  455 : **  Please set operation mode here
  456 : ***************************************
  457 : */
  458 : /* if no use set nouse = 1, if use some function set function = 1 */
  459 : #define TMH0_NotUse     0
  460 : #define TMH0_Interval   1
  461 : #define TMH0_SquareOut  0
  462 : #define TMH0_PWMOut     0
  463 : 
  464 : 
  465 :         /*
  466 :         ***************************************
  467 :         **  TMH0 interval
  468 :         **
  469 :         **  user set interval time = 0.03125s
  470 :         ***************************************
  471 :         */
  472 :         
  473 :         /* Count clock and compare value */
  474 :         /* Use register bit macro
  475 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  476 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  477 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^2
  478 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  479 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^10
  480 :                 TMHn_TMHMDn_CountClock_Internal5        :       TM50Output
  481 :                 Note :  Please select the higher frequency you can,
  482 :                         so the precision will be higher.
  483 :         */
  484 :         #define TMH0_Clock      TMHn_TMHMDn_CountClock_Internal4
  485 :         /* 
  486 :                 Value range :   0x00 - 0xfe
  487 :                 Interval time = (CMP0n_value + 1) * count_clock
  488 :         */
  489 :         #define TMH0_CMP0nValue 0xf3
  490 :         
  491 :         /* Register settings */



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

  492 :         #define TMH0_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH0_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 TMHn_TMHMDn_OutPut_Disable
  493 :         
  494 :         /* Interrupt settings */
  495 :         #define TMH0_INTTMH0    1
  496 : 
  497 : 
  498 : /*
  499 : ***************************************
  500 : **  TMH1 configure
  501 : **
  502 : **  Please set operation mode here
  503 : ***************************************
  504 : */
  505 : /* if no use set nouse = 1, if use some function set function = 1 */
  506 : #define TMH1_NotUse     0
  507 : #define TMH1_Interval   1
  508 : #define TMH1_SquareOut  0
  509 : #define TMH1_PWMOut     0
  510 : #define TMH1_CarrierOut 0
  511 : 
  512 : 
  513 :         /*
  514 :         ***************************************
  515 :         **  TMH1 interval
  516 :         **
  517 :         **  user set interval time = 0.125s
  518 :         ***************************************
  519 :         */
  520 :         
  521 :         /* Count clock and compare value */
  522 :         /* Use register bit macro
  523 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  524 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  525 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^4
  526 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  527 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^12
  528 :                 TMHn_TMHMDn_CountClock_Internal5        :       frl/2^7
  529 :                 TMHn_TMHMDn_CountClock_Internal6        :       frl/2^9
  530 :                 TMHn_TMHMDn_CountClock_Internal7        :       frl
  531 :                 Note :  Please select the higher frequency you can,
  532 :                         so the precision will be higher.
  533 :         */
  534 :         #define TMH1_Clock      TMHn_TMHMDn_CountClock_Internal4
  535 :         /* 
  536 :                 Value range :   0x00 - 0xfe
  537 :                 Interval time = (CMP0n_value + 1) * count_clock
  538 :         */
  539 :         #define TMH1_CMP0nValue  0xf3   /* User set 0.125s */
  540 :         
  541 :         /* Register settings */
  542 :         #define TMH1_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH1_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 TMHn_TMHMDn_OutPut_Disable
  543 :         



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

  544 :         /* Interrupt settings */
  545 :         #define TMH1_INTTMH1    1
  546 : 
  547 : 
  548 : 
  549 : 
  550 : #pragma sfr
  551 : 
  552 : 
  553 : 
  554 : #pragma interrupt  INTTM000 HD_INTTM000
  555 : 
  556 : 
  557 : 
  558 : 
  559 : 
  560 : 
  561 : #pragma interrupt  INTTM001 HD_INTTM001
  562 : 
  563 : 
  564 : 
  565 : 
  566 : 
  567 : #pragma interrupt  INTTM50 HD_INTTM50
  568 : 
  569 : 
  570 : 
  571 : #pragma interrupt  INTTM51 HD_INTTM51
  572 : 
  573 : 
  574 : 
  575 : #pragma interrupt  INTTMH0 HD_INTTMH0
  576 : 
  577 : 
  578 : 
  579 : #pragma interrupt  INTTMH1 HD_INTTMH1
  580 : 
  581 : 
  582 : /*
  583 : *******************************************************************************
  584 : **  Include files
  585 : *******************************************************************************
  586 : */

⌨️ 快捷键说明

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