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

📄 test.lst

📁 单片机程序代码,经过很详细的测试.呵呵,硬件相关.
💻 LST
📖 第 1 页 / 共 5 页
字号:
 191          
 192          unsigned char ais_reg[4][8];
 193          unsigned char inter_reg[4][4];
 194          unsigned char los_reg[4] = {0,0,0,0};
 195          unsigned char xdata test_reg[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 196          unsigned char xdata init_temp = 0;              //初始化完成标志位(即C82命令完成)
 197          
 198          #define RX_BUF_SIZE             50
 199          #define RX_BUF_NUM              2
 200          #define TX_BUF_SIZE             140
 201          Uchar xdata rx_buf[RX_BUF_NUM][RX_BUF_SIZE],tx_buf[TX_BUF_SIZE];
 202          Uchar xdata rx_buf_pointer[RX_BUF_NUM]={0,0},tx_buf_pointer=0,rx_buf_num=0;
 203          Uchar xdata save_cmd_enable[RX_BUF_NUM]={0,0},rx_buf_overflow[RX_BUF_NUM]={0,0};
 204          Uchar xdata cmd_head[RX_BUF_NUM]={0,0},cmd_length[RX_BUF_NUM]={0,0};
 205          bit tx_done=0;
 206          
 207          
 208          void delay(void){
 209   1      long xdata i;
 210   1              for(i=0;i<8000;i++);
 211   1      }
 212          
 213          sbit P3_4 = P3^4;
 214          sbit P1_0 = P1^0;
 215          sbit P1_7 = P1^7; 
 216          
 217          unsigned char xdata time;
 218          unsigned char xdata time1;
 219          unsigned char xdata time2;
 220          unsigned char xdata time3;
 221          
 222          /****************************************************************************************/
 223          void service_int0(void) interrupt 0 using 1{
 224   1      volatile unsigned char int_reg;
 225   1      volatile unsigned char f2int_reg;
 226   1      unsigned char i;
 227   1      volatile unsigned char temp,temp1,temp2;
 228   1              
 229   1              int_reg = Int_vec;                                              //取出中断矢量寄存器的值
 230   1              f2int_reg = f2rc7860_rd(F2Int_vec);
 231   1              Int_mask = 0x80;                                                //设置屏蔽
 232   1              for (i = 0; i <= 3; i++){                               //取出4个光口的中断寄存器值
 233   2                      inter_reg[0][i] = XBYTE[i + 0x88B5];
 234   2                      inter_reg[1][i] = XBYTE[i + 0x8AB5];
 235   2                      if (start_flg[0] == 0){
 236   3                              inter_reg[2][i] = f2rc7860_rd(i + 0x00B5);
 237   3                              inter_reg[3][i] = f2rc7860_rd(i + 0x02B5);
 238   3                      }
 239   2              }
 240   1              for (i = 0; i <= 7; i++){                               //取出63个时隙的AIS寄存器值
C51 COMPILER V7.50   TEST                                                                  03/10/2006 16:35:17 PAGE 5   

 241   2                      ais_reg[0][i] = XBYTE[i + 0x88A6];
 242   2                      ais_reg[1][i] = XBYTE[i + 0x8AA6];
 243   2                      if (start_flg[0] == 0){
 244   3                              ais_reg[2][i] = f2rc7860_rd(i + 0x00A6);
 245   3                              ais_reg[3][i] = f2rc7860_rd(i + 0x02A6);
 246   3                      }
 247   2              }
 248   1      
 249   1      //      test_reg[0] += 1;                                               //中断响应次数计数
 250   1      //      temp1 = int_reg & 0x10;                                 //取出A光口中AIS的中断值
 251   1      //      if (int_reg){
 252   1      //              test_reg[1] += 1;                                       //中断向量不为零的计数
 253   1      //      }
 254   1      //      if (temp1){ 
 255   1      //              test_reg[2] += 1;                                       //中断向量中A光口出现AIS的中断计数
 256   1      //      }
 257   1      
 258   1              temp = int_reg & 0xF0;                                  //取出A光口中断值
 259   1              if (temp){                                                              //判断A光口有中断信号
 260   2                      for (i = 0; i <= 7; i++){                       //取出63个时隙的AIS寄存器值
 261   3                              ais_reg[0][i] |= XBYTE[i + 0x88A6];
 262   3                      }
 263   2                      temp = inter_reg[0][0] & 0xDA;          //得到满足误码秒的条件
 264   2                      temp1 = inter_reg[0][2] & 0xE0;
 265   2                      temp2 = inter_reg[0][3] & 0x80;
 266   2                      if (temp | temp1 | temp2){
 267   3                              intflg_MCBA = 1;                                //计算误码秒的标志位
 268   3                      }
 269   2                      if (inter_reg[0][0] != 0){
 270   3                              Intmask0_a = inter_reg[0][0];
 271   3                              inter_reg[0][0] &= 0xD0;                //取出可发生自动倒换的bit位
 272   3                              if (inter_reg[0][0] != 0){
 273   4                                      init_recover[0] = 1;
 274   4                                      path_switch_mcba();
 275   4      //                              SetExtRdyTbl(1);
 276   4                              }
 277   3                      }
 278   2                      if (inter_reg[0][1] != 0){
 279   3                              Intmask1_a = inter_reg[0][1];
 280   3                      }
 281   2                      if (inter_reg[0][2] != 0){
 282   3                              Intmask2_a = inter_reg[0][2];
 283   3                              inter_reg[0][2] &= 0xE0;
 284   3                              if (inter_reg[0][2] != 0){
 285   4                                      init_recover[0] = 1;
 286   4                                      path_switch_mcba();
 287   4      //                              SetExtRdyTbl(1);
 288   4                              }
 289   3                      }
 290   2                      if (inter_reg[0][3] != 0){
 291   3      //                      Intmask3_a = judge3;
 292   3                              inter_reg[0][3] &= 0x80;
 293   3                              if (inter_reg[0][3] != 0){
 294   4      //                              test_reg[3] += 1;
 295   4                                      init_recover[0] = 1;
 296   4                                      path_switch_mcba_tu();
 297   4                                      SetExtRdyTbl(2);
 298   4                              }
 299   3                      }
 300   2                      clk_check_flg[0] = 1;                           //置位时钟频偏标志位
 301   2              }
 302   1      
C51 COMPILER V7.50   TEST                                                                  03/10/2006 16:35:17 PAGE 6   

 303   1      //      temp1 = int_reg & 0x01;
 304   1      //      if (temp1){
 305   1      //              test_reg[5] += 1;
 306   1      //      }               
 307   1              temp = int_reg & 0x0F;
 308   1              if (temp){
 309   2                      for (i = 0; i <= 7; i++){                       //取出B光口63个时隙的AIS寄存器值
 310   3                              ais_reg[1][i] |= XBYTE[i + 0x8AA6];
 311   3                      }
 312   2                      temp = inter_reg[1][0] & 0xDA;
 313   2                      temp1 = inter_reg[1][2] & 0xE0;
 314   2                      temp2 = inter_reg[1][3] & 0x80;
 315   2                      if (temp | temp1 | temp2){
 316   3                              intflg_MCBB = 1;
 317   3                              clk_check_flg[0] = 1;
 318   3                      }
 319   2                      if (inter_reg[1][0] != 0){
 320   3                              Intmask0_b = inter_reg[1][0];
 321   3                              inter_reg[1][0] &= 0xD0;                //取出可发生自动倒换的bit位
 322   3                              if (inter_reg[1][0] != 0){
 323   4                                      init_recover[1] = 1;
 324   4                                      path_switch_mcbb();
 325   4      //                              SetExtRdyTbl(3);
 326   4                              }
 327   3                      }
 328   2                      if (inter_reg[1][1] != 0){
 329   3                              Intmask1_b = inter_reg[1][1];
 330   3                      }
 331   2                      if (inter_reg[1][2] != 0){
 332   3                              Intmask2_b = inter_reg[1][2];
 333   3                              inter_reg[1][2] &= 0xE0;
 334   3                              if (inter_reg[1][2] != 0){
 335   4                                      init_recover[1] = 1;
 336   4                                      path_switch_mcbb();
 337   4      //                              SetExtRdyTbl(3);
 338   4                              }
 339   3                      }
 340   2                      if (inter_reg[1][3] != 0){
 341   3      //                      Intmask3_b = judge3;
 342   3                              inter_reg[1][3] &= 0x80;
 343   3                              if (inter_reg[1][3] != 0){
 344   4                                      init_recover[1] = 1;
 345   4                                      path_switch_mcbb_tu();
 346   4                                      SetExtRdyTbl(4);
 347   4      //                              test_reg[6] += 1;
 348   4                              }
 349   3                      }
 350   2                      clk_check_flg[0] = 1;                           //置位时钟频偏标志位
 351   2              }
 352   1      
 353   1      //      Rdint_clr = 0x40;                                               //清除MCB盘的Ia3_a与Ia3_b中断位
 354   1      
 355   1              if (f2rc7820_rd(F2Int_reg)){
 356   2                      f2rc7820_wr(F2Encrypt_reg,0xAA);                //open 7820 write reg
 357   2                      f2rc7820_wr(F2Intmask_reg,0xFF);
 358   2              }
 359   1      
 360   1              if (f2int_reg){
 361   2                      if (start_flg[0] == 1){
 362   3                              f2rc7860_wr(F2Reg_protect,0xAA);        //open 7860 write reg protect
 363   3                      }
 364   2                      else{
C51 COMPILER V7.50   TEST                                                                  03/10/2006 16:35:17 PAGE 7   

 365   3                              f2rc7860_wr(F2Int_mask,0x80);
 366   3                              if (f2int_reg & 0xF0){                          //光分支盘A口中断处理
 367   4                                      for (i = 0; i <= 7; i++){               //取出光分支A口63个时隙的AIS寄存器值
 368   5                                              ais_reg[2][i] |= f2rc7860_rd(i + 0x00A6);
 369   5                                      }
 370   4                                      if ((inter_reg[2][0] & 0xDA) | (inter_reg[2][2] & 0xE0) | (inter_reg[2][3] & 0x80)){
 371   5                                              intflg_OTBA = 1;
 372   5                                      }
 373   4                                      if (inter_reg[2][0] != 0){
 374   5                                              f2rc7860_wr(F2Intmask0_a,inter_reg[2][0]);
 375   5                                              inter_reg[2][0] &= 0xD0;        //取出可发生自动倒换的bit位
 376   5                                              if (inter_reg[2][0] != 0){
 377   6                                                      init_recover[2] = 1;
 378   6                                                      path_switch_otba();
 379   6              //                                      SetExtRdyTbl(5);
 380   6                                              }
 381   5                                      }
 382   4                                      if (inter_reg[2][1] != 0){
 383   5                                              f2rc7860_wr(F2Intmask1_a,inter_reg[2][1]);
 384   5              //                              judge1 &= 0xF0;
 385   5              //                              if (judge1 != 0){
 386   5              //                                      SetExtRdyTbl(5);
 387   5              //                                      path_switch_otba();
 388   5              //                              }
 389   5                                      }
 390   4                                      if (inter_reg[2][2] != 0){

⌨️ 快捷键说明

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