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

📄 can.lst

📁 本程序是针对Infineon公司的XC167CI处理器而编写的CAN网络程序。CAN(控制局域网)协议是一种广泛的应用于汽车电子的网络协议。本程序建立了三个CAN节点
💻 LST
📖 第 1 页 / 共 4 页
字号:
  739  2          {
  740  3            if(CAN_RXIPNDL & CAN_RXIPNDL_RXIPND0)   // message object 0 receive interrupt
  741  3            {
  742  4      
  743  4              if((CAN_HWOBJ[0].uwMSGCTR & 0x0300) == 0x0200)     // if NEWDAT is set
  744  4              {
  745  5      
  746  5                if ((CAN_HWOBJ[0].uwMSGCTR & 0x0c00) == 0x0800)  // if MSGLST is set
  747  5                {
  748  6                  // Indicates that the CAN controller has stored a new 
  749  6                  // message into this object, while NEWDAT was still set,
  750  6                  // ie. the previously stored message is lost.
  751  6      
  752  6                  CAN_HWOBJ[0].uwMSGCTR = 0xf7ff;  // reset MSGLST
  753  6      
  754  6                  // USER CODE BEGIN (SRN0_OBJ0,1)
  755  6      
  756  6                  // USER CODE END
  757  6                }
  758  5                else
  759  5                {
  760  6                  // The CAN controller has stored a new message
  761  6                  // into this object.
  762  6      
  763  6                  // USER CODE BEGIN (SRN0_OBJ0,2)
  764  6                                、、// 用指示灯来指示通信成功
*** ERROR C16 IN LINE 764 OF CAN.C: unprintable character 0xA1 skipped
*** ERROR C16 IN LINE 764 OF CAN.C: unprintable character 0xA2 skipped
*** ERROR C16 IN LINE 764 OF CAN.C: unprintable character 0xA1 skipped
*** ERROR C16 IN LINE 764 OF CAN.C: unprintable character 0xA2 skipped
  765  6                                 P1L=0xfe;
  766  6                                 for(i=0;i<0xffff;i++);
  767  6                                 P1L=0xff;
  768  6                              
  769  6                  // USER CODE END
  770  6                }
  771  5      
  772  5                CAN_HWOBJ[0].uwMSGCTR = 0xfdff;    // reset NEWDAT
  773  5              }
  774  4      
  775  4            }  // End of RXIPND0
  776  3      
  777  3      
  778  3            CAN_HWOBJ[0].uwMSGCTR = 0xfffd;        // reset INTPND
  779  3      
  780  3            // USER CODE BEGIN (SRN0_OBJ0,6)
  781  3      
  782  3            // USER CODE END
  783  3      
  784  3          }
  785  2      
  786  2      
  787  2          // USER CODE BEGIN (SRN0,3)
  788  2      
  789  2          // USER CODE END
  790  2      
  791  2      
  792  2        }  // End of while()
  793  1      
  794  1        // USER CODE BEGIN (SRN0,7)
  795  1      
C166 COMPILER V6.04, CAN                                                                   12/10/2006 20:50:28 PAGE 14  

  796  1        // USER CODE END
  797  1      
  798  1      } //  End of function CAN_viSRN0
  799         
  800         
  801         //****************************************************************************
  802         // @Function      void CAN_viSRN1(void) 
  803         //
  804         //----------------------------------------------------------------------------
  805         // @Description   This is the interrupt service routine for the Service 
  806         //                Request Node 1 of the TwinCAN module.
  807         //
  808         //----------------------------------------------------------------------------
  809         // @Returnvalue   None
  810         //
  811         //----------------------------------------------------------------------------
  812         // @Parameters    None
  813         //
  814         //----------------------------------------------------------------------------
  815         // @Date          2006-12-10
  816         //
  817         //****************************************************************************
  818         
  819         // USER CODE BEGIN (SRN1,1)
  820         
  821         // USER CODE END
  822         
  823         void CAN_viSRN1(void) interrupt CAN_SRN1INT
  824         {
  825  1      
  826  1        // USER CODE BEGIN (SRN1,2)
  827  1      
  828  1        // USER CODE END
  829  1      
  830  1        while((( ((ulong)CAN_TXIPNDH << 16) + CAN_TXIPNDL) & 0x00000002))
  831  1        {
  832  2      
  833  2          // message object 1 interrupt
  834  2      
  835  2          if((CAN_HWOBJ[1].uwMSGCTR & 0x0003) == 0x0002)         // if INTPND 
  836  2          {
  837  3            if(CAN_TXIPNDL & CAN_TXIPNDL_TXIPND1)   // message object 1 transmit interrupt
  838  3            {
  839  4      
  840  4              // The transmission of the last message object
  841  4              // was successful.
  842  4      
  843  4              // USER CODE BEGIN (SRN1_OBJ1,4)
  844  4                               P1L=0x7f;;
  845  4                                 for(i=0;i<0xffff;i++);
  846  4                                 P1L=0xff;
  847  4                                  
  848  4              // USER CODE END
  849  4      
  850  4              CAN_HWOBJ[1].uwMSGCTR = 0xfdff;      // reset NEWDAT
  851  4      
  852  4            }  // End of TXIPND1
  853  3      
  854  3            CAN_HWOBJ[1].uwMSGCTR = 0xfffd;        // reset INTPND
  855  3      
  856  3            // USER CODE BEGIN (SRN1_OBJ1,6)
  857  3      
C166 COMPILER V6.04, CAN                                                                   12/10/2006 20:50:28 PAGE 15  

  858  3            // USER CODE END
  859  3      
  860  3          }
  861  2      
  862  2      
  863  2          // USER CODE BEGIN (SRN1,3)
  864  2      
  865  2          // USER CODE END
  866  2      
  867  2      
  868  2        }  // End of while()
  869  1      
  870  1        // USER CODE BEGIN (SRN1,7)
  871  1      
  872  1        // USER CODE END
  873  1      
  874  1      } //  End of function CAN_viSRN1
  875         
  876         
  877         //****************************************************************************
  878         // @Function      void CAN_viSRN2(void) 
  879         //
  880         //----------------------------------------------------------------------------
  881         // @Description   This is the interrupt service routine for the Service 
  882         //                Request Node 2 of the TwinCAN module.
  883         //
  884         //----------------------------------------------------------------------------
  885         // @Returnvalue   None
  886         //
  887         //----------------------------------------------------------------------------
  888         // @Parameters    None
  889         //
  890         //----------------------------------------------------------------------------
  891         // @Date          2006-12-10
  892         //
  893         //****************************************************************************
  894         
  895         // USER CODE BEGIN (SRN2,1)
  896         
  897         // USER CODE END
  898         
  899         void CAN_viSRN2(void) interrupt CAN_SRN2INT
  900         {
  901  1      
  902  1        // USER CODE BEGIN (SRN2,2)
  903  1      
  904  1        // USER CODE END
  905  1      
  906  1        while((( ((ulong)CAN_RXIPNDH << 16) + CAN_RXIPNDL) & 0x00000004))
  907  1        {
  908  2      
  909  2          // message object 2 interrupt
  910  2      
  911  2          if((CAN_HWOBJ[2].uwMSGCTR & 0x0003) == 0x0002)         // if INTPND 
  912  2          {
  913  3            if(CAN_RXIPNDL & CAN_RXIPNDL_RXIPND2)   // message object 2 receive interrupt
  914  3            {
  915  4      
  916  4              if((CAN_HWOBJ[2].uwMSGCTR & 0x0300) == 0x0200)     // if NEWDAT is set
  917  4              {
  918  5      
  919  5                if ((CAN_HWOBJ[2].uwMSGCTR & 0x0c00) == 0x0800)  // if MSGLST is set
C166 COMPILER V6.04, CAN                                                                   12/10/2006 20:50:28 PAGE 16  

  920  5                {
  921  6                  // Indicates that the CAN controller has stored a new 
  922  6                  // message into this object, while NEWDAT was still set,
  923  6                  // ie. the previously stored message is lost.
  924  6      
  925  6                  CAN_HWOBJ[2].uwMSGCTR = 0xf7ff;  // reset MSGLST
  926  6      
  927  6                  // USER CODE BEGIN (SRN2_OBJ2,1)
  928  6      
  929  6                  // USER CODE END
  930  6                }
  931  5                else
  932  5                {
  933  6                  // The CAN controller has stored a new message
  934  6                  // into this object.
  935  6      
  936  6                  // USER CODE BEGIN (SRN2_OBJ2,2)
  937  6                              、// 用指示灯来指示通信成功
*** ERROR C16 IN LINE 937 OF CAN.C: unprintable character 0xA1 skipped
*** ERROR C16 IN LINE 937 OF CAN.C: unprintable character 0xA2 skipped
  938  6                                       P1L=0xfd;
  939  6                                 for(i=0;i<0xffff;i++);
  940  6                                 P1L=0xff;
  941  6                  // USER CODE END
  942  6                }
  943  5      
  944  5                CAN_HWOBJ[2].uwMSGCTR = 0xfdff;    // reset NEWDAT
  945  5              }
  946  4      
  947  4            }  // End of RXIPND2
  948  3      
  949  3      
  950  3            CAN_HWOBJ[2].uwMSGCTR = 0xfffd;        // reset INTPND
  951  3      
  952  3            // USER CODE BEGIN (SRN2_OBJ2,6)
  953  3      
  954  3            // USER CODE END
  955  3      
  956  3          }
  957  2      
  958  2      
  959  2          // USER CODE BEGIN (SRN2,3)
  960  2      
  961  2          // USER CODE END
  962  2      
  963  2      
  964  2        }  // End of while()
  965  1      
  966  1        // USER CODE BEGIN (SRN2,7)
  967  1      
  968  1        // USER CODE END
  969  1      
  970  1      } //  End of function CAN_viSRN2
  971         
  972         
  973         
  974         // USER CODE BEGIN (CAN_General,10)
  975         
  976         // USER CODE END
  977         

C166 COMPILATION COMPLETE.  0 WARNING(S),  6 ERROR(S)

⌨️ 快捷键说明

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