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

📄 main.lst

📁 Keil 下编译的基于mcs51单片机的PCA82C250CAN收发器控制的程序源代码。
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   MAIN                                                                  10/23/2004 16:55:18 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN Main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE Main.c OPTIMIZE(4,SPEED) BROWSE MOD517(NOAU) DEBUG OBJECTEXTEND

stmt level    source

   1          //****************************************************************************
   2          // @Module        Main
   3          // @Filename     MAIN.C
   4          // @Project       lac_can.dav
   5          //----------------------------------------------------------------------------
   6          // @Controller    Infineon C505C-2R
   7          //
   8          // @Compiler      Keil
   9          //
  10          // @Codegenerator DAvE 2-0-0
  11          //
  12          // @Description   This file contains the project initialization function
  13          //                
  14          //
  15          //----------------------------------------------------------------------------
  16          // @Date          01-2-24 12:51:12
  17          //
  18          //****************************************************************************
  19          //****************************************************************************
  20          // @Project Includes
  21          //****************************************************************************
  22          #include "MAIN.H"
  23          #include "PER.H"
  24          #include "CAN.H"
  25          #include "INT.H"
  26          #include "MSGTABLE.H"
  27          //****************************************************************************
  28          // @variable definition
  29          //****************************************************************************
  30          unsigned char xdata MsgTrans[20][8];  //message translated buffer
  31          unsigned char xdata diagnostic[8];
  32          bit ReceivedFlag;                  //receive ok flag
  33          bit TurnLeft,TurnRight;
  34          unsigned char xdata  * p;
  35          
  36          unsigned char xdata CANSendCTimer=3;
  37          ////RS232 communication //////////////
  38          bit NewReceive;//if a character is received,set this flag
  39          unsigned int  xdata ReceiveTimer=0;//receive delay timer between two character
  40          unsigned char xdata ReceiveBuffer[RXD_MAX_NUM];//
  41          unsigned char xdata SendBuffer[TXD_MAX_NUM];
  42          unsigned char xdata ReceiveCounter=0;
  43          unsigned char xdata SendCounter=0;
  44          bit NewCommand=0;//if a command have been received ,set this flag to indicator
  45                                          //the command is processing
  46          unsigned char xdata SendNumber=0;//need sending byte number
  47          unsigned char xdata SendLoop=1;
  48          unsigned char xdata SendTimer=0;
  49          unsigned int xdata HaveSignalTimer[2]={0,0};
  50          bit ReceiveRight=0;
  51          bit NoSignal1;
  52          bit NoSignal2;
  53          /////////////////////////////////////////////////////////////////////////////////
  54          unsigned int xdata EngineSpeed=0;
  55          unsigned int xdata VehicleSpeedAngle=0;//stepping motor rotating angle
C51 COMPILER V7.06   MAIN                                                                  10/23/2004 16:55:18 PAGE 2   

  56          unsigned int xdata VehicleSpeed=0;//run speed
  57          unsigned int xdata EngineSpeedArray[5]={0,0,0,0,0};
  58          unsigned int xdata VehicleSpeedAngleArray[5]={0,0,0,0,0};
  59          unsigned int xdata EngineSpeedAverge=0;
  60          unsigned int xdata EnginefreAverge=0;
  61          
  62          
  63          
  64          unsigned int xdata WaterT=0;
  65          unsigned int xdata WaterT1=0;
  66          bit WaterTAlarm;//if water temperature is high than 100 degree,set the bit
  67          unsigned char xdata FuelQ=0;
  68          bit FuelAlarm;//fuel quantiy alarm flag
  69          unsigned char xdata EnvironmentT[2]={0,0};
  70          //unsigned char xdata SingleMileage[5];
  71          //unsigned char xdata TotalMileage[6];
  72          unsigned char xdata RunTime=0;
  73          unsigned char xdata FuelUse=0;
  74          unsigned char xdata RunErrorTimes=0;
  75          //unsigned char xdata RunMileage[4];
  76          unsigned char xdata WaterTTemp=0;//temp calculate result for filter
  77          unsigned char xdata Water1TTemp=0;//temp calculate result for filter
  78          unsigned char xdata FuelQTemp=0;//temp calculate result for filter
  79          /////////////////////////////////////////////////////////////////////////////////
  80          unsigned char xdata * ExamCodePointer;
  81          unsigned char xdata  ErrorDataLength=0;
  82          unsigned char xdata lamp[2]={0,0};//indication lamp
  83          unsigned char xdata lamp0[5]={0,0,0,0,0};//20040922
  84          unsigned char xdata lamp1[5]={0,0,0,0,0};//indication lamp
  85          
  86          unsigned char xdata SwitchBuffer[2]={0,0};//
  87          unsigned int xdata fre1=0;
  88          unsigned int xdata fre2=0;
  89          unsigned int xdata fre2cal=0;
  90          unsigned char KeyBuffer=0;
  91          unsigned char xdata bcd[6]={0,0,0,0,0,0};
  92          unsigned char xdata GateTimer=0;
  93          unsigned int xdata fre[4]={0,0,0,0};
  94          
  95          float temp=0;
  96          unsigned char Send_count=0;
  97          unsigned char Send_count1=0;
  98          unsigned char Send_count2=0;
  99          unsigned char Send_obj=0;
 100          unsigned char Send_data=0;
 101          //////////////////////////////////////////////////////////////////////////////////
 102          unsigned int code WaterTSensorTable[81]={ 23,  24,  25,  25,  26,  27,  28,  29,  30,  31,  31,  32,  33, 
             - 34,  35,  35,  36,  37,  38,  39,  39,  41,  43,  44,  45,  46,  48,  49,  51,  53,  54,  56,  58,  60,  61,  62,  63, 
             - 65,  67,  68,  69,  71,  73,  75,  77,  79,  81,  83,  85,  88,  91,  94,  97,  100, 103, 107, 110, 113, 115, 118, 120,
             - 126, 132, 137, 142, 148, 153, 158, 163, 168, 173, 181, 190, 198, 206, 215, 229, 244, 258, 273, 287};
 103          unsigned char code WaterTTable[81]= {     120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108,
             - 107, 106, 105, 104, 103, 102, 101, 100, 99,  98,  97,  96,  95,  94,  93,  92,  91,  90,  89,  88,  87,  86,  85,  84, 
             - 83,  82,  81,  80,  79,  78,  77,  76,  75,  74,  73,  72,  71,  70,  69,  68,  67,  66,  65,  64,  63,  62,  61,  60, 
             - 59,  58,  57,  56,  55,  54,  53,  52,  51,  50,  49,  48,  47,  46,  45,  44,  43,  42,  41,  40};
 104          unsigned int code Water1TSensorTable[81]={ 57,  61,  65,  69,  73,  77,  81,  85,  89,  93,  97,  103,  10
             -7,  111,  115,  119,  123,  127,  131,  135,  139,  143,  147,  160,  175,  185,  195,  205,  215,  225,  235,  250,  26
             -5,  280,  295,  310,  325,  340,  355,  370,  385,  400,  415,  430,  445,  460,  475,  490,  505,  520,  535,  550,  56
             -5,  580, 595, 610, 625, 640, 655, 670, 685, 700, 715, 730, 760, 800, 840, 900, 960, 1000, 1000, 1000, 1000, 1000, 1000, 
             -1000, 1000, 1000, 1000, 1000, 1000};
 105          unsigned char code Water1TTable[81]= {     150, 148, 146, 144, 142, 140, 138, 136, 134, 132, 130, 128, 126
             -, 124, 122, 120, 118, 116, 114, 112, 110, 109,  108,  107,  106,  104,  102,  100,  98,  96,  94,  92,  90,  87,  86,  8
             -5,  84,  83,  82,  81,  80,  79,  78,  77,  76,  75,  74,  73,  72,  71,  70,  69,  68,  67,  66,  65,  64,  63,  62,  6
C51 COMPILER V7.06   MAIN                                                                  10/23/2004 16:55:18 PAGE 3   

             -1,  60,  59,  58,  57,  56,  55,  54,  53,  52,  51,  50,  49,  48,  47,  46,  44,  40,  40,  40,  40,  40};
 106          unsigned int xdata ADValue[8][8]={{0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff,0x3ff},{0,0,0,0,0,0,0,0}};
 107          unsigned int xdata ADResult;
 108          unsigned char xdata ADTimer;
 109          float SensorValue;
 110          
 111          unsigned char xdata SingleM;
 112          float xdata TotalM;
 113          unsigned char PowerOnTimer=0;
 114          bit PowerOn=0;
 115          
 116          float xdata StartVelocity;//start velocity per 10s
 117          float xdata EndVelocity;//end velocity per 10s
 118          float xdata MileageUnit;//mileague of 10s 
 119          float xdata RunMileage;//mileage from engine starting to engine stopping
 120          float xdata SingleMileage;//mileage from last clearing
 121          float xdata TotalMileage;//total mileage
 122          unsigned char xdata MileageTimer=0;//1s timer for calculating mileage
 123          bit EngineStart;//engine start flag
 124          unsigned int xdata SaveTimer;//10min auto save timer
 125          bit SaveFlag;//
 126          unsigned int xdata SlaveTimer1;//if slave have sent right message clear the timer
 127          unsigned int xdata SlaveTimer2;//else if the counter value is more enought ,reset system
 128          
 129          //unsigned char xdata ErrorCodeTimes[30];//error code times,if no error ErrorCodeTimes[]=0
 130                                                                          //else ErrorCodeTimes[]++,if ErrorCodeTimes[]>ERROR_TIMES
 131                                                                          //set the error bit
 132          unsigned int xdata ClearDelayTimer1=0;//clear error code delay timer
 133          unsigned int xdata ClearDelayTimer2=0;//clear single mileage delay timer
 134          unsigned char xdata ClearOnTimer1=0;//clear switch on times
 135          unsigned char xdata ClearOnTimer2=0;
 136          bit ClearErrorFlag;
 137          bit ClearMileageFlag;
 138          unsigned char T0IntCounter;
 139          unsigned char TH0Buffer;
 140          unsigned char TL0Buffer;
 141          unsigned char T0IntBuffer;
 142          unsigned char EX1OffTimer;
 143          bit EX1IntFlag;
 144          unsigned char Fre2CalTimer;
 145          bit Fre2CalFlag;
 146          unsigned int xdata FuelQTimer;
 147          unsigned int xdata WaterTimer;
 148          bit  cantransflag=0;
 149          ////////////////////////////////数据滤波处理地址定义////////////////////////////
 150          unsigned char  xdata  rainfilter0;
 151          unsigned char  xdata  rainfilter1;
 152          unsigned char  xdata  rainfilter2;
 153          unsigned char  xdata  rainfilter3;
 154          bit      rainfil0=0;
 155          bit      rainfil1=0;
 156          //****************************************************************************
 157          // @funtion definition
 158          //****************************************************************************
 159          
 160          //****************************************************************************
 161          //@function:    void delay(unsigned int time);
 162          //@description: run this funtion code delay time(ms).
 163          //@parameter:   "time" is the delay time ,unit ms.
 164          //@return:none.
 165          //**************************************************************************** 
 166          void delay(unsigned int time)
C51 COMPILER V7.06   MAIN                                                                  10/23/2004 16:55:18 PAGE 4   

 167          {
 168   1         unsigned int delay1,delay2;
 169   1         for(delay1=0;delay1<=time;delay1++)     
 170   1         {
 171   2            for(delay2=0;delay2<=150;delay2++)     //1ms delay
 172   2            {
 173   3               cs5045=0;
 174   3                       _nop_();
 175   3                       cs5045=1;
 176   3                       wdt_refresh();
 177   3            }
 178   2         }
 179   1      }
 180          
 181          //***************************************************************************
 182          //@Function:      void Hex_to_ASC(unsigned char * HexP,unsigned char * ASCP);
 183          //@description:   This function change one byte hex to 2 byte ASCII code
 184          //                first byte is high location
 185          //@parameter:     Hexp---pointer for hex data; ASCP------pointer for ASC data
 186          //@return:        none
 187          //***************************************************************************
 188          void Hex_to_ASC(unsigned char * HexP,unsigned char * ASCP)
 189          {

⌨️ 快捷键说明

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