C51 COMPILER V9.56.0.0   MAIN                                                              03/14/2025 20:27:24 PAGE 1   


C51 COMPILER V9.56.0.0, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE ..\source\app\main.c LARGE OPTIMIZE(8,SPEED) BROWSE INCDIR(..\source\app
                    -;..\source\bsp) DEBUG OBJECTEXTEND PRINT(.\Listings\main.lst) TABS(2) OBJECT(.\Objects\main.obj)

line level    source

   1          #define ALLOCATE_EXTERN
   2          #include "bsp.h"
   3          #include "modbusrtuslave.h"
   4          #define DEATH_AERA 5
   5          u16 avg_advalue[14]={0};
   6          void update_IO_status(u8 index)
   7          {
   8   1        u32 adc_sum=0;
   9   1        u8 newindex;
  10   1        u8 i;
  11   1        if(ModBus_Addr == 1){
  12   2          if(index < 3) return;
  13   2          else{
  14   3            newindex = index -3;
  15   3          }
  16   2        }else{
  17   2          newindex = index;
  18   2        }
  19   1        for(i=0;i<16;i++)
  20   1        {
  21   2          adc_sum += adcvalue[index][i];
  22   2        }
  23   1        adc_sum = adc_sum >>4;
  24   1        avg_advalue[newindex]=adc_sum;
  25   1        if(Modbus_HoldReg[newindex] < 4095 - DEATH_AERA && Modbus_HoldReg[newindex] > DEATH_AERA){
  26   2          if(adc_sum >= Modbus_HoldReg[newindex]+DEATH_AERA) Set_InputIO_Value(newindex,1);
  27   2          else if(adc_sum < Modbus_HoldReg[newindex]-DEATH_AERA) Set_InputIO_Value(newindex,0);
  28   2      
  29   2        }else{
  30   2          if(adc_sum >= Modbus_HoldReg[newindex]) Set_InputIO_Value(newindex,1);
  31   2          else if(adc_sum < Modbus_HoldReg[newindex]) Set_InputIO_Value(newindex,0);
  32   2        }
  33   1      }
  34          void main()
  35          {
  36   1        bsp_init();
  37   1        Modbus_RTU_Init();
  38   1        
  39   1        while(1)
  40   1        {
  41   2          if(rs485_has_recv_timeout())
  42   2          {
  43   3            ModBusRtuSlave_Service(guc_Uartcnt);
  44   3            guc_Uartcnt =0;//清空接收缓冲区计数器
  45   3          }
  46   2          if(adc_full_complete==1)
  47   2          {
  48   3            update_IO_status(0);
  49   3            update_IO_status(1);
  50   3            update_IO_status(2);
  51   3            update_IO_status(3);
  52   3            update_IO_status(4);
  53   3            update_IO_status(5);
  54   3            update_IO_status(6);
C51 COMPILER V9.56.0.0   MAIN                                                              03/14/2025 20:27:24 PAGE 2   

  55   3            update_IO_status(7);
  56   3            update_IO_status(8);
  57   3            update_IO_status(9);
  58   3            update_IO_status(10);
  59   3            update_IO_status(11);
  60   3            update_IO_status(12);
  61   3            update_IO_status(13);
  62   3            adc_full_complete = 0;
  63   3            bsp_adc_start();
  64   3      //      guc_UartTxbuf[0] = (u8)(adcvalue[0][0]>>8);
  65   3      //      guc_UartTxbuf[1] = adcvalue[0][0];
  66   3      //      bsp_uart_send_buff(2);
  67   3          }
  68   2        }
  69   1      }
  70          


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


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