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

📄 mcu.lst

📁 MS2 程序分析 Lldwsw 一:下载MS2.RAR 压缩包解压缩后可以看到如下界面: 第一项为MS2 软件包
💻 LST
📖 第 1 页 / 共 2 页
字号:
 188          void timer2_init(U1 Enable, TimerInterval eTimerInterval)
 189          {
 190   1              TH2 = eTimerInterval;
 191   1              RCAP2H = eTimerInterval;
 192   1      
 193   1              
 194   1              TL2 = 0x00;
 195   1              RCAP2L = 0x00;
 196   1              
 197   1              T2MOD = 0x00;
 198   1              if(Enable)
 199   1              {
 200   2                      T2CON = 0x04;
 201   2              }
 202   1              else
 203   1              {
 204   2                      T2CON = 0x00;
 205   2              }
 206   1      
 207   1              ET2 = 1;
 208   1      }
 209          
 210          
 211          /*==================================================================
 212          * Function      : uart_init
 213          * Description   : UART initialize,use timer1
 214          * Input Para    : UartBaudrate eBaudRate        : baud rate
 215          * Output Para   : void
 216          * Return Value: void
 217          ==================================================================*/
 218          void uart_init(UartBaudrate BaudRate)
 219          {
 220   1              ES = 0;                 /*关串行口中断*/        
 221   1      
 222   1      #ifdef SPEEDUP                  /*串口速度加倍*/
 223   1              RESETBIT(PCON, 7);
 224   1      #else
                      SETBIT(PCON, 7);
              #endif
 227   1      
 228   1              if(BaudRate == UART_RATE1152)
 229   1              {
 230   2                      BaudRate = UART_RATE576;
 231   2                      SETBIT(PCON, 7);
 232   2              }
 233   1      
 234   1              TMOD &= 0x0F;
 235   1              TMOD |= 0x20;
 236   1              ET1 = 0;                                /*中断无效*/
 237   1              TH1 = BaudRate;
 238   1              TL1 = BaudRate;
 239   1              TR1 = 1;                                /*定时器开启*/
 240   1              SCON = 0x50;
C51 COMPILER V7.10   MCU                                                                   07/03/2008 12:45:33 PAGE 5   

 241   1      
 242   1              RI = 0;
 243   1              
 244   1              ES = 1;                         /*串行口中断printf需要串口关闭*/
 245   1      }
 246          
 247          
 248          /*==================================================================
 249          * Function      : extern_interrupt0
 250          * Description   : 
 251          * Input Para    : 
 252          * Output Para   : 
 253          * Return Value: 
 254          ==================================================================*/
 255          void extern_interrupt0(void) interrupt 0
 256          {
 257   1      
 258   1      }
 259          
 260          
 261          /*==================================================================
 262          * Function      : extern_interrupt1
 263          * Description   : 
 264          * Input Para    : 
 265          * Output Para   : 
 266          * Return Value: 
 267          ==================================================================*/
 268          void extern_interrupt1(void) interrupt 2
 269          {
 270   1      
 271   1      }
 272          
 273          
 274          /*==================================================================
 275          * Function      : uart_put
 276          * Description   : send U8 as raw data through uart
 277          * Input Para    : U8 val        : the data to send
 278          * Output Para   : void
 279          * Return Value: void
 280          ==================================================================*/
 281          void uart_put(U8 u8)
 282          {
 283   1              U1 ES_MAP;
 284   1              
 285   1              ES_MAP = ES;    
 286   1              
 287   1              ES = 0;
 288   1              SBUF = u8;
 289   1              while(!TI);
 290   1              TI = 0;
 291   1              
 292   1      
 293   1              ES = ES_MAP;
 294   1      }
 295          
 296          
 297          /*==================================================================
 298          * Function      : UartInterruptService
 299          * Description   : The UART interrupt server
 300          * Input Para    : void
 301          * Output Para   : void
 302          * Return Value: void
C51 COMPILER V7.10   MCU                                                                   07/03/2008 12:45:33 PAGE 6   

 303          ==================================================================*/
 304          static void UartInterruptService(void) interrupt 4
 305          {
 306   1              ES = 0;
 307   1              RI = 0;
 308   1              uart_process(SBUF);
 309   1      
 310   1              ES=1;
 311   1      }
 312          
 313          
 314          #if 0
              /*==================================================================
              * Function      : Timer0InterruptService
              * Description   : 
              * Input Para    : 
              * Output Para   : 
              * Return Value: 
              ==================================================================*/
              void Timer0InterruptService(void) interrupt 1
              {
                      timer0_process();
              }
              #endif
 327          
 328          
 329          #if 0           /*缺省用于串口*/
              /*==================================================================
              * Function      : Timer1InterruptService
              * Description   : 
              * Input Para    : 
              * Output Para   : 
              * Return Value: 
              ==================================================================*/
              void Timer1InterruptService(void) interrupt 3
              {
              
              }
              #endif
 342          
 343          
 344          /*==================================================================
 345          * Function      : Timer2InterruptService
 346          * Description   : Timer2 interrupt as system timer,It is importance
 347          * Input Para    : void
 348          * Output Para   : void
 349          * Return Value: void
 350          ==================================================================*/
 351          void Timer2InterruptService(void) interrupt 5 
 352          {
 353   1              ET2 = 0;                                                        /*close interrupt*/
 354   1              TF2 = 0;                                                        /*clear interrupt flag*/
 355   1      
 356   1              timer2_process();
 357   1      
 358   1              ET2 = 1;
 359   1      }
 360          
 361          
 362          
 363          
 364          
C51 COMPILER V7.10   MCU                                                                   07/03/2008 12:45:33 PAGE 7   

 365          
 366          
 367          
 368          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    331    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       4
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       7
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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