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

📄 main.ppl

📁 the timer control demo source for the NEC mcu
💻 PPL
📖 第 1 页 / 共 3 页
字号:
  491 : #define TMH0_Interval   1



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

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


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

  546 :         **  TMH1 interval
  547 :         **
  548 :         **  user set interval time = 0.125s
  549 :         ***************************************
  550 :         */
  551 :         
  552 :         /* Count clock and compare value */
  553 :         /* Use register bit macro
  554 :                 TMHn_TMHMDn_CountClock_Internal0        :       fprs
  555 :                 TMHn_TMHMDn_CountClock_Internal1        :       fprs/2
  556 :                 TMHn_TMHMDn_CountClock_Internal2        :       fprs/2^4
  557 :                 TMHn_TMHMDn_CountClock_Internal3        :       fprs/2^6
  558 :                 TMHn_TMHMDn_CountClock_Internal4        :       fprs/2^12
  559 :                 TMHn_TMHMDn_CountClock_Internal5        :       frl/2^7
  560 :                 TMHn_TMHMDn_CountClock_Internal6        :       frl/2^9
  561 :                 TMHn_TMHMDn_CountClock_Internal7        :       frl
  562 :                 Note :  Please select the higher frequency you can,
  563 :                         so the precision will be higher.
  564 :         */
  565 :         #define TMH1_Clock      TMHn_TMHMDn_CountClock_Internal4
  566 :         /* 
  567 :                 Value range :   0x00 - 0xfe
  568 :                 Interval time = (CMP0n_value + 1) * count_clock
  569 :         */
  570 :         #define TMH1_CMP0nValue  0xf3   /* User set 0.125s */
  571 :         
  572 :         /* Register settings */
  573 :         #define TMH1_TMHMDnValue        TMHn_TMHMDn_Operation_Enable|                                                       
      :     TMH1_Clock|                                                         TMHn_TMHMDn_Mode_Interval|                          
      :                                 TMHn_TMHMDn_OutPut_Disable
  574 :         
  575 :         /* Interrupt settings */
  576 :         #define TMH1_INTTMH1    1
  577 : 
  578 : 
  579 : 
  580 : 
  581 : 
  582 : #define _HDTIMER_
  583 : 
  584 : /*
  585 : *******************************************************************************
  586 : **  Function proto type
  587 : *******************************************************************************
  588 : */
  589 : 
  590 : 
  591 : void TM00_Init(void);
  592 : void TM00_Enable(void);
  593 : void TM00_Disable(void);
  594 : 
  595 : 
  596 : 
  597 : void TM01_Init(void);
  598 : void TM01_Enable(void);
  599 : void TM01_Disable(void);



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

  600 : 
  601 : 
  602 : 
  603 : void TM50_Init(void);
  604 : void TM50_Enable(void);
  605 : void TM50_Disable(void);
  606 : 
  607 : 
  608 : 
  609 : void TM51_Init(void);
  610 : void TM51_Enable(void);
  611 : void TM51_Disable(void);
  612 : 
  613 : 
  614 : 
  615 : void TMH0_Init(void);
  616 : void TMH0_Enable(void);
  617 : void TMH0_Disable(void);
  618 : 
  619 : 
  620 : 
  621 : void TMH1_Init(void);
  622 : void TMH1_Enable(void);
  623 : void TMH1_Disable(void);
  624 : 
  625 : 
  626 : 
  627 : /*
  628 : *******************************************************************************
  629 : **  MacroDefine
  630 : *******************************************************************************
  631 : */
  632 : 
  633 : /* the value for IMS and IXS */
  634 : #define  MEMORY_IMS_SET         0xCC
  635 : #define  MEMORY_IXS_SET         0x00
  636 : 
  637 : int lcount = 0;
  638 : int ladd = 1;
  639 : int lint = 2;
  640 : 
  641 : void led8(int num){
  642 :         static unsigned char led_7seg[] = {
  643 :         /* 0     1     2     3     4     5     6     7  */
  644 :         0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07,
  645 :         /* 8     9     a     b     c     d     e     f  black */
  646 :         0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x00
  647 :         };
  648 :         
  649 :         P5 = ~led_7seg[num];
  650 : }
  651 : 
  652 : /*
  653 : **-----------------------------------------------------------------------------
  654 : **
  655 : **  Abstract:



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

  656 : **      main function
  657 : **
  658 : **  Parameters:
  659 : **      None
  660 : **
  661 : **  Returns:
  662 : **      None
  663 : **
  664 : **-----------------------------------------------------------------------------
  665 : */
  666 : void main( void )
  667 : {
  668 :         IMS = MEMORY_IMS_SET;
  669 :         IXS = MEMORY_IXS_SET;
  670 :         /* TODO. add user code */
  671 :         EI();
  672 :         
  673 :         PM5 = 0;
  674 :         
  675 : while(1){
  676 :         lint = 2;
  677 :         TM00_Init();
  678 :         TM00_Enable();
  679 :         TMMK000 = 0;
  680 :         while(lcount < 9);
  681 :         TM00_Disable();
  682 :         lcount = 0;
  683 :         
  684 :         TM01_Init();
  685 :         TM01_Enable();
  686 :         TMMK001 = 0;
  687 :         while(lcount <9);
  688 :         TM01_Disable();
  689 :         lcount = 0;
  690 :         
  691 :         lint = 4;
  692 :         TM50_Init();
  693 :         TM50_Enable();
  694 :         TMMK50 = 0;
  695 :         while(lcount < 9);
  696 :         TM50_Disable();
  697 :         lcount = 0;
  698 :         
  699 :         lint = 8;
  700 :         TM51_Init();
  701 :         TM51_Enable();
  702 :         TMMK51 = 0;
  703 :         while(lcount < 9);
  704 :         TM51_Disable();
  705 :         lcount = 0;
  706 :         
  707 :         lint = 32;
  708 :         TMH0_Init();
  709 :         TMH0_Enable();
  710 :         TMMKH0 = 0;
  711 :         while(lcount < 9);



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

  712 :         TMH0_Disable();
  713 :         lcount = 0;
  714 :         
  715 :         lint = 8;
  716 :         TMH1_Init();
  717 :         TMH1_Enable();
  718 :         TMMKH1 = 0;
  719 :         while(lcount < 9);
  720 :         TMH1_Disable();
  721 :         lcount = 0;
  722 :         }
  723 :         
  724 :         while(1){
  725 :                 ;
  726 :         }
  727 : }


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

⌨️ 快捷键说明

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