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

📄 int.lst

📁 Keil 下编译的基于mcs51单片机的PCA82C250CAN收发器控制的程序源代码。
💻 LST
📖 第 1 页 / 共 2 页
字号:
 213   4                                      ;
 214   4                      }
 215   3                      break;
 216   3                  case 4:                      //-----Message Object 2 interrupt  ------
 217   3                              set_msg_MCR(2,INTPND,0); //reset INTPND
 218   3                      
 219   3                      if(can_status & 0x08)    //transmit interrupt
 220   3                      {
 221   4                          ; 
 222   4                      }
 223   3                      if(can_status & 0x10)    //receive interrupt
 224   3                      { 
 225   4                              //CAN_vStoreMsgObj(2,p);//save the received data to buffer 
 226   4                          //set_msg_MCR(2,NEWDAT,0);        //reset NEWDAT.
 227   4      //                                      CAN_vStoreID(2,IDArray);//save id inorder to judge whether 
 228   4                                      //the module is exist,but feed back id don't store
 229   4                         // ReceivedFlag=1;          //indicate that communication is proper. 
 230   4                                              //cantransflag=1;
 231   4      //                    ErrorTimes=0;
 232   4                                      ;
 233   4                      }
 234   3                      break;
 235   3                              case 5:                      //-----Message Object 3 interrupt  ------
 236   3                              set_msg_MCR(3,INTPND,0); //reset INTPND
 237   3                      
 238   3                      if(can_status & 0x08)    //transmit interrupt
 239   3                      {
 240   4                          ; 
 241   4                      }
C51 COMPILER V7.06   INT                                                                   10/23/2004 16:55:18 PAGE 5   

 242   3                      if(can_status & 0x10)    //receive interrupt
 243   3                      { 
 244   4                          CAN_vStoreMsgObj(2,p);//save the received data to buffer 
 245   4                          set_msg_MCR(2,NEWDAT,0);        //reset NEWDAT.
 246   4      //                                      CAN_vStoreID(2,IDArray);//save id inorder to judge whether 
 247   4                                      //the module is exist,but feed back id don't store
 248   4                          ReceivedFlag=1;          //indicate that communication is proper.
 249   4                                              cantransflag=1;
 250   4      //                    ErrorTimes=0;
 251   4                                      ;
 252   4                      }
 253   3                      break;
 254   3                              case 6:                      //-----Message Object 4 interrupt  ------
 255   3                              set_msg_MCR(4,INTPND,0); //reset INTPND
 256   3                      
 257   3                      if(can_status & 0x08)    //transmit interrupt
 258   3                      {
 259   4                          ; 
 260   4                      }
 261   3                      if(can_status & 0x10)    //receive interrupt
 262   3                      { 
 263   4                         CAN_vStoreMsgObj(2,p);//save the received data to buffer 
 264   4                         set_msg_MCR(2,NEWDAT,0);        //reset NEWDAT.
 265   4      //                                      CAN_vStoreID(2,IDArray);//save id inorder to judge whether 
 266   4                                      //the module is exist,but feed back id don't store
 267   4                         ReceivedFlag=1;          //indicate that communication is proper. 
 268   4                                         cantransflag=1;
 269   4      //                    ErrorTimes=0;
 270   4                                      ;
 271   4                      }
 272   3                      break;
 273   3                                      case 7:                      //-----Message Object 5 interrupt  ------
 274   3                              set_msg_MCR(5,INTPND,0); //reset INTPND
 275   3                      
 276   3                      if(can_status & 0x08)    //transmit interrupt
 277   3                      {
 278   4                          ; 
 279   4                      }
 280   3                      if(can_status & 0x10)    //receive interrupt
 281   3                      { 
 282   4                         // CAN_vStoreMsgObj(2,p);//save the received data to buffer 
 283   4                         //set_msg_MCR(2,NEWDAT,0);        //reset NEWDAT.
 284   4      //                                      CAN_vStoreID(2,IDArray);//save id inorder to judge whether 
 285   4                                      //the module is exist,but feed back id don't store
 286   4                         //ReceivedFlag=1;          //indicate that communication is proper. 
 287   4                                         //cantransflag=1;
 288   4      //                    ErrorTimes=0;
 289   4                                      ;
 290   4                      }
 291   3                      break;
 292   3                      default :
 293   3                      break;
 294   3              }
 295   2          }
 296   1      }
 297          
 298          
 299          void INT_T2(void) interrupt TIMER2 //20ms interrupt once 
 300          {   
 301   1          TF2=0;                  //initial count value
 302   1              TH2=T2_TH;
 303   1              TL2=T2_TL;
C51 COMPILER V7.06   INT                                                                   10/23/2004 16:55:18 PAGE 6   

 304   1      
 305   1              if(SendTimer<0xff)
 306   1              {
 307   2                      SendTimer++;
 308   2              }  
 309   1      
 310   1              if(ADTimer!=0)
 311   1              {
 312   2                      ADTimer--;
 313   2              }
 314   1              if(PowerOnTimer<50)
 315   1              {
 316   2                      PowerOnTimer++;
 317   2              }
 318   1              else
 319   1              {
 320   2                      PowerOn=1;
 321   2              }
 322   1              
 323   1              if(MileageTimer!=0)
 324   1              {
 325   2                      MileageTimer--;
 326   2              }
 327   1      
 328   1      //      if(SlaveTimer1<1000)
 329   1      //      {
 330   1      //              SlaveTimer1++;
 331   1      //      }
 332   1      //      else
 333   1      //      {
 334   1      //              SlaveTimer1=0;
 335   1      //              if(PowerOn)
 336   1      //              {
 337   1      //                      ;//for(;;);
 338   1      //              }
 339   1      //      }
 340   1      //
 341   1      //      if(SlaveTimer2<1000)
 342   1      //      {
 343   1      //              SlaveTimer2++;
 344   1      //      }
 345   1      //      else
 346   1      //      {
 347   1      //              SlaveTimer2=0;
 348   1      //              if(PowerOn)
 349   1      //              {
 350   1      //                      ;//for(;;);
 351   1      //              }
 352   1      //      }
 353   1              if(ClearDelayTimer1!=0)
 354   1              {
 355   2                      ClearDelayTimer1--;
 356   2              }
 357   1              if(ClearDelayTimer2!=0)
 358   1              {
 359   2                      ClearDelayTimer2--;
 360   2              }
 361   1      
 362   1              if(ClearErrorFlag)
 363   1              {
 364   2                      if(ClearOnTimer1<50)
 365   2                      {
C51 COMPILER V7.06   INT                                                                   10/23/2004 16:55:18 PAGE 7   

 366   3                              ClearOnTimer1++;
 367   3                      }
 368   2              }
 369   1              
 370   1              if(ClearMileageFlag)
 371   1              {
 372   2                      if(ClearOnTimer2<50)
 373   2                      {
 374   3                              ClearOnTimer2++;
 375   3                      }
 376   2              }
 377   1              if(EX1OffTimer!=0)
 378   1              {
 379   2                      EX1OffTimer--;
 380   2              }
 381   1              else
 382   1              {
 383   2                      EX1=1;
 384   2                      IT1=1;
 385   2              }
 386   1              if(Fre2CalTimer!=0)
 387   1              {
 388   2                      Fre2CalTimer--;
 389   2              }
 390   1                      Send_count2++;
 391   1              if(Send_count2>50)
 392   1                      {
 393   2                      Send_count2=0;
 394   2                      cantransflag=0;
 395   2                      }
 396   1              //=================CAN总线数据发送
 397   1         
 398   1                      Send_count++;
 399   1              if(Send_count>4)
 400   1                      {
 401   2                      Send_count=0;
 402   2                      }
 403   1                      Send_count=0;
 404   1              if (Send_count==0)//20ms发送一次
 405   1              { Send_obj=1;
 406   2                Send_data=_C_111XM;}
 407   1                 else if (Send_count==1)
 408   1                      {  Send_obj=3;
 409   2                         Send_data=_C_111XM+1;}
 410   1                     else     if (Send_count==2)
 411   1                              { Send_obj=4;
 412   2                                  Send_data=_C_111XM+2;}
 413   1                       else   if (Send_count==3)
 414   1                              { Send_obj=5;
 415   2                                  Send_data=_C_111XM+3;}
 416   1                                                      else    if (Send_count==4)
 417   1                              { Send_obj=6;
 418   2                                  Send_data=_C_111XM+4;}
 419   1              
 420   1                      if(CAN_bRequestMsgObj(Send_obj))
 421   1              {       Send_count1++;
 422   2                              if(Send_count1>6)
 423   2                              {
 424   3                              Send_count1=1;
 425   3                              }
 426   2                      CAN_vConfigMsgObj(Send_obj,Send_data,MsgTrans[Send_count1]); //load data to the message object
 427   2                              CAN_vTransmit(Send_obj);                  //request transmit.
C51 COMPILER V7.06   INT                                                                   10/23/2004 16:55:18 PAGE 8   

 428   2                      
 429   2                      }
 430   1        
 431   1      //===================CAN总线数据发送程序结

⌨️ 快捷键说明

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