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

📄 lcdmain.lst

📁 51单片机接受SPI口数据
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.05a   LCDMAIN                                                              04/20/2009 18:39:19 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE LCDMAIN
OBJECT MODULE PLACED IN lcdmain.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE lcdmain.c OPTIMIZE(4,SPEED) REGFILE(.\gongz.ORC) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "lcddrive.h"
   2          #include  <reg51f.h>
   3          sbit  RUN_LED = P3^4;
   4          sbit  RESET=P1^0;
   5          sbit  RDB=P3^7;
   6          //sbit  TDA=P1^3;
   7          //sbit P15=P1^5;
   8          //sbit TCK=P3^2;
   9          sfr SPCTL=0xD5;
  10          sfr SPCFG=0xAA;
  11          sfr SPDAT=0x86;
  12          sfr WDTC=0xc0;
  13          sfr WDTD=0x85;
  14          void LCD_WriteData(char dat);
  15          void LCD_WriteCommand(char com);
  16          extern unsigned char xdata DispBuff[GUI_LCM_YMAX][GUI_LCM_XMAX/8];
  17          uchar xdata i=0,disnum=0;
  18          uchar data dispbuf[8];
  19          uchar xdata fflag=0;
  20          //char xdata strpct[20]="CT: A=   B=   C=   ";
  21          #define strpnum 9
  22          #define receibufnum 8
  23          data char strp[6]="FHKZ";
  24          //data char strpu[20]="U:   .     .     . ";
  25          //data char strpi[20]="I: .     .     .   ";
  26          char xdata strpui[7][11]; 
  27          data uchar receibuf[receibufnum];
  28          const uchar xdata ledcode[]={0x7E,0x0C,0xB6,0x9E,0xCC,0xDA,0xFA,0x0E,0xFE,0xDE,0xEE,0xF8,0x72,0xBC,0xF2,0x
             -E2};
  29          void refresh()
  30          {
  31   1              uchar col,row;
  32   1          for(row=0; row<16; row++)
  33   1                      for(col=0; col<20; col++)
  34   1                              DispBuff[row][col]=0x0;
  35   1        
  36   1              for(row=0; row<160; row++)
  37   1                      for(col=0; col<81; col++)
  38   1                              LCD_WriteData(0x00); 
  39   1      }
  40          
  41          findnum()
  42          {
  43   1              uchar i,j,codenum;
  44   1              
  45   1                      for(i=3,j=0;i<receibufnum;i++,j++)
  46   1                      {
  47   2                              for(codenum=0;codenum<strlen(ledcode);codenum++)
  48   2                              {
  49   3                                      if(ledcode[codenum]==dispbuf[i])
  50   3                                      break;
  51   3                          }
  52   2                              if(codenum<10)
  53   2                              strp[j]=codenum+0x30;
  54   2                              else
C51 COMPILER V8.05a   LCDMAIN                                                              04/20/2009 18:39:19 PAGE 2   

  55   2                              strp[j]=codenum+0x57;
  56   2                      }
  57   1                      
  58   1                      if((dispbuf[0]==0x7e)&&(dispbuf[1]==0xee||dispbuf[1]==0xf8||dispbuf[1]==0x72))
  59   1      
  60   1                      {
  61   2                              if(dispbuf[1]==0xee)
  62   2                              {
  63   3                                      strpui[0][3]=strp[0];
  64   3                                      strpui[0][4]=strp[1];
  65   3                                      strpui[0][5]=strp[2];
  66   3                                      strpui[0][7]=strp[4];
  67   3                                      disnum=1;       
  68   3                              }       
  69   2                              if(dispbuf[1]==0xf8)
  70   2                              {
  71   3                                      strpui[1][3]=strp[0];
  72   3                                      strpui[1][4]=strp[1];
  73   3                                      strpui[1][5]=strp[2];
  74   3                                      strpui[1][7]=strp[4];
  75   3                                      disnum=2;                               
  76   3                              }
  77   2                              if(dispbuf[1]==0x72)
  78   2                              {
  79   3                                      strpui[2][3]=strp[0];
  80   3                                      strpui[2][4]=strp[1];
  81   3                                      strpui[2][5]=strp[2];
  82   3                                      strpui[2][7]=strp[4];
  83   3                                      disnum=3;
  84   3                              }
  85   2                      }       
  86   1                      else if((dispbuf[0]==0x0c)&&(dispbuf[1]==0xee||dispbuf[1]==0xf8||dispbuf[1]==0x72))
  87   1                      {
  88   2                              if(dispbuf[1]==0xee)
  89   2                              {
  90   3                                      strpui[3][3]=strp[0];
  91   3                                      strpui[3][4]=strp[1];
  92   3                                      strpui[3][6]=strp[2];
  93   3                                      strpui[3][7]=strp[4];
  94   3                                      disnum=4;       
  95   3                              }       
  96   2                              if(dispbuf[1]==0xf8)
  97   2                              {
  98   3                                      strpui[4][3]=strp[0];
  99   3                                      strpui[4][4]=strp[1];
 100   3                                      strpui[4][6]=strp[2];
 101   3                                      strpui[4][7]=strp[4];
 102   3                                      disnum=5;                               
 103   3                              }
 104   2                              if(dispbuf[1]==0x72)
 105   2                              {
 106   3                                      strpui[5][3]=strp[0];
 107   3                                      strpui[5][4]=strp[1];
 108   3                                      strpui[5][6]=strp[2];
 109   3                                      strpui[5][7]=strp[4];
 110   3                                      disnum=6;
 111   3                              }
 112   2                      }
 113   1                      else
 114   1                      {
 115   2                              for(i=0,j=0;i<receibufnum;i++,j++)
 116   2                              {
C51 COMPILER V8.05a   LCDMAIN                                                              04/20/2009 18:39:19 PAGE 3   

 117   3                                      for(codenum=0;codenum<strlen(ledcode);codenum++)
 118   3                                      {
 119   4                                              if(ledcode[codenum]==dispbuf[i])
 120   4                                              break;
 121   4                                  }
 122   3                                      if(codenum<10)
 123   3                                      strp[j]=codenum+0x30;
 124   3                                      else
 125   3                                      strp[j]=codenum+0x57;
 126   3                              }
 127   2                                      strpui[6][3]=strp[0];
 128   2                                      strpui[6][4]=strp[1];
 129   2                                      strpui[6][5]=strp[2];
 130   2                                      strpui[6][6]=strp[3];
 131   2                                      strpui[6][7]=strp[4];
 132   2                                      strpui[6][8]=strp[5];
 133   2                                      disnum=7;
 134   2                                              
 135   2                      }       
 136   1      
 137   1                      if(disnum >=1 ) GUI_DispStringAt(&strpui[disnum-1][0], 0, 0);
 138   1      }
 139          void datapro()
 140          {
 141   1              uchar a;
 142   1              uchar tempqian,temphou,temp7;
 143   1              for(a=0;a<7;a++)
 144   1              {
 145   2                      tempqian=receibuf[a];
 146   2                      temphou=receibuf[a+1];
 147   2                      tempqian=tempqian<<1;
 148   2                      temphou=(temphou&0x80)>>7;
 149   2                      dispbuf[a]=tempqian|temphou;
 150   2              }
 151   1              temp7=receibuf[7];
 152   1              temp7=temp7<<1;
 153   1              dispbuf[7]=temp7;
 154   1              findnum();                      
 155   1      }

⌨️ 快捷键说明

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