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

📄 main1_zw.lst

📁 基于485的51单片机多机通讯程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.06   MAIN1_ZW                                                              10/04/2005 14:08:50 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN1_ZW
OBJECT MODULE PLACED IN E:\NEWMAC~1\050808\MAIN\MAIN1_ZW.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE E:\NEWMAC~1\050808\MAIN\MAIN1_ZW.C DB SB OE

stmt level    source

   1          //#pragma la
   2          #include <main1.h>
   3          #define uchar   unsigned char
   4          #define uint    unsigned int
   5          sbit stop=P3^5;
   6          
   7          xdata uchar rbuffer[64],sbuffer[5],sbuffer1[55];
   8          uchar   S_ANSW,R_ANSW,POINTER0,POINTER1,RSUM,SSUM,c_t1,s_byte_nums,r_byte_nums,
   9                  work,pn1,PRG,err,toPRG,temp_c;
  10          bit edit_finish,copy,change_prg,overtime,getPRG,received,send,t31OK,t41OK,
  11              t51OK,resend,ans,s_p,noans_ok,connect,break_connect,main1_err,in_sector,
  12              editing,p_received,lift_ok,pc_ok,temp_motor_stop,
  13              new_switch1,new_switch2,new_switch3,need_para,
  14              urgent_stop,p_active,rc_active;
  15          uint    *point;
  16          
  17          xdata   uchar   start           _at_ 0x0800;
  18          xdata   uchar   start_again     _at_ 0x0801;
  19          xdata   uchar   decrease        _at_ 0x0802;
  20          xdata   uchar   err_ok          _at_ 0x0804;
  21          xdata   uchar   YOUHU           _at_ 0x0806;
  22          xdata   uchar   WIRE            _at_ 0x0808;
  23          xdata   uchar   decrease_ok     _at_ 0x080A;
  24          xdata   uchar   weld_switch     _at_ 0x080C;
  25          xdata   uchar   wire_switch     _at_ 0x080E;
  26          xdata   uchar   current_add     _at_ 0x0810;
  27          xdata   uchar   current_dec     _at_ 0x0812;
  28          xdata   uchar   rot_front       _at_ 0x0814;
  29          xdata   uchar   rot_reverse     _at_ 0x0816;
  30          xdata   uchar   wire_add        _at_ 0x0818;
  31          xdata   uchar   wire_dec        _at_ 0x081A;
  32          xdata   uchar   osc_l           _at_ 0x081C;
  33          xdata   uchar   osc_r           _at_ 0x081E;
  34          xdata   uchar   breadth_add     _at_ 0x0820;
  35          xdata   uchar   breadth_dec     _at_ 0x0822;
  36          xdata   uchar   avc_up          _at_ 0x0824;
  37          xdata   uchar   avc_down        _at_ 0x0826;
  38          xdata   uchar   motor_stop      _at_ 0x0828;
  39          xdata   uchar   delt_switch     _at_ 0x082A;
  40          xdata   uchar   return_ok       _at_ 0x082C;
  41          xdata   uchar   nonce_sec       _at_ 0X082E;
  42          xdata   uint    FINISH          _at_ 0X0830;
  43          xdata   uint    CURRENT         _at_ 0X0832;
  44          xdata   uint    VOLTAGE         _at_ 0X0834;
  45          xdata   uint    AVC             _at_ 0X0836;
  46          //xdata uchar   pc_ok           _at_ 0x0838;
  47          xdata   uchar   new_switch11    _at_ 0x0839;
  48          xdata   uchar   new_switch22    _at_ 0x083A;
  49          xdata   uchar   pc_edit         _at_ 0x083B;
  50          //xdata uchar   rc_forbided     _at_ 0x083C;
  51          //xdata uchar   p_actived       _at_ 0x083D;
  52          //xdata uchar   rc_actived      _at_ 0x083E;
  53          xdata   uint    last_FINISH     _at_ 0x0840;
  54          xdata   uchar   pc_stop         _at_ 0x0842;
  55          xdata   uchar   edited          _at_ 0x0843;
C51 COMPILER V7.06   MAIN1_ZW                                                              10/04/2005 14:08:50 PAGE 2   

  56          xdata   uchar   p_changed       _at_ 0x0844;
  57          
  58          void delay(unsigned int num)
  59          {
  60   1        data unsigned int i,ii;
  61   1        for(i=0;i<num;i++)
  62   1         {
  63   2           for(ii=0;ii<255;ii++);
  64   2         }
  65   1      }
  66          
  67          void TR_noans()
  68          {
  69   1              REN=0;
  70   1              noans_ok=0;
  71   1      //      TB8=1;
  72   1              POINTER0=0;
  73   1              SSUM=0;
  74   1              send=1;
  75   1              c_t1=0;
  76   1              TR1=1;
  77   1              while(POINTER0<s_byte_nums);
  78   1              TR1=0;
  79   1              noans_ok=1;
  80   1              REN=1;
  81   1      }
  82          
  83          void TR_ans()
  84          {
  85   1              REN=0;
  86   1              ans=1;
  87   1              POINTER1=0;
  88   1              RSUM=0;
  89   1              TB8=1;
  90   1              POINTER0=0;
  91   1              SSUM=0;
  92   1              send=1;
  93   1              c_t1=0;
  94   1              TR1=1;
  95   1              while(POINTER0<s_byte_nums);
  96   1              TR1=0;
  97   1      
  98   1              REN=1;
  99   1              send=0;
 100   1              c_t1=0;
 101   1      //      TR1=1;
 102   1              while(POINTER1<r_byte_nums&&overtime==0);
 103   1              TR1=0;
 104   1              POINTER1=0;
 105   1              RSUM=0;
 106   1              if(overtime==1)
 107   1              {
 108   2                      err=3;
 109   2                      main1_err=1;
 110   2                      overtime=0;
 111   2                      stop=0;
 112   2              }
 113   1              ans=0;
 114   1              REN=0;
 115   1      }
 116          
 117          void ini_sbuf(unsigned char a,b,c,d,e)
C51 COMPILER V7.06   MAIN1_ZW                                                              10/04/2005 14:08:50 PAGE 3   

 118          {
 119   1              sbuffer[0]=a;
 120   1              sbuffer[1]=b;
 121   1              sbuffer[2]=c;
 122   1              sbuffer[3]=d;
 123   1              sbuffer[4]=e;
 124   1      }
 125          
 126          unsigned char get_byte_nums(unsigned char type)
 127          {
 128   1              unsigned char numbers;
 129   1              switch(type)
 130   1              {
 131   2                      case    command:
 132   2                      case    program:
 133   2                      case    answer:         numbers=4;
 134   2                                              break;
 135   2                      case    err_infor:
 136   2                      case    parameter1:     numbers=5;
 137   2                                              break;
 138   2                      case    parameter:
 139   2                      case    infor:          numbers=6;
 140   2                                              break;
 141   2                      case    parameter2:     numbers=7;
 142   2                                              break;
 143   2                      case    call_result:    numbers=9;
 144   2                                              break;
 145   2                      case    para_pc:        numbers=10;
 146   2                                              break;
 147   2                      case    p_out_sec:      numbers=55;
 148   2                                              break;
 149   2                      case    p_in_sec:       numbers=24;
 150   2                                              break;
 151   2                      case    edit_sec:       numbers=64;
 152   2                                              break;
 153   2                      default:                break;
 154   2              }
 155   1              return numbers;
 156   1      }
 157          
 158          void com_type()
 159          {
 160   1              switch(rbuffer[2])
 161   1              {
 162   2                      case com_edit:          editing=1;break;
 163   2      
 164   2                      case com_efinish:       editing=0;
 165   2                                              edit_finish=1;break;
 166   2      
 167   2                      case com_start:         if(start==0)
 168   2                                                      start=1;break;
 169   2                      case com_start_again:   if(start==0)
 170   2                                              {
 171   3                                                      start=1;
 172   3                                                      start_again=1;
 173   3                                              }break;
 174   2                      case com_decrease:      decrease=1;break;       //手动衰减
 175   2                      case com_current_add:   
 176   2                              current_add=1;
 177   2                              break;  //电流加
 178   2                      case com_current_dec:   
 179   2                              current_dec=1;
C51 COMPILER V7.06   MAIN1_ZW                                                              10/04/2005 14:08:50 PAGE 4   

 180   2                              break;  //电流减
 181   2                      case com_rot_front:     rot_front=1;break;
 182   2                      case com_rot_reverse:   rot_reverse=1;break;
 183   2                      case com_wire_add:      wire_add=1;break;
 184   2                      case com_wire_dec:      wire_dec=1;break;
 185   2                      case com_osc_l:         osc_l=1;break;
 186   2                      case com_osc_r:         osc_r=1;break;
 187   2                      case com_breadth_add:   breadth_add=1;break;
 188   2                      case com_breadth_dec:   breadth_dec=1;break;
 189   2                      case com_avc_up:        avc_up=1;break;
 190   2                      case com_avc_down:      avc_down=1;break;
 191   2                      case com_motor_stop:    temp_motor_stop=1;break;
 192   2                      case com_urgent_stop:   {
 193   3                                                      pc_stop=1;
 194   3                                                      urgent_stop=1;
 195   3                                                      err=1;
 196   3                                                      err_ok=0;
 197   3                                              }break;
 198   2                      case com_connect:       connect=1;break;
 199   2                      case com_connect_fail:  break_connect=1;break;
 200   2      //              case com_forbid_p:      p_forbid=1;break;
 201   2      //              case com_forbid_rc:     rc_forbid=1;break;
 202   2      //              case com_p_active:      p_active=1;break;
 203   2      //              case com_rc_active:     rc_active=1;break;
 204   2                      case com_need_para:     need_para=1;break;
 205   2                      default:                break;
 206   2              }
 207   1              if(ans==0)
 208   1              {
 209   2                      POINTER1=0;
 210   2                      RSUM=0;
 211   2                      r_byte_nums=4;
 212   2              }
 213   1      
 214   1      }
 215          
 216          void data_type()                                                //对接收到的数据分辨类型
 217          {
 218   1              switch(rbuffer[1])
 219   1              {
 220   2                      case command:   com_type();break;
 221   2                      case answer:    R_ANSW=rbuffer[2];break;
 222   2                      case err_infor: err=rbuffer[3];break;
 223   2      /*
 224   2                      case infor_sec: {
 225   2                                              nonce_sec=rbuffer[2];
 226   2      

⌨️ 快捷键说明

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