main.lst

来自「STC51系列的源码」· LST 代码 · 共 274 行

LST
274 行
字号
C51 COMPILER V8.02   MAIN                                                                  10/31/2008 23:03:56 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\out\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\out\main.lst) OBJECT(.\out\m
                    -ain.obj)

line level    source

   1          /********************************************************************************/
   2          /* filename : MAIN.c                                                            */
   3          /* created  : xillinx                                                           */
   4          /* descript : 系统的C函数入口                                                   */
   5          /********************************************************************************/
   6          #include "../CPU/CPU.h"
   7          #include "../CFG/CFG.h"
   8          #include "../UART/UART.h"
   9          #include "../LED/LED.h"
  10          #include "../SEG7/SEG7.h"
  11          #include "../HC595/HC595.h"
  12          #include "../TC1602A/TC1602A.h"
  13          #include "../DS18B20/DS18B20.h"
  14          #include "etherdev.h"
  15          #include "apply.h"
  16          #include "main.h"
  17          
  18          unsigned int system_timer;
  19          
  20          u8_t   arptimer;
  21          u8_t   tcptimer;
  22          
  23          /********************************************************************************/
  24          /* fun_name : MAIN_uip_timer()                                                  */
  25          /* version  : v1.00                                                             */
  26          /* created  : xillinx                                                           */
  27          /********************************************************************************/
  28          void MAIN_uip_timer(void) 
  29          {   arptimer++;
  30   1          tcptimer++;
  31   1      } 
  32          
  33          /********************************************************************************/
  34          /* funname : MAIN_ds18b20_hook()                                                */
  35          /* created : xillinx                                                            */
  36          /* time    : 2008-08-06                                                         */
  37          /* descript: DS18B20启动转换HOOK函数                                            */
  38          /********************************************************************************/
  39          void MAIN_ds18b20_hook(void)
  40          {   DS18B20_mflag=0x1;
  41   1      }
  42          
  43          extern unsigned char ds18b20_buffer[0x20];
  44          extern unsigned char ds18b20_flag;
  45          extern unsigned char ds18b20_lenth;
  46          /********************************************************************************/
  47          /* funname : MAIN_proc_ds18b20()                                                */
  48          /* created : xillinx                                                            */
  49          /* time    : 2008-08-06                                                         */
  50          /* descript: DS18B20调试输出                                                    */
  51          /********************************************************************************/
  52          void MAIN_proc_ds18b20(void)
  53          {   unsigned char flag;
  54   1          unsigned char dt;
C51 COMPILER V8.02   MAIN                                                                  10/31/2008 23:03:56 PAGE 2   

  55   1          int  mdata;
  56   1          int  lo;
  57   1          int  hi;
  58   1          if(DS18B20_mflag==0x0)
  59   1          {   return;
  60   2          }
  61   1          DS18B20_mflag=0x0;
  62   1          mdata=(int)DSB20_read_temperature();
  63   1          DSB20_delay_100_us();
  64   1          DSB20_start_convert();
  65   1              if(mdata<0x0)
  66   1          {  return;
  67   2          }
  68   1          dt=mdata&0xF;
  69   1          hi=mdata>>0x4;
  70   1          lo=0x0;
  71   1          if(dt&0x8)
  72   1          {  lo+=5000;
  73   2          }
  74   1          if(dt&0x4)
  75   1          {  lo+=2500;
  76   2          }
  77   1          if(dt&0x2)
  78   1          {  lo+=1250;
  79   2          }
  80   1          if(dt&0x1)
  81   1          {  lo+=625;
  82   2          }
  83   1          if(hi>70)
  84   1          {  return;
  85   2          }
  86   1          sprintf(ds18b20_buffer,"%d.%d",hi,lo);
  87   1          LCDT_LED_clear();
  88   1          LCDT_print_string(0x0,0x0,"  temperature  ");     /* 测试点阵LCD */
  89   1          LCDT_print_string(0x2,0x1,ds18b20_buffer);
  90   1          ds18b20_lenth=strlen(ds18b20_buffer);
  91   1          ds18b20_buffer[ds18b20_lenth+0x0]='^';
  92   1          ds18b20_buffer[ds18b20_lenth+0x1]='c';
  93   1          ds18b20_buffer[ds18b20_lenth+0x2]='\r';
  94   1          ds18b20_buffer[ds18b20_lenth+0x3]='\n';
  95   1          ds18b20_buffer[ds18b20_lenth+0x4]='\0';
  96   1          ds18b20_lenth+=4;
  97   1          ds18b20_flag=0x1;
  98   1          return;
  99   1      }
*** WARNING C280 IN LINE 53 OF MAIN.C: 'flag': unreferenced local variable
 100          
 101          /********************************************************************************/
 102          /* fun_name : MAIN_interrupt_hook_process()                                     */
 103          /* version  : v1.00                                                             */
 104          /* created  : xillinx                                                           */
 105          /* descript : 定时器钩子函数的处理,如果需要使用这些函数,需要重新挂接,如果不需要 */
 106          /*  不需要做任何事情                                                            */
 107          /********************************************************************************/
 108          void MAIN_interrupt_hook_process (void)
 109          {   CPU_001_tick_process = CPU_interrupt_proc_null; //* 定时器钩子函数的缺省处理,如果需要使用这些函数,需要
             -重新挂接
 110   1          CPU_002_tick_process = CPU_interrupt_proc_null;
 111   1          CPU_004_tick_process = CPU_interrupt_proc_null;
 112   1          CPU_008_tick_process = CPU_interrupt_proc_null;
 113   1          CPU_010_tick_process = CPU_interrupt_proc_null;
 114   1          CPU_020_tick_process = CPU_interrupt_proc_null;
C51 COMPILER V8.02   MAIN                                                                  10/31/2008 23:03:56 PAGE 3   

 115   1          CPU_040_tick_process = CPU_interrupt_proc_null;
 116   1          CPU_080_tick_process = CPU_interrupt_proc_null;
 117   1          CPU_100_tick_process = CPU_interrupt_proc_null;
 118   1          CPU_200_tick_process = CPU_interrupt_proc_null;
 119   1          CPU_400_tick_process = CPU_interrupt_proc_null;
 120   1          CPU_extern_0_process = CPU_interrupt_proc_null;
 121   1          CPU_extern_1_process = CPU_interrupt_proc_null;
 122   1          CPU_timer_02_process = CPU_interrupt_proc_null;
 123   1                                                          //* 重新挂接HOOK函数
 124   1          CPU_001_tick_process = HC595_refresh;           //* 2MS
 125   1          CPU_080_tick_process = LED_refresh;             //* 128x2=256MS
 126   1          CPU_040_tick_process = MAIN_uip_timer;          //* 64*2=128MS
 127   1          CPU_400_tick_process = MAIN_ds18b20_hook;       //* 2秒钟启动一次转换
 128   1      }
 129          
 130          void main(void)
 131          { 
 132   1          u8_t   i, arptimer;
 133   1          
 134   1          MAIN_interrupt_hook_process();
 135   1          UART_buffer_initilize();
 136   1          CPU_timer_0_initialize();
 137   1          CPU_timer_2_initialize();
 138   1          CPU_uart_serial_initial();
 139   1          CPU_source_initialize();    //* 控制CPU的资源
 140   1          SEG7_clear_screen();
 141   1          SEG7_clear_screen();
 142   1          
 143   1          rtl8019_reset();
 144   1          rtl8019_initialize();
 145   1          
 146   1          
 147   1          SEG7_printf_ascii("1234.567");      //* 测试七段数码管
 148   1          UART_printf("融益通讯学习板\r\n");  //* 测试UART串口
 149   1          
 150   1          LCDT_initialize();
 151   1          LCDT_print_string(0x0,0x0,"rongyitong tech");     /* 测试点阵LCD */
 152   1          LCDT_print_string(0x0,0x1,"cchhww11@tom.com");
 153   1      
 154   1          /* Initialise the uIP TCP/IP stack. */
 155   1          uip_init();
 156   1      
 157   1          /* Initialise the ARP cache. */
 158   1          uip_arp_init();
 159   1          
 160   1          main_apply_initialize();
 161   1      
 162   1          arptimer = 0;
 163   1      
 164   1          while(1)
 165   1          {   MAIN_proc_ds18b20();
 166   2              uip_len = etherdev_read();
 167   2      
 168   2              if(uip_len == 0)
 169   2              {   if(tcptimer<8)
 170   3                  {   continue;
 171   4                  }
 172   3                  tcptimer=0x0;
 173   3                  for(i = 0; i < UIP_CONNS; i++)
 174   3                  {
 175   4                      uip_periodic(i);
 176   4                      /* If the above function invocation resulted in data that
C51 COMPILER V8.02   MAIN                                                                  10/31/2008 23:03:56 PAGE 4   

 177   4                         should be sent out on the network, the global variable
 178   4                         uip_len is set to a value > 0. */
 179   4                      if(uip_len > 0)
 180   4                      {
 181   5                          uip_arp_out();
 182   5                          etherdev_send();
 183   5                      }
 184   4                  }
 185   3      
 186   3      #if UIP_UDP
                          for(i = 0; i < UIP_UDP_CONNS; i++)
                          {
                              uip_udp_periodic(i);
                              /* If the above function invocation resulted in data that
                                 should be sent out on the network, the global variable
                                 uip_len is set to a value > 0. */
                              if(uip_len > 0)
                              {
                                  uip_arp_out();
                                  etherdev_send();
                              }
                          }
              #endif /* UIP_UDP */
 200   3      
 201   3                  /* Call the ARP timer function every 10 seconds, 80 tick=10S * */
 202   3                  if(arptimer >= 80)
 203   3                  {   
 204   4                          uip_arp_timer();
 205   4                          arptimer = 0;
 206   4                  }
 207   3              }
 208   2              else /* (uip_len != 0) Process incoming */
 209   2              {
 210   3                  if(BUF->type == htons(UIP_ETHTYPE_IP))
 211   3                  {
 212   4                          uip_arp_ipin();
 213   4                          uip_input();
 214   4                          /* If the above function invocation resulted in data that
 215   4                             should be sent out on the network, the global variable
 216   4                             uip_len is set to a value > 0. */
 217   4                          if(uip_len > 0)
 218   4                      {
 219   5                              uip_arp_out();
 220   5                              etherdev_send();
 221   5                          }
 222   4                  }
 223   3                  else if(BUF->type == htons(UIP_ETHTYPE_ARP))
 224   3                  {
 225   4                          uip_arp_arpin();
 226   4                          /* If the above function invocation resulted in data that
 227   4                             should be sent out on the network, the global variable
 228   4                             uip_len is set to a value > 0. */        
 229   4                          if(uip_len > 0)
 230   4                      {       
 231   5                              etherdev_send();
 232   5                          }
 233   4                  }
 234   3              }
 235   2          }
 236   1      
 237   1          return;
 238   1      }
C51 COMPILER V8.02   MAIN                                                                  10/31/2008 23:03:56 PAGE 5   

 239          


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


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

⌨️ 快捷键说明

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