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

📄 cpu.lst

📁 STC51系列的源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
 136   1      }
 137          
 138          
 139          /********************************************************************************/
 140          /* fun_name : CPU_timer_2_initialize()                                          */
 141          /* version  : v1.00                                                             */
 142          /* created  : xillinx                                                           */
 143          /* descript : 定时器2初始化,用作红外部分接收                                    */
 144          /* T=12/OSC=12/44236800=0.01736
 145          /********************************************************************************/
 146          void CPU_timer_2_initialize(void)
 147          {   C_T2   =0x00;       //* 内部定时器
 148   1          T2MOD &=0xFE;       //* DCEN=0x0,递增计数器,递增计数到0xFFFF后,溢出,然后在把RCAP2L和RCAP2H加载到TL2和T
             -H2
 149   1          RCAP2L =0x00;       //* 如果溢出了,就重新从0开始递增计数
 150   1          RCAP2H =0x00;
 151   1          TL2    =0x00;
 152   1          TH2    =0x00;
 153   1          TR2    =0x00;
 154   1      }
 155          
 156          
 157          /********************************************************************************/
 158          /* fun_name : CPU_extern_0_interrupt()                                          */
 159          /* version  : v1.00                                                             */
 160          /* created  : xillinx                                                           */
 161          /********************************************************************************/
 162          void CPU_extern_0_interrupt(void) interrupt 0                        
 163          {   CPU_extern_0_process();
 164   1      }
 165          
 166          /********************************************************************************/
 167          /* fun_name : CPU_extern_1_interrupt()                                          */
 168          /* descript : For USB                                                           */
 169          /* version  : v1.00                                                             */
 170          /* created  : xillinx                                                           */
 171          /********************************************************************************/
 172          void CPU_extern_1_interrupt(void) interrupt 2 
 173          {   CPU_extern_1_process();
 174   1      }
 175          
 176          /********************************************************************************/
 177          /* fun_name : CPU_serial_1_interrupt()                                          */
C51 COMPILER V8.02   CPU                                                                   09/25/2008 20:18:47 PAGE 4   

 178          /* version  : v1.00                                                             */
 179          /* created  : xillinx                                                           */
 180          /* descript : For uart                                                          */
 181          /********************************************************************************/
 182          void CPU_serial_1_interrupt(void) interrupt 4 
 183          {   if( RI==1)
 184   1          {   RI=0;
 185   2              UART_recv_isr_process();
 186   2          }
 187   1          else if(TI==1)
 188   1          {   TI=0;
 189   2              UART_xmit_isr_process();
 190   2          }
 191   1      }
 192          
 193          /********************************************************************************/
 194          /* fun_name : CPU_source_initialize()                                           */
 195          /* version  : v1.00                                                             */
 196          /* created  : xillinx                                                           */
 197          /* descript : 控制CPU的资源使用                                                 */
 198          /********************************************************************************/
 199          void CPU_source_initialize (void)
 200          {   CPU_timer_0_initialize();
 201   1          CPU_timer_2_initialize();
 202   1          CPU_uart_serial_initial();
 203   1          IT0 = 0x1;    //* 选择中断类型: 0<==>低电平,1<==>下降沿
 204   1          EX0 = 0x1;    //* 外部中断0
 205   1          ET0 = 0x1;    //* 定时器0
 206   1          EX1 = 0x0;    //* 外部中断1
 207   1          ET1 = 0x0;    //* 定时器1
 208   1          ES  = 0x1;    //* UART串口0
 209   1          EA  = 0x1;    //* 全局中断控制
 210   1      }
 211          
 212          
 213          /********************************************************************************/
 214          /* fun_name : CPU_timer_0_interrupt()                                           */
 215          /* version  : v1.00                                                             */
 216          /* created  : xillinx                                                           */
 217          /********************************************************************************/
 218          void CPU_timer_interrupt(void)                       
 219          {   CPU_soft_timer_lo++;
 220   1          system_timer++;                     //* for system time operator
 221   1          CPU_001_tick_process();
 222   1          if((CPU_soft_timer_lo&0x01)==0x0)
 223   1          {  CPU_002_tick_process();
 224   2          }
 225   1          if((CPU_soft_timer_lo&0x03)==0x0)
 226   1          {  CPU_004_tick_process();
 227   2          }
 228   1          if((CPU_soft_timer_lo&0x07)==0x0)
 229   1          {  CPU_008_tick_process();
 230   2          }
 231   1          if((CPU_soft_timer_lo&0x0F)==0x0)
 232   1          {  CPU_010_tick_process();
 233   2          }
 234   1          if((CPU_soft_timer_lo&0x1F)==0x0)
 235   1          {   CPU_020_tick_process();
 236   2          }
 237   1          if((CPU_soft_timer_lo&0x3F)==0x0)
 238   1          {   CPU_040_tick_process();
 239   2          }
C51 COMPILER V8.02   CPU                                                                   09/25/2008 20:18:47 PAGE 5   

 240   1          if((CPU_soft_timer_lo&0x7F)==0x0)
 241   1          {   CPU_080_tick_process();
 242   2          }
 243   1          if((CPU_soft_timer_lo&0xFF)==0x0)
 244   1          {   CPU_100_tick_process();
 245   2              CPU_soft_timer_hi++;
 246   2              if((CPU_soft_timer_hi&0x01)==0x0)
 247   2              {  CPU_200_tick_process();
 248   3              }
 249   2              if((CPU_soft_timer_hi&0x03)==0x0)
 250   2              {  CPU_400_tick_process();
 251   3              }
 252   2          }
 253   1      }
 254          
 255          
 256          /********************************************************************************/
 257          /* fun_name : CPU_timer_2_interrupt()                                           */
 258          /* descript : 定时器2中断                                                       */
 259          /* version  : v1.00                                                             */
 260          /* created  : xillinx                                                           */
 261          /********************************************************************************/
 262          void CPU_timer_2_interrupt(void) interrupt 5 
 263          {   TF2=0x0;
 264   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    562    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =     44    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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