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

📄 bdtrv20.lst

📁 单片机C源程序souce
💻 LST
📖 第 1 页 / 共 2 页
字号:
 193   1      if (READ(0x03,0x40)=='$')
 194   1        {
 195   2        //delay(200);
 196   2        delay(200);
 197   2        rdata[0] = READ(0x03,0x40);
 198   2        rdata[1] = READ(0x03,0x41);
 199   2        i=2;
 200   2        while((rdata[i-2] != 0x0d)&&(rdata[i-1] != 0x0a))
 201   2          {
 202   3          rdata[i] = READ(0x03,i+0x40);
 203   3          i++;
 204   3          if (i>31)
 205   3              {
 206   4              rdata[i-2] = 0x0d;
 207   4              rdata[i-1] = 0x0a;
 208   4              }
 209   3          }
 210   2        if (i < 31)
 211   2          {
 212   3          RXLen = i;
 213   3              channel_beam_1=rdata[7]-0x30;
 214   3              channel_beam_2=rdata[9]-0x30;
 215   3          senddsp();
 216   3              for (i=0;i< RXLen;i++)
 217   3                  {
 218   4                      SBUF =rdata[i];
 219   4                      while(!TI);
 220   4                      TI =0;
 221   4                      }
 222   3          /*while(TX_Busy) ;
 223   3          TX_Busy = 1;
 224   3          TXLen = RXLen;
 225   3          for (i=0;i<RXLen;i++)
 226   3            {
 227   3             sdata[i] = rdata[i];
 228   3            }
 229   3          TXCont = 0;
 230   3              SBUF = sdata[TXCont++]; */
 231   3          }
 232   2        }
 233   1      //Initilze the initial value.
 234   1      if (READ(0x03,0x60)=='$')
 235   1        {
 236   2        delay(200);
 237   2        //delay(200);
 238   2        rdata[0] = READ(0x03,0x60);
 239   2        rdata[1] = READ(0x03,0x61);
 240   2        i=2;
 241   2        while((rdata[i-2] != 0x0d)&&(rdata[i-1] != 0x0a))
C51 COMPILER V7.06   BDTRV20                                                               11/20/2006 19:28:54 PAGE 5   

 242   2          {
 243   3          rdata[i] = READ(0x03,i+0x60);
 244   3          i++;
 245   3          if (i>31)
 246   3              {
 247   4              rdata[i-2] = 0x0d;
 248   4              rdata[i-1] = 0x0a;
 249   4              }
 250   3          }
 251   2        if (i < 31)
 252   2          {
 253   3          RXLen = i;
 254   3          senddsp();
 255   3      
 256   3              pps_asc[0]=rdata[9];
 257   3              pps_asc[1]=rdata[10];
 258   3              pps_asc[2]=rdata[11];
 259   3              pps_asc[3]=rdata[12];
 260   3      
 261   3              /************************/
 262   3              for(i=0;i<12;i++)
 263   3                  {
 264   4                      if (i<=3)
 265   4                        {
 266   5                        ay_par=ay_par<<8;
 267   5                        ay_par|= READ(0x03,(0xA0+i));           
 268   5                        }
 269   4                      else if(i>3&&i<=7)
 270   4                        {
 271   5                        az_par=az_par<<8;
 272   5                        az_par|= READ(0x03,(0xA0+i));           
 273   5                        }             
 274   4                 }
 275   3              /**************************/
 276   3      
 277   3              for (i=0;i< RXLen;i++)
 278   3                  {
 279   4                      SBUF =rdata[i];
 280   4                      while(!TI);
 281   4                      TI =0;
 282   4                      }
 283   3          /*while(TX_Busy) ;
 284   3          TX_Busy = 1;
 285   3          TXLen = RXLen;
 286   3          for (i=0;i<RXLen;i++)
 287   3            {
 288   3             sdata[i] = rdata[i];
 289   3            }
 290   3          TXCont = 0;
 291   3              SBUF = sdata[TXCont++];*/
 292   3          }
 293   2        }
 294   1      
 295   1      for (i=0;i<255;i++)
 296   1          {rdata[i] = 0xff;}
 297   1      //ES=1;//Enable the serial interruption.
 298   1      
 299   1      /*******************************************************/
 300   1      while(1)
 301   1        {wdt();
 302   2        if (moto_fg ==0) //ASCII
 303   2                { 
C51 COMPILER V7.06   BDTRV20                                                               11/20/2006 19:28:54 PAGE 6   

 304   3                if (flagserial==1)    //Wether having received data from the serial port.
 305   3                  {
 306   4                  flagserial=0;       //Reset the flag.
 307   4                      /************************************/
 308   4                    if ((toupper(rdata[3])=='L')&(toupper(rdata[4])=='L')&(toupper(rdata[5])=='A'))
 309   4                      {
 310   5                      WriteCont(0x02,0x00,rdata,0);
 311   5                      WriteCont(0x02,0x10,rdata,16);
 312   5                      WriteCont(0x02,0x20,rdata,32);
 313   5                      WriteCont(0x02,0x30,rdata,48);
 314   5                      }
 315   4                    if ((toupper(rdata[3])=='C')&(toupper(rdata[4])=='H')&(toupper(rdata[5])=='S'))
 316   4                      {
 317   5                      WriteCont(0x02,0x40,rdata,0);
 318   5                      WriteCont(0x02,0x50,rdata,16);
 319   5                      }
 320   4                    if ((toupper(rdata[3])=='O')&(toupper(rdata[4])=='F')&(toupper(rdata[5])=='S'))
 321   4                      {
 322   5                      WriteCont(0x02,0x60,rdata,0);
 323   5                      WriteCont(0x02,0x70,rdata,16);
 324   5                      WriteCont(0x02,0x80,rdata,32);
 325   5                      }
 326   4      
 327   4                      /***********************************/
 328   4                      if ((rdata[3]=='t'||rdata[3]=='T')&&
 329   4                          (rdata[4]=='m'||rdata[4]=='M')&&
 330   4                              (rdata[5]=='o'||rdata[5]=='O')) //ASCII TO motonola binary
 331   4                              moto_fg =1;
 332   4                      else
 333   4                      senddsp();
 334   4      
 335   4                    for (i=0;i<=254;i++)
 336   4                       {rdata[i] = 0xff;}
 337   4                  }
 338   3                if (flagint==1)       //Wether having received interrupt from the DSP.
 339   3                  {
 340   4                  flagint=0;  //Reset the flag.
 341   4                      rdDSP();
 342   4                  }
 343   3                if (TX == 1)
 344   3                      {
 345   4                      TX = 0;
 346   4                      TXCont = 0;
 347   4                      SBUF = sdata[TXCont++];
 348   4                      }
 349   3                 }
 350   2         else //motonola binary
 351   2                 {
 352   3                 if (flagserial ==1)//串口接收完数据标志
 353   3                    {
 354   4                        flagserial =0;
 355   4                        rev_frame();
 356   4                        }
 357   3                 if (flagint ==1)//读DSP标志
 358   3                    {
 359   4                        flagint =0;
 360   4                        rdDSP(); //读DSP数据
 361   4                    if (sdata[3]=='L'&&sdata[4]=='L'&&sdata[5]=='A')
 362   4                              {
 363   5                              sec_fg =1; //置秒标志
 364   5                              }
 365   4                        ch_frame();//存取对应DSP数据
C51 COMPILER V7.06   BDTRV20                                                               11/20/2006 19:28:54 PAGE 7   

 366   4                        }
 367   3                 if (sec_fg&&u_fg)//串口发送标志
 368   3                        {
 369   4                        sec_fg =0; //清秒标志
 370   4                        //u_fg =0;
 371   4                        sd_uart(); //串口发送数据
 372   4                        }
 373   3                 }
 374   2        }
 375   1      }
 376          
 377          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1765    ----
   CONSTANT SIZE    =     13    ----
   XDATA SIZE       =    362    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     23       1
   IDATA SIZE       =   ----    ----
   BIT SIZE         =     28    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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