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

📄 ziandpic.lst

📁 下位机程序 菜单一些模块 园
💻 LST
字号:
C51 COMPILER V7.50   ZIANDPIC                                                              02/17/2008 11:06:49 PAGE 1   


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

line level    source

   1          #include "config.h"
   2          #include "order.h"
   3          
   4          
   5          //文本方式设置显示坐标
   6          static void glcd_xy(unsigned char x, unsigned char y) 
   7          {
   8   1              int addr;
   9   1              addr = glcd_T_BASE + (y * glcd_BYTES_PER_ROW) + x;
  10   1              glcd_set_address(addr);         //设置显示地址
  11   1      }
  12          
  13          //写字符串
  14          //显示字符串ROM
  15          void wrchar(unsigned char x,unsigned char y, const unsigned char  *stringr) 
  16          {
  17   1              unsigned char i;
  18   1              glcd_xy(x,y);                           //CHAR ADDR
  19   1              
  20   1              dataR4 = 0XB0;
  21   1              Outin();
  22   1      
  23   1              for (i = 0 ; (stringr[i])!= 0 ; i++) 
  24   1              {       
  25   2                      Pr03();
  26   2                                                                      //转换ASCII码为屏幕内码
  27   2                      ACC = (stringr[i]) - 0X20;  
  28   2                      Outd();                         //写字符,增加内部RAM指针
  29   2              }
  30   1      
  31   1              dataR4 = 0XB2;
  32   1              Outin();
  33   1      }
  34          
  35          //写点阵
  36          void hanzipic(unsigned char column , unsigned char row ,const unsigned char *pthanzi , unsigned char hsize
             - , unsigned char wsize ,  bit zfbit)
  37          {
  38   1              unsigned char i;
  39   1              unsigned char j;
  40   1              unsigned int lcdadrtemp;
  41   1              unsigned int lcdadr;
  42   1              //*pthanzi = 0x50;                      //test const
  43   1                                                      
  44   1              if ((column >= glcd_HAIZIXMAX) || (row >= glcd_HAIZIYMAX))
  45   1              return;
  46   1              
  47   1              lcdadr = glcd_G_BASE + (row * glcd_BYTES_PER_ROW) + column;
  48   1      
  49   1              for (i = 0 ; i < wsize/8 ; i++)
  50   1              {
  51   2                      lcdadrtemp = lcdadr;
  52   2                      lcdadr = lcdadr + 1;
  53   2                      
  54   2                      for ( j = 0 ; j < hsize ; j++)
C51 COMPILER V7.50   ZIANDPIC                                                              02/17/2008 11:06:49 PAGE 2   

  55   2                      { 
  56   3                              glcd_set_address(lcdadrtemp);
  57   3                      
  58   3                              dataR3 = *pthanzi;
  59   3                              
  60   3                              if(zfbit == 0)
  61   3                              {
  62   4                                      dataR3 = ~dataR3;
  63   4                                      _nop_();
  64   4                              }
  65   3      
  66   3                              dataR4 = 0XC0;
  67   3                              Outi1();
  68   3                              pthanzi++;
  69   3      
  70   3                              lcdadrtemp = lcdadrtemp + 0X1E;         
  71   3                      }
  72   2      
  73   2              }
  74   1                      
  75   1      }
  76                  
  77          //画点
  78          void lcd_pixel(unsigned char column , unsigned char row , bit show)
  79          {
  80   1              int addr;                               // memory address of byte containing pixel to write
  81   1      
  82   1              if ((column>=glcd_XMAX) || (row>=glcd_YMAX))
  83   1              return;
  84   1              
  85   1              addr = glcd_G_BASE + (row*glcd_BYTES_PER_ROW) + (column/8);
  86   1              glcd_set_address(addr);         // set LCD addr. pointer
  87   1              
  88   1              if (show == 1)                                  // 0xf8为画点命令
  89   1              {  
  90   2                      dataR4 = (0xF8 | (7-column%8));
  91   2                      Outin();
  92   2              }
  93   1              else                                            //0xf0为清点命令
  94   1              {
  95   2                      dataR4 = (0xF0 | (7-column%8));
  96   2                      Outin();
  97   2              }
  98   1      
  99   1      }
 100          
 101          //画线
 102          void lcd_line(int x1, int y1, int x2, int y2, bit show)
 103          {
 104   1              int dy;
 105   1              int dx;
 106   1              int stepx , stepy , fraction;
 107   1      
 108   1              dy = y2 - y1;
 109   1              dx = x2 - x1;
 110   1      
 111   1              if (dy < 0)                                     //|dy|,setpy
 112   1              {
 113   2                      dy = -dy;
 114   2                      stepy = -1;
 115   2              }
 116   1              else
C51 COMPILER V7.50   ZIANDPIC                                                              02/17/2008 11:06:49 PAGE 3   

 117   1              {
 118   2                      stepy = 1;
 119   2              }
 120   1      
 121   1      
 122   1              if (dx < 0)                                     //|dx|,setpx
 123   1              {
 124   2                      dx = -dx;
 125   2                      stepx = -1;
 126   2              }
 127   1              else
 128   1              {
 129   2                      stepx = 1;
 130   2              }
 131   1      
 132   1              dy <<= 1;
 133   1              dx <<= 1;
 134   1      
 135   1              lcd_pixel(x1,y1,show);
 136   1      /*算法关键部分*/
 137   1              if (dx > dy)
 138   1              {
 139   2                      fraction = dy - (dx >> 1);
 140   2                      while (x1 != x2)
 141   2                      {
 142   3                              if (fraction >= 0)
 143   3                              {
 144   4                                      y1 = y1 + stepy;
 145   4                                      fraction = fraction - dx;
 146   4                              }
 147   3                              x1 = x1 + stepx;
 148   3                              fraction = fraction +dy; 
 149   3                              lcd_pixel(x1,y1,show);
 150   3                      }
 151   2              }
 152   1      
 153   1              else
 154   1              {
 155   2                      fraction = dx - (dy >> 1);
 156   2                      while (y1 != y2)
 157   2                      {
 158   3                              if (fraction >= 0)
 159   3                              {
 160   4                              x1 = x1 + stepx;
 161   4                              fraction = fraction - dy;
 162   4                              }
 163   3                              y1 = y1 + stepy;
 164   3                              fraction = fraction + dx;
 165   3                              lcd_pixel(x1,y1,show);
 166   3                      }
 167   2              }
 168   1      }
 169          
 170          
 171          //画矩形
 172          void lcd_box(int x1 , int y1 , int x2 , int y2 , bit show)
 173          {
 174   1              lcd_line(x1,y1,x2,y1,show);  // up
 175   1              lcd_line(x1,y2,x2,y2,show);  // down
 176   1              lcd_line(x2,y1,x2,y2,show);  // right
 177   1              lcd_line(x1,y1,x1,y2,show);  // left
 178   1      }
C51 COMPILER V7.50   ZIANDPIC                                                              02/17/2008 11:06:49 PAGE 4   

 179          
 180          //以x,y为圆心,以radius为半径
 181          //(show=1画点,show=0清点)
 182          void lcd_circle(int x , int y , int radius , bit show)
 183          {
 184   1              int xc = 0;
 185   1              int yc;
 186   1              int p;
 187   1              yc = radius;
 188   1              p = 3 - (radius << 1);
 189   1              while (xc <= yc) 
 190   1              {
 191   2                      lcd_pixel(x + xc, y + yc, show);
 192   2                      lcd_pixel(x + xc, y - yc, show);
 193   2                      lcd_pixel(x - xc, y + yc, show);
 194   2                      lcd_pixel(x - xc, y - yc, show);
 195   2                      lcd_pixel(x + yc, y + xc, show);
 196   2                      lcd_pixel(x + yc, y - xc, show);
 197   2                      lcd_pixel(x - yc, y + xc, show);
 198   2                      lcd_pixel(x - yc, y - xc, show);
 199   2                      if (p < 0)
 200   2                      {
 201   3                              p += (xc++ << 2) + 6;
 202   3                      }
 203   2                      else
 204   2                      {
 205   3                              p += ((xc++ - yc--)<<2) + 10;
 206   3                      }
 207   2              }
 208   1      }
 209          
 210          
 211          //保留备用
 212          /********************************************************************
 213          以指定的数据进行画点
 214          void glcd_show(unsigned char * s,int start_line,int how_many_line)
 215          {
 216                  int addr,i;
 217                  addr =  glcd_G_BASE +start_line*30;
 218                  glcd_set_address(addr);
 219                  glcd_cput(0xB0);   //自动写模式
 220                  for(i=0;i<how_many_line*30;i++)
 221                  {
 222                          glcd_dput(s[i]);
 223                  }
 224                  glcd_cput(0xB2);
 225          }
 226          
 227          
 228          
 229          dataR2 = lcdadrtemp & 0X00FF;
 230          dataR3 = (lcdadrtemp & 0XFF00) >> 8;
 231          dataR4 = 0X24;
 232          Outi2();
 233          
 234          void wrchar(const unsigned char *ptchar , unsigned char charsize , unsigned int charadr)
 235          {
 236                  unsigned char i;
 237          
 238                  glcd_set_address(charadr);
 239          
 240                  dataR4 = 0XB0;
C51 COMPILER V7.50   ZIANDPIC                                                              02/17/2008 11:06:49 PAGE 5   

 241                  Outin();
 242                  
 243                  for (i = 0 ; i < charsize ; i++)
 244                  {               
 245                          Pr03();
 246                          ACC = *ptchar;
 247                          Outd();
 248                          ptchar++;
 249                  }
 250          
 251                  dataR4 = 0XB2;
 252                  Outin();
 253                  
 254          }
 255          ***********************************************************************/


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1027    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      54
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       5
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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