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

📄 simboard.lst

📁 单片机与DSP通信源程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   SIMBOARD                                                              04/07/2006 23:20:55 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE SIMBOARD
OBJECT MODULE PLACED IN SimBoard.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SimBoard.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "52init.h"
   2          #include "iic.h"
   3          #include "Lcd.h"
   4          //#include "inittable.h"
   5          sfr P4    = 0xE8;
   6          
   7          unsigned int idata  ii;
   8          sbit Rst4221=P1^3;
   9          sbit LampEn =P1^6;
  10          
  11          sbit BootSyn=P3^2;
  12          sbit BootClk=P3^4;
  13          sbit BootTx =P3^5;
  14          sbit BootRx =P1^7;
  15          
  16          sbit SpiSyn=P3^3;
  17          sbit SpiClk=P4^3;
  18          sbit SpiTx =P2^7;
  19          sbit SpiRx =P2^6;
  20          
  21          uchar idata EepromDat;
  22          uchar idata systimer=100;
  23          uint  idata LcdBlink=600;
  24          uchar idata SendNum=64;
  25          uchar xdata RecBuf[0xc0];
  26          uchar xdata SecBootTab[64];
  27          uint  idata CopyNum;
  28          uint  idata BlockStart;
  29          uint  idata BlockEnd;
  30          
  31          uchar LoopTime=20;
  32          uchar StartDisLine=0;
  33          
  34          uint  xdata RecBufDis[64];
  35          uchar xdata SendDatBuf[128];
  36          
  37          bit bSerialCMD=0;
  38          uchar xdata ch=0;
  39          uchar xdata CmdStart=0;
  40          uchar xdata bufreceive[5];
  41          uchar xdata dskey[4];
  42          uchar xdata StartLoad=0;
  43          uchar xdata LoadComBuf[64];
  44          uchar xdata CommRecNum=0;
  45          uchar xdata OneBlockEnd=0;
  46          uint  xdata filelenth=0;
  47          uint  xdata BlockCnt=0;
  48          
  49          void tdelay(uchar delay_num)  //22.1184 the loop time is 0.543us
  50             {
  51   1          uchar i,k;                //delay_num 0.1ms/num
  52   1          for(i=delay_num;i>0;i--)
  53   1           {
  54   2            for(k=100;k>0;k--)
  55   2             {;}
C51 COMPILER V7.50   SIMBOARD                                                              04/07/2006 23:20:55 PAGE 2   

  56   2            }
  57   1          }
  58          void timer_int(void) interrupt 1
  59             {
  60   1          TH0=0xb8;            //m=65536-22.1184*10^6*time/12;time=10ms;m=b800;
  61   1          TL0=0x00;
  62   1              if(systimer>0)
  63   1                {
  64   2                  systimer--;
  65   2                 }
  66   1          if(LcdBlink>0)
  67   1            {
  68   2              LcdBlink--;
  69   2             }
  70   1          if(LoopTime>0)
  71   1            {
  72   2              LoopTime--;
  73   2             }
  74   1              }
  75          void serial(void) interrupt 4
  76          {
  77   1          uchar error;
  78   1              if(RI==1)
  79   1              { 
  80   2                 RI=0;
  81   2                 if(StartLoad==0)
  82   2                 {
  83   3               if(SBUF==0xbb)
  84   3                   {
  85   4                                  ch=0; 
  86   4                                                          CmdStart=1;
  87   4                    }
  88   3               else
  89   3                   {
  90   4                                 if(CmdStart==1)
  91   4                                  {
  92   5                        ch++;
  93   5                                        if(ch<=3)
  94   5                                             {
  95   6                               dskey[ch]=SBUF;
  96   6                                                   }
  97   5                        if(ch==3)
  98   5                          {
  99   6                                                  CmdStart=0;
 100   6                              error=dskey[1]^dskey[2];
 101   6                                      if(error==dskey[3]) 
 102   6                                                               {                           
 103   7                                                       filelenth=dskey[1];
 104   7                                                       filelenth<<=8;
 105   7                                       filelenth+=dskey[2];
 106   7                                           StartLoad=1;
 107   7                                       TI=0;
 108   7                                       SBUF=0xbb;
 109   7                                                          }
 110   6                                  else
 111   6                                    {
 112   7                                       TI=0;
 113   7                                       SBUF=0xfe;  /*error*/
 114   7                                      }
 115   6                             }
 116   5                         }
 117   4                                 }
C51 COMPILER V7.50   SIMBOARD                                                              04/07/2006 23:20:55 PAGE 3   

 118   3                }
 119   2                      else
 120   2                        {
 121   3                          if(CommRecNum<64)
 122   3                              {
 123   4                             SecBootTab[CommRecNum]=SBUF;
 124   4                                 CommRecNum++;
 125   4                                }
 126   3                              if(CommRecNum==64)
 127   3                              {
 128   4                                 CommRecNum=0;
 129   4                                 OneBlockEnd=1;
 130   4                                }
 131   3                          }
 132   2                      }
 133   1              else
 134   1              {   
 135   2                  TI=0;
 136   2                      if(SendNum<63)
 137   2                       {
 138   3                         SendNum++;
 139   3                         SBUF=RecBuf[SendNum];
 140   3                         }
 141   2                }
 142   1      }
 143          
 144          void Rst4221D(void)
 145             {
 146   1            Rst4221=0;
 147   1            tdelay(5);
 148   1            Rst4221=1;
 149   1           }
 150          /*******************************/
 151          /*SPI程序发送接收程序*/
 152          /*******************************/
 153          void SpiBusWr(uint WrData)
 154               {
 155   1             uchar i;
 156   1                 uint  Spitemp;
 157   1             SpiSyn=0;
 158   1                    _nop_();
 159   1                    _nop_();
 160   1                    _nop_();
 161   1                    _nop_();
 162   1                    _nop_();
 163   1                    _nop_();
 164   1                    _nop_();
 165   1                    _nop_();
 166   1             Spitemp=WrData;
 167   1             for(i=0;i<16;i++)
 168   1              {
 169   2                Spitemp&=0x8000;
 170   2                if(Spitemp==0x8000)
 171   2                  {
 172   3                    SpiTx=1;
 173   3                    SpiClk=0;
 174   3                    _nop_();
 175   3                    _nop_();
 176   3                    _nop_();
 177   3                    _nop_();
 178   3                    _nop_();
 179   3                    _nop_();
C51 COMPILER V7.50   SIMBOARD                                                              04/07/2006 23:20:55 PAGE 4   

 180   3                    _nop_();
 181   3                    _nop_();
 182   3                    SpiClk=1;
 183   3                    WrData<<=1;
 184   3                   }
 185   2                else
 186   2                  {
 187   3                    SpiTx=0;
 188   3                    SpiClk=0;
 189   3                    _nop_();
 190   3                    _nop_();
 191   3                    _nop_();
 192   3                    _nop_();
 193   3                    _nop_();
 194   3                    _nop_();
 195   3                    _nop_();
 196   3                    _nop_();
 197   3                    SpiClk=1;
 198   3                    WrData<<=1;              
 199   3                    }
 200   2                 Spitemp=WrData;      
 201   2                }
 202   1              SpiSyn=1; 
 203   1             }
 204          unsigned long int SpiBusRd(void)
 205               {
 206   1             uchar i;
 207   1                 unsigned long int Spitemp;
 208   1             bit Rdbit;
 209   1             SpiSyn=0;
 210   1                    _nop_();
 211   1                    _nop_();
 212   1                    _nop_();
 213   1                    _nop_();
 214   1                    _nop_();
 215   1                    _nop_();
 216   1                    _nop_();
 217   1                    _nop_();
 218   1             Spitemp=0xffffffff;
 219   1             for(i=0;i<32;i++)
 220   1              {
 221   2                    
 222   2                    SpiClk=0;
 223   2                    _nop_();
 224   2                    _nop_();
 225   2                    _nop_();
 226   2                    _nop_();
 227   2                    _nop_();
 228   2                    _nop_();
 229   2                    _nop_();
 230   2                    _nop_();
 231   2                    SpiClk=1;
 232   2                    SpiRx=1;
 233   2                    Rdbit=SpiRx;
 234   2                    Spitemp<<=1; 
 235   2                    if(Rdbit==1)
 236   2                      {Spitemp|=0x00000001;}
 237   2                    else
 238   2                      {Spitemp&=0xfffffffe;}     
 239   2                }
 240   1              SpiSyn=1; 
 241   1              return(Spitemp);
C51 COMPILER V7.50   SIMBOARD                                                              04/07/2006 23:20:55 PAGE 5   

 242   1             }
 243          /*******************************/
 244          uchar sRd1Byte(void)
 245           {
 246   1             uchar i,RdDatTemp;
 247   1             bit Rdbit;
 248   1             RdDatTemp=0x00;
 249   1             for(i=0;i<8;i++)
 250   1              {
 251   2                    BootRx=1;
 252   2                    BootClk=0;
 253   2                    BootClk=1;
 254   2                    Rdbit=BootRx;
 255   2                    RdDatTemp<<=1; 
 256   2                    if(Rdbit==1)
 257   2                      {RdDatTemp|=0x01;}
 258   2                    else
 259   2                      {RdDatTemp&=0xfe;} 
 260   2                }
 261   1              return(RdDatTemp);   
 262   1         }
 263          void sWr1Byte(uchar WrDatP)
 264             {
 265   1           uchar WrDatPTmp,i;
 266   1               WrDatPTmp=WrDatP;
 267   1                for(i=0;i<8;i++)
 268   1                 {
 269   2                  WrDatPTmp&=0x80;
 270   2                       if(WrDatPTmp==0x80)
 271   2                        { 
 272   3                          BootTx=1;
 273   3                         }
 274   2               else
 275   2                        {
 276   3                          BootTx=0;
 277   3                          }
 278   2                        BootClk=0;
 279   2                        BootClk=1;

⌨️ 快捷键说明

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