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

📄 main.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 2 页
字号:
  265 : ***************************************
  266 : */
  267 : /* if no use set nouse = 1, if use some function set function = 1 */ 
  268 : #define TM00_NotUse     0
  269 : #define TM00_Interval   0
  270 : #define TM00_ExternalEvent      0



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

  271 : #define TM00_SquareOut  0
  272 : #define TM00_PPGOut     0
  273 : #define TM00_OneshotOut 0
  274 : #define TM00_PulseMeasurement   1
  275 :         /* if no use some method of pulse measurement set method = 1 */ 
  276 :         #define TM00_Pulse_TI00nAndTI01nFreeRunning     1
  277 :         #define TM00_Pulse_TI00nFreeRunning     0
  278 :         #define TM00_Pulse_TI00nRestart 0
  279 :         
  280 : /* macro for setting of different functions */
  281 : 
  282 :         /*
  283 :         ***************************************
  284 :         **  TM00 pulse measurement
  285 :         **
  286 :         **  user set mode=
  287 :         ***************************************
  288 :         */
  289 :         
  290 :         /* Count clock */
  291 :         /* Use register bit macro
  292 :                 TM0n_PRM0n_CountClock_Internal0 :       fprs    or
  293 :                 TM0n_PRM0n_CountClock_Internal1 :       fprs/2^2        or
  294 :                 TM0n_PRM0n_CountClock_Internal2 :       fprs/2^8        or
  295 :                 Note :  Please select the higher frequency you can,
  296 :                         so the precision will be higher.
  297 :         */
  298 :         #define TM00_Clock      TM0n_PRM0n_CountClock_Internal0
  299 :         
  300 :         
  301 :                 /* Register settings */
  302 :                 #define TM00_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
  303 :                 #define TM00_PRM0nValue TM0n_PRM0n_TI01nEdge_Both|                                                          
      :     TM0n_PRM0n_TI00nEdge_Both|                                                          TM00_Clock      /* internal count cl
      : ock only */
  304 :                 #define TM00_CRC0nValue TM0n_CRC0n_CR01nMode_Capture|                                                       
      :     TM0n_CRC0n_CR00nMode_Capture
  305 :                 
  306 :                 /* Interrupt settings */
  307 :                 #define TM00_INTTM000   1
  308 :                 #define TM00_INTTM010   1
  309 :         
  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
  323 : #define TM01_SquareOut  0



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

  324 : #define TM01_PPGOut     0
  325 : #define TM01_OneshotOut 0
  326 : #define TM01_PulseMeasurement   1
  327 :         /* if no use some method of pulse measurement set method = 1 */ 
  328 :         #define TM01_Pulse_TI00nAndTI01nFreeRunning     0
  329 :         #define TM01_Pulse_TI00nFreeRunning     1
  330 :         #define TM01_Pulse_TI00nRestart 0
  331 :         
  332 : /* macro for setting of different functions */
  333 : 
  334 :         /*
  335 :         ***************************************
  336 :         **  TM01 pulse measurement
  337 :         **
  338 :         **  user set mode =
  339 :         ***************************************
  340 :         */
  341 :         
  342 :         /* Count clock */
  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 :                 Note :  Please select the higher frequency you can,
  348 :                         so the precision will be higher.
  349 :         */
  350 :         #define TM01_Clock      TM0n_PRM0n_CountClock_Internal0
  351 :         
  352 :         
  353 :                 /* Register settings */
  354 :                 #define TM01_TMC0nValue TM0n_TMC0n_Operation_FreeRunning
  355 :                 #define TM01_PRM0nValue TM0n_PRM0n_TI01nEdge_Rising|                                                        
      :     TM0n_PRM0n_TI00nEdge_Rising|                                                                TM01_Clock      /* internal 
      : count clock only */
  356 :                 #define TM01_CRC0nValue TM0n_CRC0n_CR01nMode_Capture|                                                       
      :     TM0n_CRC0n_CR00nTrigger_TI00nEdgeReverse|                                                           TM0n_CRC0n_CR00nMode
      : _Capture
  357 :                 
  358 :                 /* Interrupt settings */
  359 :                 #define TM01_INTTM001   0
  360 :                 #define TM01_INTTM011   1
  361 :         
  362 : 
  363 : 
  364 : /*
  365 : ***************************************
  366 : **  TM50 configure
  367 : **
  368 : **  Please set operation mode here
  369 : ***************************************
  370 : */
  371 : /* if no use set nouse = 1, if use some function set function = 1 */
  372 : #define TM50_NotUse     1
  373 : #define TM50_Interval   0
  374 : #define TM50_ExternalEvent      0
  375 : #define TM50_SquareOut  0



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

  376 : #define TM50_PWMOut     0
  377 : 
  378 : 
  379 :         /* Interrupt settings */
  380 :         #define TM50_INTTM50    0
  381 : 
  382 : 
  383 : /*
  384 : ***************************************
  385 : **  TM51 configure
  386 : **
  387 : **  Please set operation mode here
  388 : ***************************************
  389 : */
  390 : /* if no use set nouse = 1, if use some function set function = 1 */
  391 : #define TM51_NotUse     1
  392 : #define TM51_Interval   0
  393 : #define TM51_ExternalEvent      0
  394 : #define TM51_SquareOut  0
  395 : #define TM51_PWMOut     0
  396 : 
  397 : 
  398 :         /* Interrupt settings */
  399 :         #define TM51_INTTM51    0
  400 : 
  401 : 
  402 : /*
  403 : ***************************************
  404 : **  TMH0 configure
  405 : **
  406 : **  Please set operation mode here
  407 : ***************************************
  408 : */
  409 : /* if no use set nouse = 1, if use some function set function = 1 */
  410 : #define TMH0_NotUse     1
  411 : #define TMH0_Interval   0
  412 : #define TMH0_SquareOut  0
  413 : #define TMH0_PWMOut     0
  414 : 
  415 : 
  416 :         /* Interrupt settings */
  417 :         #define TMH0_INTTMH0    0
  418 : 
  419 : 
  420 : /*
  421 : ***************************************
  422 : **  TMH1 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 TMH1_NotUse     1
  429 : #define TMH1_Interval   0
  430 : #define TMH1_SquareOut  0
  431 : #define TMH1_PWMOut     0



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

  432 : #define TMH1_CarrierOut 0
  433 : 
  434 : 
  435 :         /* Interrupt settings */
  436 :         #define TMH1_INTTMH1    0
  437 : 
  438 : 
  439 : 
  440 : 
  441 : 
  442 : #define _HDTIMER_
  443 : 
  444 : /*
  445 : *******************************************************************************
  446 : **  Function proto type
  447 : *******************************************************************************
  448 : */
  449 : 
  450 : 
  451 : void TM00_Init(void);
  452 : void TM00_Enable(void);
  453 : void TM00_Disable(void);
  454 : 
  455 : 
  456 : 
  457 : void TM01_Init(void);
  458 : void TM01_Enable(void);
  459 : void TM01_Disable(void);
  460 : 
  461 : 
  462 : 
  463 : 
  464 : 
  465 : 
  466 : 
  467 : 
  468 : 
  469 : 
  470 : 
  471 : /*
  472 : *******************************************************************************
  473 : **  MacroDefine
  474 : *******************************************************************************
  475 : */
  476 : 
  477 : /* the value for IMS and IXS */
  478 : #define  MEMORY_IMS_SET         0xCC
  479 : #define  MEMORY_IXS_SET         0x00
  480 : 
  481 : /*
  482 : **-----------------------------------------------------------------------------
  483 : **
  484 : **  Abstract:
  485 : **      main function
  486 : **
  487 : **  Parameters:



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

  488 : **      None
  489 : **
  490 : **  Returns:
  491 : **      None
  492 : **
  493 : **-----------------------------------------------------------------------------
  494 : */
  495 : void main( void )
  496 : {
  497 :         IMS = MEMORY_IMS_SET;
  498 :         IXS = MEMORY_IXS_SET;
  499 :         /* TODO. add user code */
  500 :         EI();
  501 :         
  502 :         TM00_Init();
  503 :         /* P01 as TI010 */
  504 :         PM0.1 = 1;
  505 :         /* P00 as TI000 */
  506 :         PM0.0 = 1;
  507 :         TM00_Enable();
  508 :         TMMK000 = 0;
  509 :         TMMK010 = 0;
  510 :         
  511 :         TM01_Init();
  512 :         /* P05 as TI000 */
  513 :         PM0.5 = 1;
  514 :         TM01_Enable();
  515 :         TMMK011 = 0;
  516 :         
  517 :         TOC00 |= TM0n_TOC0n_OneshotSoftTrigger;
  518 :         TOC01 |= TM0n_TOC0n_OneshotSoftTrigger;
  519 :         
  520 :         while(1){
  521 :                 ;
  522 :         }
  523 : }


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

⌨️ 快捷键说明

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