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

📄 rs232.lst

📁 一个完整的用用AVR单片机开发的电话交换机程序 希望对想学习AVR开发人有帮助
💻 LST
📖 第 1 页 / 共 2 页
字号:
 214   4                              }                       
 215   3                      if(temp==0xd4)
 216   3                              {//智能家居未准备好
 217   4                                      
 218   4                                      WriteCCR(CCR_step,0);
 219   4                                      return;
 220   4                              }               
 221   3                      if(temp==0xd5)
 222   3                              {//APBUS抢险
 223   4                                      
 224   4                                      WriteCCR(CCR_step,0);
 225   4                                      return;
 226   4                              }
 227   3                                      
 228   3                      if(temp==0xde)//用于系统检测 语音通道
 229   3                              {
 230   4                                      for(i=0;i<16;i++)
 231   4                                              {
 232   5                                                      for(j=0;j<8;j++)
 233   5                                                              {
 234   6                                                                      if(Readsoundway(i,j)!=0)
 235   6                                                                              {
 236   7                                                                                      rs232write(0x12);
 237   7                                                                                      rs232write(i);
 238   7                                                                                      rs232write(j);
 239   7                                                                                      rs232write(Readsoundway(i,j));
 240   7                                                                                      rs232write(0x13);
 241   7                                                                              }
C51 COMPILER V7.06   RS232                                                                 11/15/2007 09:02:21 PAGE 5   

 242   6                                                              }
 243   5                                              }                                       
 244   4                              }
 245   3                      if(temp==0xdf)//用于系统检测 分机状态
 246   3                              {
 247   4                                      rs232write(ReadExtTelState(0));
 248   4                                      rs232write(ReadExtTelState(1));
 249   4                                      rs232write(ReadExtTelState(2));
 250   4                                      rs232write(ReadExtTelState(3));
 251   4                                      rs232write(ReadExtTelState(4));
 252   4                                      rs232write(ReadExtTelState(5));
 253   4                                      rs232write(ReadExtTelState(6));
 254   4                                      rs232write(ReadExtTelState(7));
 255   4                              }                                               
 256   3                      }
 257   2              if(ReadCCR(CCR_step)==1)
 258   2                      {
 259   3                              rs232write(temp);
 260   3                              WriteCCR(CCR_step,2);
 261   3                              return;                                 
 262   3                      }
 263   2              if(ReadCCR(CCR_step)==2)
 264   2                      {
 265   3                              rs232write(temp);
 266   3                              WriteCCR(CCR_step,0);
 267   3                              
 268   3                              temp=ReadCCR(CCR_data1);
 269   3                              temp=(temp>>4)*10+((ReadCCR(CCR_data1)<<4)>>4);
 270   3                              WriteSYSTEM(sp_TakeLineOutside,temp);   
 271   3                              
 272   3                              temp=ReadCCR(CCR_data0);
 273   3                              temp=(temp>>4)*10+((ReadCCR(CCR_data0)<<4)>>4);                                         
 274   3                              WriteSYSTEM(sp_TakeLineAtHome,temp);                    
 275   3                              
 276   3                              return;                                 
 277   3                      }       
 278   2                      
 279   2              WriteCCR(CCR_step,0);   //防止出错
 280   2              return;                                                                                                                                                                 
 281   2              }
 282   1      }
 283          
 284          void    rs232write(UCHAR watch_data)
 285          {
 286   1              PORT_STORE=PORT;
 287   1              RCON=RCON_Bank1;
 288   1              
 289   1              rs_send_buff[rs_send_buff_writeptr]=watch_data;
 290   1              rs_send_buff_writeptr++;
 291   1              if(rs_send_buff_writeptr>=rs_send_buff_length){rs_send_buff_writeptr=0;}
 292   1              
 293   1              PORT=PORT_STORE;
 294   1      }
 295          
 296          void    CCSInit()
 297          {
 298   1              idata   UCHAR   i;
 299   1              for(i=0;i<9;i++)
 300   1                      {ReadCCS(i);WriteCCS(i,0);}
 301   1      }               
 302          
 303          void    CCRInit()
C51 COMPILER V7.06   RS232                                                                 11/15/2007 09:02:21 PAGE 6   

 304          {
 305   1              idata   UCHAR   i;
 306   1              for(i=0;i<5;i++)
 307   1                      {WriteCCR(i,0);}
 308   1      }               
 309          
 310          
 311          
 312          void    WriteSYSTEM(UCHAR item,UCHAR num)
 313          {
 314   1              PORT_STORE=PORT;
 315   1              RCON=RCON_Bank1;
 316   1              
 317   1              SYSTEM_PARAMETER[item]=num;
 318   1              
 319   1              PORT=PORT_STORE;        
 320   1              return;
 321   1      }
 322          UCHAR ReadSYSTEM(UCHAR item)
 323          {
 324   1              idata UCHAR temp;
 325   1              
 326   1              PORT_STORE=PORT;
 327   1              RCON=RCON_Bank1;
 328   1              
 329   1              temp=SYSTEM_PARAMETER[item];
 330   1              
 331   1              PORT=PORT_STORE;        
 332   1              return temp;    
 333   1      }
 334          
 335          void    WriteCCS(UCHAR item,UCHAR num)
 336          {
 337   1              PORT_STORE=PORT;
 338   1              RCON=RCON_Bank1;
 339   1              
 340   1              CCS[item]=num;
 341   1              
 342   1              PORT=PORT_STORE;        
 343   1              return;
 344   1      }
 345          UCHAR ReadCCS(UCHAR item)
 346          {
 347   1              idata UCHAR temp;
 348   1              
 349   1              PORT_STORE=PORT;
 350   1              RCON=RCON_Bank1;
 351   1              
 352   1              temp=CCS[item];
 353   1              
 354   1              PORT=PORT_STORE;        
 355   1              return temp;    
 356   1      }
 357          
 358          void    WriteCCR(UCHAR item,UCHAR num)
 359          {
 360   1              PORT_STORE=PORT;
 361   1              RCON=RCON_Bank1;
 362   1              
 363   1              CCR[item]=num;
 364   1              
 365   1              PORT=PORT_STORE;        
C51 COMPILER V7.06   RS232                                                                 11/15/2007 09:02:21 PAGE 7   

 366   1              return; 
 367   1      }
 368          UCHAR ReadCCR(UCHAR item)
 369          {
 370   1              idata UCHAR temp;
 371   1              
 372   1              PORT_STORE=PORT;
 373   1              RCON=RCON_Bank1;
 374   1              
 375   1              temp=CCR[item];
 376   1              
 377   1              PORT=PORT_STORE;        
 378   1              return temp;    
 379   1      }
 380          /*              
 381                                  if(temp==0xff){test_step=1;PORT=PORT_STORE;return;}
 382                                  if(test_step==1){test_temp=temp; test_step=2;PORT=PORT_STORE;return;}
 383                                  if(test_step==2){ConnectTowPoint(test_temp,temp);test_step=0;PORT=PORT_STORE;return;}
 384                                  
 385                                  if(temp==0xfe){test_step2=1;PORT=PORT_STORE;return;}
 386                                  if(test_step2==1){test_temp2=temp; test_step2=2;PORT=PORT_STORE;return;}
 387                                  if(test_step2==2){CutTowPoint(test_temp2,temp);test_step2=0;PORT=PORT_STORE;return;}
 388                                  
 389                                  if(temp==0xfd){test_step3=1;PORT=PORT_STORE;return;}
 390                                  if(test_step3==1){test_temp3=temp; test_step3=2;PORT=PORT_STORE;return;}
 391                                  if(test_step3==2){ConnectTowPoint_CD22100(test_temp3,temp);test_step3=0;PORT=PORT_STORE;return;}
 392                                  
 393                                  if(temp==0xfc){test_step4=1;PORT=PORT_STORE;return;}
 394                                  if(test_step4==1){test_temp4=temp; test_step4=2;PORT=PORT_STORE;return;}
 395                                  if(test_step4==2){CutTowPoint_CD22100(test_temp4,temp);test_step4=0;PORT=PORT_STORE;return;}            
 396                                  
 397                                  if(temp==0xfb){test_step5=1;PORT=PORT_STORE;return;}
 398                                  if(test_step5==1){test_temp5=temp; test_step5=2;PORT=PORT_STORE;return;}
 399                                  if(test_step5==2)
 400                                          {
 401                                                  if(test_temp5==1){SetExtTelErrorSound(temp);}
 402                                                  if(test_temp5==2){SetExtTelWaitSound(temp);}
 403                                                  if(test_temp5==3){SetExtTelQuietSound(temp);}
 404                                                  
 405                                                  test_step5=0;PORT=PORT_STORE;return;
 406                                          }
 407                                  
 408                                  if(temp==0xf9){TakeOutsideLine(0);return;}
 409                                  if(temp==0xf8){HoldOutsideLine(0);return;}      
 410                                  if(temp==0xf7){TakeOutsideLine(1);return;}
 411                                  if(temp==0xf6){HoldOutsideLine(1);return;}
 412                                                          
 413                                  if(temp<10){ExtTelRing(temp);}
 414                                  if((temp>0x0f)&(temp<0x1a)){ExtTelStopRing(temp-0x10);}
 415                                  if(temp==0xec){ResourceWatch();}
 416                                  if(temp==0xef){test();}
 417                                  if(temp==0xed){test2();}
 418          */


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1267    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      10
   IDATA SIZE       =   ----       9
C51 COMPILER V7.06   RS232                                                                 11/15/2007 09:02:21 PAGE 8   

   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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