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

📄 timer_user.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 2 页
字号:
  308 :                                                                 TM0n_PRM0n_TI01nEdge_Both
  309 :                                                                 Note : External trigger set only
  310 :                                                         */                                                      TM0n_PRM0n_T
      : I00nEdge_Falling
  311 :         #define TM00_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|                                                   TM0n_CRC0n_C
      : R00nMode_Compare
  312 :         #define TM00_TOC0nValue TM0n_TOC0n_OneshotMode_Oneshot|                                                 TM0n_TOC0n_R
      : everseTO0nByCR01n_Enable|                                                       /* Value selection
  313 :                                                                 TM0n_TOC0n_TO0nOut_NoChange
  314 :                                                                 TM0n_TOC0n_TO0nOut_Clear0
  315 :                                                                 TM0n_TOC0n_TO0nOut_Set1
  316 :                                                         */                                                      TM0n_TOC0n_T
      : O0nOut_Clear0|                                                  TM0n_TOC0n_TO0nReverseByCR00n_Enable|                       
      :                         TM0n_TOC0n_TO0nOut_Enable
  317 :         
  318 :         /* Interrupt settings */
  319 :         #define TM00_INTTM000   0
  320 :         #define TM00_INTTM010   0
  321 : 



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

  322 : 
  323 : /*
  324 : ***************************************
  325 : **  TM01 configure
  326 : **
  327 : **  Please set operation mode here
  328 : ***************************************
  329 : */
  330 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  331 : #define TM01_NotUse     0
  332 : #define TM01_Interval   0
  333 : #define TM01_ExternalEvent      0
  334 : #define TM01_SquareOut  0
  335 : #define TM01_PPGOut     0
  336 : #define TM01_OneshotOut 1
  337 : #define TM01_PulseMeasurement   0
  338 :         /* if no use some method of pulse measurement set method = 1 */ 
  339 :         #define TM01_Pulse_TI00nAndTI01nFreeRunning     0
  340 :         #define TM01_Pulse_TI00nFreeRunning     0
  341 :         #define TM01_Pulse_TI00nRestart 1
  342 :         
  343 : /* macro for setting of different functions */
  344 : 
  345 :         /*
  346 :         ***************************************
  347 :         **  TM01 oneshot output
  348 :         **
  349 :         **  user set delay = 0.02s, width = 0.01s
  350 :         ***************************************
  351 :         */
  352 :         
  353 :         /* Count clock and compare value */
  354 :         /* Use register bit macro
  355 :                 TM0n_PRM0n_CountClock_Internal0 :       fprs    or
  356 :                 TM0n_PRM0n_CountClock_Internal1 :       fprs/2^4        or
  357 :                 TM0n_PRM0n_CountClock_Internal2 :       fprs/2^6        or
  358 :                 TM0n_PRM0n_CountClock_TI00nEdge(Note : software trigger only)
  359 :                         TM0n_PRM0n_TI00nEdge_Falling    or
  360 :                         TM0n_PRM0n_TI01nEdge_Rising     or
  361 :                         TM0n_PRM0n_TI01nEdge_Both
  362 :                 Note :  Please select the higher frequency you can,
  363 :                         so the precision will be higher.
  364 :         */
  365 :         #define TM01_Clock      TM0n_PRM0n_CountClock_Internal1
  366 :         /* 
  367 :                 Value range :   0x0001 - 0xffff
  368 :                 Delay time = (CR01n_value + 1) * count_clock
  369 :                 Pulse width = (CR00n_value - CR01n_value) * count_clock
  370 :                 CR01n_value < CR00n_value
  371 :         */
  372 :         #define TM01_CR00nValue 0x3a97
  373 :         #define TM01_CR01nValue 0x270f
  374 :         
  375 :         /* Register settings */
  376 :         /* Value selection
  377 :                 TM0n_TMC0n_Operation_FreeRunning        :       software trigger



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

  378 :                 TM0n_TMC0n_Operation_ClearByTI00nEdge   :       External trigger
  379 :         */
  380 :         #define TM01_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
  381 :         /* Note :       If use external trigger, use internal count clock only */ 
  382 :         #define TM01_PRM0nValue TM01_Clock|                                                     /* Use register bit macro
  383 :                                                                 TM0n_PRM0n_CountClock_TI00nEdge
  384 :                                                                 TM0n_PRM0n_TI00nEdge_Falling    or
  385 :                                                                 TM0n_PRM0n_TI01nEdge_Rising     or
  386 :                                                                 TM0n_PRM0n_TI01nEdge_Both
  387 :                                                                 Note : External trigger set only
  388 :                                                         */                                                      TM0n_PRM0n_T
      : I00nEdge_Falling
  389 :         #define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Compare|                                                   TM0n_CRC0n_C
      : R00nMode_Compare
  390 :         #define TM01_TOC0nValue TM0n_TOC0n_OneshotMode_Oneshot|                                                 TM0n_TOC0n_R
      : everseTO0nByCR01n_Enable|                                                       /* Value selection
  391 :                                                                 TM0n_TOC0n_TO0nOut_NoChange
  392 :                                                                 TM0n_TOC0n_TO0nOut_Clear0
  393 :                                                                 TM0n_TOC0n_TO0nOut_Set1
  394 :                                                         */                                                      TM0n_TOC0n_T
      : O0nOut_Clear0|                                                  TM0n_TOC0n_TO0nReverseByCR00n_Enable|                       
      :                         TM0n_TOC0n_TO0nOut_Enable
  395 :         
  396 :         /* Interrupt settings */
  397 :         #define TM01_INTTM001   0
  398 :         #define TM01_INTTM011   0
  399 : 
  400 : 
  401 : /*
  402 : ***************************************
  403 : **  TM50 configure
  404 : **
  405 : **  Please set operation mode here
  406 : ***************************************
  407 : */
  408 : /* if no use set nouse = 1, if use some function set function = 1 */
  409 : #define TM50_NotUse     1
  410 : #define TM50_Interval   0
  411 : #define TM50_ExternalEvent      0
  412 : #define TM50_SquareOut  0
  413 : #define TM50_PWMOut     0
  414 : 
  415 : 
  416 :         /* Interrupt settings */
  417 :         #define TM50_INTTM50    0
  418 : 
  419 : 
  420 : /*
  421 : ***************************************
  422 : **  TM51 configure
  423 : **
  424 : **  Please set operation mode here
  425 : ***************************************
  426 : */
  427 : /* if no use set nouse = 1, if use some function set function = 1 */
  428 : #define TM51_NotUse     1



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

  429 : #define TM51_Interval   0
  430 : #define TM51_ExternalEvent      0
  431 : #define TM51_SquareOut  0
  432 : #define TM51_PWMOut     0
  433 : 
  434 : 
  435 :         /* Interrupt settings */
  436 :         #define TM51_INTTM51    0
  437 : 
  438 : 
  439 : /*
  440 : ***************************************
  441 : **  TMH0 configure
  442 : **
  443 : **  Please set operation mode here
  444 : ***************************************
  445 : */
  446 : /* if no use set nouse = 1, if use some function set function = 1 */
  447 : #define TMH0_NotUse     1
  448 : #define TMH0_Interval   0
  449 : #define TMH0_SquareOut  0
  450 : #define TMH0_PWMOut     0
  451 : 
  452 : 
  453 :         /* Interrupt settings */
  454 :         #define TMH0_INTTMH0    0
  455 : 
  456 : 
  457 : /*
  458 : ***************************************
  459 : **  TMH1 configure
  460 : **
  461 : **  Please set operation mode here
  462 : ***************************************
  463 : */
  464 : /* if no use set nouse = 1, if use some function set function = 1 */
  465 : #define TMH1_NotUse     1
  466 : #define TMH1_Interval   0
  467 : #define TMH1_SquareOut  0
  468 : #define TMH1_PWMOut     0
  469 : #define TMH1_CarrierOut 0
  470 : 
  471 : 
  472 :         /* Interrupt settings */
  473 :         #define TMH1_INTTMH1    0
  474 : 
  475 : 
  476 : 
  477 : 
  478 : 
  479 : #define _HDTIMER_
  480 : 
  481 : /*
  482 : *******************************************************************************
  483 : **  Function proto type
  484 : *******************************************************************************



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

  485 : */
  486 : 
  487 : 
  488 : void TM00_Init(void);
  489 : void TM00_Enable(void);
  490 : void TM00_Disable(void);
  491 : 
  492 : 
  493 : 
  494 : void TM01_Init(void);
  495 : void TM01_Enable(void);
  496 : void TM01_Disable(void);
  497 : 
  498 : 
  499 : 
  500 : 
  501 : 
  502 : 
  503 : 
  504 : 
  505 : 
  506 : 
  507 : 
  508 : 
  509 : /*
  510 : *******************************************************************************
  511 : **
  512 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
  513 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
  514 : **
  515 : **  Filename :  timer_config.h
  516 : **  Abstract :  This file implements a device driver for the timer module
  517 : **  Device :    uPD78F0547
  518 : **  Compiler:   NEC/CC78K0
  519 : **
  520 : *******************************************************************************
  521 : */
  522 : 
  523 : /*
  524 : *******************************************************************************
  525 : **  Case : Square wave output function
  526 : **
  527 : **  Description : Output squarewave
  528 : **
  529 : **  Setting : fprs = 8MHz
  530 : **  TM00 delay = 0.01s, width= 0.02s
  531 : **  TM01 delay = 0.02s, width = 0.01s
  532 : **  TM50
  533 : **  TM51
  534 : **  TMH0
  535 : **  TMH1
  536 : **  
  537 : *******************************************************************************
  538 : */
  539 : 
  540 : 



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

  541 : /*
  542 : *******************************************************************************
  543 : **
  544 : **  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
  545 : **  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
  546 : **
  547 : **  Filename :  timer.h
  548 : **  Abstract :  This file implements a device driver for the timer module
  549 : **  Device :    uPD78F0547
  550 : **  Compiler:   NEC/CC78K0
  551 : **
  552 : *******************************************************************************
  553 : */
  554 : 
  555 : 
  556 : 
  557 : 
  558 : 
  559 : 
  560 : 
  561 : 
  562 : 
  563 : 
  564 : 
  565 : 
  566 : 
  567 : 
  568 : 
  569 : 
  570 : 
  571 : 
  572 : 
  573 : 
  574 : 
  575 : 
  576 : 
  577 : /*
  578 : *******************************************************************************
  579 : **  Include files
  580 : *******************************************************************************
  581 : */
  582 : 
  583 : /*
  584 : *******************************************************************************
  585 : **  MacroDefine
  586 : *******************************************************************************
  587 : */
  588 : 
  589 : 
  590 : 
  591 : 
  592 : 
  593 : 
  594 : 
  595 : 
  596 : 



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

  597 : 
  598 : 
  599 : 
  600 : 
  601 : 
  602 : 
  603 : 
  604 : 
  605 : 
  606 : 


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

⌨️ 快捷键说明

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