51 MCU 12864 dot program

Publisher:WhisperingWavesLatest update time:2016-11-23 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

void curve(unsigned char xlable,unsigned char ylable,bit dot)
{
 unsigned char H[1]={0};//Read RAM register
 unsigned char L[1]={0};
 unsigned char xbuf;

 w_com(0x01); 
 w_com(0x34); 
 w_com(0x36); //Function setting: send 8 bits of data at a time, extended instruction set

 xlable=xlable+xoffset; //find the relative zero point
 ylable=ylable+yoffset;

 if(xlable<0)xlable=-1;//out of boundary processingif(
 ylable<0)ylable=0;
 if(ylable>64)ylable=65;
 
 xbuf=xlable%16;
 xlable=xlable/16;
 if(ylable>32)//upper half screen
 {
  ylable=64-ylable;//switch upper and lower screensxbuf
  =15-xbuf;//x coordinate returnw_com
  (0x80|ylable); //input vertical addressw_com
  (0x80|xlable); //input horizontal addressread_RAM
  ();//shieldif
  (xbuf>7)
  {
   if(dot==0)
    H[0]=read_RAM()&(~(1<   H 
    [0]=read_RAM()|1<    [0]=read_RAM();
  }
  else
  {
   H[0]=read_RAM();//Insert dots, dots that need to be inserted
   if(dot==0)
    L[0]=read_RAM()&(~(1<   else
    L[0]=read_RAM()|1<  }
  w_com(0x80|ylable); //Input vertical address
  w_com(0x80|xlable); //Input horizontal address
  w_byte(H[0]);
  w_byte(L[0]);
 }
 else //Lower half screen
 {
  ylable=32-ylable;
  xbuf=15-xbuf;//x coordinate returns to position
  w_com(0x80|ylable); //Input vertical address
  w_com(0x88|xlable); //Input horizontal address
  read_RAM();//Shield
  if(xbuf>7)
  {
   if(dot==0)
    H[0]=read_RAM()&(~(1<   else
    H[0]=read_RAM()|1<   L[0]=read_RAM();
  }
  else
  {
   H[0]=read_RAM();//Insert dot, the dot that needs to be marked
   if(dot==0)
    L[0]=read_RAM()&(~(1<   else
   L[0]=read_RAM()|1<  }
  w_com(0x80|ylable); //Input vertical address
  w_com(0x88|xlable); //Input horizontal address
  w_byte(H[0]);
  w_byte(L[0]);
 }
}

//Clear screen
void BMP_clear( void )
{
     unsigned char i,j;unsigned char L[1]={0};
     w_com(0x34); //8Bit extended instruction set, even if it is 36H, you have to write it twice
     w_com(0x36); //Drawing ON, in the basic instruction set, 36H cannot turn on drawing
     for(i=0;i<32;i++) //12864 is actually 256x32
     {
   
           w_com(0x80|i); //Row position
           w_com(0x80); //Column position
           for(j=0;j<32;j++) //256/8=32 byte
              w_byte(L[0]);
 }
}


Reference address:51 MCU 12864 dot program

Previous article:Stepper Motor Program
Next article:The microcontroller sends data to the PC

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号