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

📄 main.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
      : ode_ClearByMatchCR5n|                                                   /* Value selection



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

  487 :                                                                 TM5n_TMC5n_OutPut_NoChange
  488 :                                                                 TM5n_TMC5n_OutPut_Clear0
  489 :                                                                 TM5n_TMC5n_OutPut_Set1
  490 :                                                         */                                                      TM5n_TMC5n_O
      : utPut_Clear0|                                                   TM5n_TMC5n_OutPut_InversionActiveLow|                       
      :                         TM5n_TMC5n_OutPut_Enable
  491 :                                                         
  492 :         /* Interrupt settings */
  493 :         #define TM51_INTTM51    0
  494 : 
  495 : 
  496 : /*
  497 : ***************************************
  498 : **  TMH0 configure
  499 : **
  500 : **  Please set operation mode here
  501 : ***************************************
  502 : */
  503 : /* if no use set nouse = 1, if use some function set function = 1 */
  504 : #define TMH0_NotUse     0
  505 : #define TMH0_Interval   0
  506 : #define TMH0_SquareOut  1
  507 : #define TMH0_PWMOut     0
  508 : 
  509 : 
  510 :         /*
  511 :         ***************************************
  512 :         **  TMH0 square wave out
  513 :         **
  514 :         **  user set square width = 0.015s
  515 :         ***************************************
  516 :         */
  517 :         
  518 :         /* Count clock and compare value */
  519 :         /* Use register bit macro
  520 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  521 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  522 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^2
  523 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  524 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^10
  525 :                 TMHn_TMHMDn_CountClock_Internal5        :       TM50Output
  526 :                 Note :  Please select the higher frequency you can,
  527 :                         so the precision will be higher.
  528 :         */
  529 :         #define TMH0_Clock      TMHn_TMHMDn_CountClock_Internal4
  530 :         /* 
  531 :                 Value range :   0x00 - 0xfe
  532 :                 Square width = (CMP0n_value + 1) * count_clock
  533 :         */
  534 :         #define TMH0_CMP0nValue 0x74
  535 :         
  536 :         /* Register settings */
  537 :         #define TMH0_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH0_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 /* Value selection
  538 :                                                                         TMHn_TMHMDn_Level_Low



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

  539 :                                                                         TMHn_TMHMDn_Level_High
  540 :                                                                 */                                                          
      :     TMHn_TMHMDn_Level_Low|                                                              TMHn_TMHMDn_Output_Enable
  541 :         
  542 :         /* Interrupt settings */
  543 :         #define TMH0_INTTMH0    0
  544 : 
  545 : 
  546 : /*
  547 : ***************************************
  548 : **  TMH1 configure
  549 : **
  550 : **  Please set operation mode here
  551 : ***************************************
  552 : */
  553 : /* if no use set nouse = 1, if use some function set function = 1 */
  554 : #define TMH1_NotUse     0
  555 : #define TMH1_Interval   0
  556 : #define TMH1_SquareOut  1
  557 : #define TMH1_PWMOut     0
  558 : #define TMH1_CarrierOut 0
  559 : 
  560 : 
  561 :         /*
  562 :         ***************************************
  563 :         **  TMH1 square wave out
  564 :         **
  565 :         **  user set square width = 0.02s
  566 :         ***************************************
  567 :         */
  568 :         
  569 :         /* Count clock and compare value */
  570 :         /* Use register bit macro
  571 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  572 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  573 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^4
  574 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  575 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^12
  576 :                 TMHn_TMHMDn_CountClock_Internal5        :       frl/2^7
  577 :                 TMHn_TMHMDn_CountClock_Internal6        :       frl/2^9
  578 :                 TMHn_TMHMDn_CountClock_Internal7        :       frl
  579 :                 Note :  Please select the higher frequency you can,
  580 :                         so the precision will be higher.
  581 :         */
  582 :         #define TMH1_Clock      TMHn_TMHMDn_CountClock_Internal4
  583 :         /* 
  584 :                 Value range :   0x00 - 0xfe
  585 :                 Square width = (CMP0n_value + 1) * count_clock
  586 :         */
  587 :         #define TMH1_CMP0nValue  0x27   /* User set 0.125s */
  588 :         
  589 :         /* Register settings */
  590 :         #define TMH1_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH1_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 /* Value selection
  591 :                                                                         TMHn_TMHMDn_Level_Low



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

  592 :                                                                         TMHn_TMHMDn_Level_High
  593 :                                                                 */                                                          
      :     TMHn_TMHMDn_Level_Low|                                                              TMHn_TMHMDn_Output_Enable
  594 :         
  595 :         /* Interrupt settings */
  596 :         #define TMH1_INTTMH1    0
  597 : 
  598 : 
  599 : 
  600 : 
  601 : 
  602 : #define _HDTIMER_
  603 : 
  604 : /*
  605 : *******************************************************************************
  606 : **  Function proto type
  607 : *******************************************************************************
  608 : */
  609 : 
  610 : 
  611 : void TM00_Init(void);
  612 : void TM00_Enable(void);
  613 : void TM00_Disable(void);
  614 : 
  615 : 
  616 : 
  617 : void TM01_Init(void);
  618 : void TM01_Enable(void);
  619 : void TM01_Disable(void);
  620 : 
  621 : 
  622 : 
  623 : void TM50_Init(void);
  624 : void TM50_Enable(void);
  625 : void TM50_Disable(void);
  626 : 
  627 : 
  628 : 
  629 : void TM51_Init(void);
  630 : void TM51_Enable(void);
  631 : void TM51_Disable(void);
  632 : 
  633 : 
  634 : 
  635 : void TMH0_Init(void);
  636 : void TMH0_Enable(void);
  637 : void TMH0_Disable(void);
  638 : 
  639 : 
  640 : 
  641 : void TMH1_Init(void);
  642 : void TMH1_Enable(void);
  643 : void TMH1_Disable(void);
  644 : 
  645 : 
  646 : 



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

  647 : /*
  648 : *******************************************************************************
  649 : **  MacroDefine
  650 : *******************************************************************************
  651 : */
  652 : 
  653 : /* the value for IMS and IXS */
  654 : #define  MEMORY_IMS_SET         0xCC
  655 : #define  MEMORY_IXS_SET         0x00
  656 : 
  657 : /*
  658 : **-----------------------------------------------------------------------------
  659 : **
  660 : **  Abstract:
  661 : **      main function
  662 : **
  663 : **  Parameters:
  664 : **      None
  665 : **
  666 : **  Returns:
  667 : **      None
  668 : **
  669 : **-----------------------------------------------------------------------------
  670 : */
  671 : void main( void )
  672 : {
  673 :         IMS = MEMORY_IMS_SET;
  674 :         IXS = MEMORY_IXS_SET;
  675 :         /* TODO. add user code */
  676 :         EI();
  677 :         
  678 :         TM00_Init();
  679 :         /* P01 as TO00 */
  680 :         P0.1 = 0;
  681 :         PM0.1 = 0;
  682 :         TM00_Enable();
  683 :         
  684 :         TM01_Init();
  685 :         /* P06 as TO01 */
  686 :         P0.6 = 0;
  687 :         PM0.6 = 0;
  688 :         TM01_Enable();
  689 :         
  690 :         TM50_Init();
  691 :         /* P17 as TO50 */
  692 :         P1.7 = 0;
  693 :         PM1.7 = 0;
  694 :         TM50_Enable();
  695 :         
  696 :         TM51_Init();
  697 :         /* P33 as TO51 */
  698 :         P3.3 = 0;
  699 :         PM3.3 = 0;
  700 :         TM51_Enable();
  701 :         
  702 :         TMH0_Init();



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

  703 :         /* P15 as TOH0 */
  704 :         P1.5 = 0;
  705 :         PM1.5 = 0;
  706 :         TMH0_Enable();
  707 :         
  708 :         TMH1_Init();
  709 :         /* P16 as TOH1 */
  710 :         P1.6 = 0;
  711 :         PM1.6 = 0;
  712 :         TMH1_Enable();
  713 :         
  714 :         while(1){
  715 :                 ;
  716 :         }
  717 : }


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

⌨️ 快捷键说明

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