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

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
  247 :         #define TM00_Pulse_TI00nFreeRunning     0
  248 :         #define TM00_Pulse_TI00nRestart 0
  249 :         
  250 : /* macro for setting of different functions */
  251 : 
  252 :         /*
  253 :         ***************************************
  254 :         **  TM00 external event
  255 :         **
  256 :         **  user set valid edges = 10
  257 :         ***************************************
  258 :         */
  259 :         
  260 :         /* Count clock and compare value */
  261 :         /* Use register bit macro
  262 :                 TM0n_PRM0n_CountClock_TI00nEdge
  263 :                         TM0n_PRM0n_TI00nEdge_Falling    or
  264 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  265 :                         TM0n_PRM0n_TI01nEdge_Both
  266 :         */
  267 :         #define TM00_Clock      TM0n_PRM0n_CountClock_TI00nEdge|                TM0n_PRM0n_TI00nEdge_Falling
  268 :         /* 
  269 :                 Value range :   0x0001 - 0xffff



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

  270 :                 Valid edges = CR00n_value + 2 : first time after start
  271 :                                           CR00n_value + 1 :     second time or later
  272 :                 Note :  Valid edge interspace must > 2 * count_clock.
  273 :         */
  274 :         #define TM00_CR00nValue 0x9
  275 :         #define TM00_CR01nValue 0xffff
  276 :         
  277 :         /* Register settings */
  278 :         #define TM00_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
  279 :         /* external count clock only*/
  280 :         #define TM00_PRM0nValue TM00_Clock
  281 :         #define TM00_CRC0nValue TM0n_CRC0n_CR00nMode_Compare
  282 :         
  283 :         /* Interrupt settings */
  284 :         #define TM00_INTTM000   1
  285 :         #define TM00_INTTM010   0
  286 : 
  287 : 
  288 : /*
  289 : ***************************************
  290 : **  TM01 configure
  291 : **
  292 : **  Please set operation mode here
  293 : ***************************************
  294 : */
  295 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  296 : #define TM01_NotUse     0
  297 : #define TM01_Interval   0
  298 : #define TM01_ExternalEvent      1
  299 : #define TM01_SquareOut  0
  300 : #define TM01_PPGOut     0
  301 : #define TM01_OneshotOut 0
  302 : #define TM01_PulseMeasurement   0
  303 :         /* if no use some method of pulse measurement set method = 1 */ 
  304 :         #define TM01_Pulse_TI00nAndTI01nFreeRunning     0
  305 :         #define TM01_Pulse_TI00nFreeRunning     1
  306 :         #define TM01_Pulse_TI00nRestart 0
  307 :         
  308 : /* macro for setting of different functions */
  309 : 
  310 :         /*
  311 :         ***************************************
  312 :         **  TM01 external event
  313 :         **
  314 :         **  user set valid edges = 10
  315 :         ***************************************
  316 :         */
  317 :         
  318 :         /* Count clock and compare value */
  319 :         /* Use register bit macro
  320 :                 TM0n_PRM0n_CountClock_TI00nEdge
  321 :                         TM0n_PRM0n_TI00nEdge_Falling    or
  322 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  323 :                         TM0n_PRM0n_TI01nEdge_Both
  324 :         */
  325 :         #define TM01_Clock      TM0n_PRM0n_CountClock_TI00nEdge|                TM0n_PRM0n_TI00nEdge_Falling



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

  326 :         /* 
  327 :                 Value range :   0x0001 - 0xffff
  328 :                 Valid edges = CR00n_value + 2 : first time after start
  329 :                                           CR00n_value + 1 :     second time or later
  330 :                 Note :  Valid edge interspace must > 2 * count_clock.
  331 :         */
  332 :         #define TM01_CR00nValue 0x9
  333 :         #define TM01_CR01nValue 0xffff
  334 :         
  335 :         /* Register settings */
  336 :         #define TM01_TMC0nValue TM0n_TMC0n_Operation_ClearByMatchCR00n
  337 :         /* external count clock only*/
  338 :         #define TM01_PRM0nValue TM01_Clock
  339 :         #define TM01_CRC0nValue TM0n_CRC0n_CR00nMode_Compare
  340 :         
  341 :         /* Interrupt settings */
  342 :         #define TM01_INTTM001   1
  343 :         #define TM01_INTTM011   0
  344 : 
  345 : 
  346 : /*
  347 : ***************************************
  348 : **  TM50 configure
  349 : **
  350 : **  Please set operation mode here
  351 : ***************************************
  352 : */
  353 : /* if no use set nouse = 1, if use some function set function = 1 */
  354 : #define TM50_NotUse     0
  355 : #define TM50_Interval   0
  356 : #define TM50_ExternalEvent      1
  357 : #define TM50_SquareOut  0
  358 : #define TM50_PWMOut     0
  359 : 
  360 : 
  361 :         /*
  362 :         ***************************************
  363 :         **  TM50 external event
  364 :         **
  365 :         **  user set valid edges = 10
  366 :         ***************************************
  367 :         */
  368 :         
  369 :         /* Count clock and compare value */
  370 :         /* Use register bit macro
  371 :                 TM5n_TCL5n_CountClock_TI5nFalling
  372 :                 TM5n_TCL5n_CountClock_TI5nRising
  373 :                 Note :  Please select the higher frequency you can,
  374 :                         so the precision will be higher.
  375 :         */
  376 :         #define TM50_Clock      TM5n_TCL5n_CountClock_TI5nFalling
  377 :         /* 
  378 :                 Value range :   0x00 - 0xff
  379 :                 Valid edges = CR5n_value + 1
  380 :         */
  381 :         #define TM50_CR5nValue  0x09



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

  382 :         
  383 :         /* Register settings */
  384 :         #define TM50_TCL5nValue TM50_Clock      /* external count clock only*/
  385 :         #define TM50_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_ClearByMatchCR5n
  386 :         
  387 :         /* Interrupt settings */
  388 :         #define TM50_INTTM50    1
  389 : 
  390 : 
  391 : /*
  392 : ***************************************
  393 : **  TM51 configure
  394 : **
  395 : **  Please set operation mode here
  396 : ***************************************
  397 : */
  398 : /* if no use set nouse = 1, if use some function set function = 1 */
  399 : #define TM51_NotUse     0
  400 : #define TM51_Interval   0
  401 : #define TM51_ExternalEvent      1
  402 : #define TM51_SquareOut  0
  403 : #define TM51_PWMOut     0
  404 : 
  405 : 
  406 :         /*
  407 :         ***************************************
  408 :         **  TM51 external event
  409 :         **
  410 :         **  user set valid edges = 10
  411 :         ***************************************
  412 :         */
  413 :         
  414 :         /* Count clock and compare value */
  415 :         /* Use register bit macro
  416 :                 TM5n_TCL5n_CountClock_TI5nFalling
  417 :                 TM5n_TCL5n_CountClock_TI5nRising
  418 :                 Note :  Please select the higher frequency you can,
  419 :                         so the precision will be higher.
  420 :         */
  421 :         #define TM51_Clock      TM5n_TCL5n_CountClock_TI5nFalling
  422 :         /* 
  423 :                 Value range :   0x00 - 0xff
  424 :                 Valid edges = CR5n_value + 1
  425 :         */
  426 :         #define TM51_CR5nValue  0x09
  427 :         
  428 :         /* Register settings */
  429 :         #define TM51_TCL5nValue TM51_Clock      /* external count clock only*/
  430 :         #define TM51_TMC5nValue TM5n_TMC5n_Operation_Start|                                                     TM5n_TMC5n_M
      : ode_ClearByMatchCR5n
  431 :         
  432 :         /* Interrupt settings */
  433 :         #define TM51_INTTM51    1
  434 : 
  435 : 



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

  436 : /*
  437 : ***************************************
  438 : **  TMH0 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 TMH0_NotUse     1
  445 : #define TMH0_Interval   0
  446 : #define TMH0_SquareOut  0
  447 : #define TMH0_PWMOut     0
  448 : 
  449 : 
  450 :         /* Interrupt settings */
  451 :         #define TMH0_INTTMH0    0
  452 : 
  453 : 
  454 : /*
  455 : ***************************************
  456 : **  TMH1 configure
  457 : **
  458 : **  Please set operation mode here
  459 : ***************************************
  460 : */
  461 : /* if no use set nouse = 1, if use some function set function = 1 */
  462 : #define TMH1_NotUse     0
  463 : #define TMH1_Interval   0
  464 : #define TMH1_SquareOut  1
  465 : #define TMH1_PWMOut     0
  466 : #define TMH1_CarrierOut 0
  467 : 
  468 : 
  469 :         /*
  470 :         ***************************************
  471 :         **  TMH1 square wave out
  472 :         **
  473 :         **  user set square width = 0.02s
  474 :         ***************************************
  475 :         */
  476 :         
  477 :         /* Count clock and compare value */
  478 :         /* Use register bit macro
  479 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  480 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  481 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^4
  482 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  483 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^12
  484 :                 TMHn_TMHMDn_CountClock_Internal5        :       frl/2^7
  485 :                 TMHn_TMHMDn_CountClock_Internal6        :       frl/2^9
  486 :                 TMHn_TMHMDn_CountClock_Internal7        :       frl
  487 :                 Note :  Please select the higher frequency you can,
  488 :                         so the precision will be higher.
  489 :         */
  490 :         #define TMH1_Clock      TMHn_TMHMDn_CountClock_Internal4
  491 :         /* 



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

  492 :                 Value range :   0x00 - 0xfe
  493 :                 Square width = (CMP0n_value + 1) * count_clock
  494 :         */
  495 :         #define TMH1_CMP0nValue  0x27   /* User set 0.125s */
  496 :         
  497 :         /* Register settings */
  498 :         #define TMH1_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH1_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 /* Value selection
  499 :                                                                         TMHn_TMHMDn_Level_Low

⌨️ 快捷键说明

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