硬件原理图

LCD12864.c

你主要看每个功能函数是如何实现的

/***************************************** 按照自己的硬件电路图来设置* --------------------------*          |  PB.09: (LCD_BLK)        |*          |  PC.06: (LCD_RST)        |*          |  PE.09: (LCD_EN,LCD_CLK) |*          |  PE.08: (LCD_RW,LCD_DAT) |*          |  PE.07: (LCD_RS,LCD_CS)  |*          |  PD.08: (LCD_DB0)        |*          |  PD.09: (LCD_DB1)        |*          |  PD.10: (LCD_DB2)        |*          |  PD.11: (LCD_DB3)        |*          |  PD.12: (LCD_DB4)        |*          |  PD.13: (LCD_DB5)        |*          |  PD.14: (LCD_DB6)        |*          |  PD.15: (LCD_DB7)        |*           --------------------------                **********************************************************************************/
#include "lcd12864.h"
#include "comm.h"u8 Drawx = 0x90;    //--ÓÃÓÚÇå³ý·´°×,ĬÈϵØַΪ¹¦ÄÜÑ¡Ôñ½çÃæ
u8 Drawy = 0x90;   //--ÓÃÓÚÇå³ý·´°×,ĬÈϵØַΪ¹¦ÄÜÑ¡Ôñ½çÃæ
u8 Drwxy = 0;   //--ÓÃÓÚÇå³ýÏ»®Ïß,ĬÈÏΪ¸ß×Ö½Ú
u8 Bytenum = 0;void    Lcd_Delay_us(u16 x)
{while(x--);
}/** º¯ÊýÃû£ºLCD12864_GPIO_Config* ÃèÊö  £ºÅäÖÃLCD12864Óõ½µÄI/O* ÊäÈë  £ºÎÞ* Êä³ö  £ºÎÞ* µ÷Óà  £ºÄÚ²¿µ÷ÓÃ*/
void Lcd_GPIOConfigOut(void)
{GPIO_InitTypeDef GPIO_InitStructure;RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOE, ENABLE);GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_0 | GPIO_Pin_1;//RW¡¢ENGPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;//RSGPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOC, &GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;//RSTGPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;//BLK±³¹âGPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOB, &GPIO_InitStructure);ResetLcdBLK;
//  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;//°´¼üÒý½Å
//  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IN_FLOATING;
//  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//  GPIO_Init(GPIOE, &GPIO_InitStructure);//    RCC->APB2ENR |= 0x00000020;
//  RCC->APB2ENR|=1<<3;//¿ªÆôBʱÖÓ
//  RCC->APB2ENR|=1<<6;//¿ªÆôEʱÖÓ
//
//  GPIOD->CRL = (GPIOD->CRL&0x000fffff)|0x33300000;
//  GPIOD->CRH = (GPIOD->CRH&0x00000000)|0x33333333;
//  GPIOD->ODR|=0XFF00;//ÉÏÀ­Êä³ö
//  GPIOB->CRH = (GPIOB->CRH&0xfff0ffff)|0x00030000;
//  GPIOE->CRH = (GPIOE->CRH&0x0000ffff)|0x44440000;
}   void Lcd_GPIOConfigIn(void)                 //ͨ¹ýÁ½¸öºê¶¨Ò壬ʡÊÂÒ»ÏÂ×ÓÅäÖÃÁËÆ߸öGPIO¿Ú
{GPIO_InitTypeDef GPIO_InitStructure;RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);GPIO_InitStructure.GPIO_Pin   = LCD_DATA_PIN;GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_IPD;//±ØÐëÅäÖóÉÏÂÀ­ÊäÈëGPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(LCD_PORT, &GPIO_InitStructure);  //      GPIOD->CRH = (GPIOD->CRH&0x00000000)|0x44444444;
}void Lcd_GPIOD_Out(void)
{GPIOD->CRH = (GPIOD->CRH&0x00000000)|0x33333333;
}void Lcd_CheckBusy(void)
{   ResetLcdRS;SetLcdRW;SetLcdEN;//ÏÂÃæÕâ¾äºÜÖØÒªGPIOD->ODR = GPIOD->ODR&0X00ff;//ÒòLCDÊý¾ÝÒý½Å±»ÅäÖóÉÁ˸¡¿ÕÊäÈ룬ËùÒÔÔÚ¶ÁLCDÒý½ÅÊý¾ÝÇ°ÏÈд0£¬ÒÔ±£Ö¤Òý½ÅµçƽÎȶ¨£¬¶ÁÈ¡µÄÊý¾Ý¿É¿¿Lcd_GPIOConfigIn();while((GPIOD->IDR>>8)&0x80);ResetLcdEN;Lcd_GPIOD_Out();
}void Lcd_WriteCmd(uint8_t cmd)
{Lcd_CheckBusy();ResetLcdRS;ResetLcdRW;SetLcdEN;LCD_PORT->ODR = ((LCD_PORT->ODR&0x00ff)|(cmd<<8));  //¶ÁLCDÒý½ÅÊý¾ÝÇ°ÏÈд0£¬ÒÔ±£Ö¤Òý½ÅµçƽÎȶ¨£¬¶ÁÈ¡µÄÊý¾Ý¿É¿¿ResetLcdEN;
}void Lcd_WriteData(uint8_t dat)
{Lcd_CheckBusy();SetLcdRS;ResetLcdRW;SetLcdEN;LCD_PORT->ODR = ((LCD_PORT->ODR&0x00ff)|(dat<<8));  //¶ÁLCDÒý½ÅÊý¾ÝÇ°ÏÈд0£¬ÒÔ±£Ö¤Òý½ÅµçƽÎȶ¨£¬¶ÁÈ¡µÄÊý¾Ý¿É¿¿ResetLcdEN;
}unsigned char ReadByte_12864(void)
{unsigned char dat;Lcd_CheckBusy();Lcd_GPIOConfigIn();  SetLcdRS;SetLcdRW;SetLcdEN;dat = (uint8_t)(LCD_PORT->IDR>>8); ResetLcdEN; Lcd_GPIOD_Out();return dat;
}void Lcd_Init(void)
{Lcd_Delay_us(100);SetLcdRST;
//  SetLcdPSB;Lcd_Delay_us(LCD_DELAY);Lcd_WriteCmd(0x30);Lcd_Delay_us(LCD_DELAY);Lcd_WriteCmd(0x0c);Lcd_Delay_us(LCD_DELAY);Lcd_WriteCmd(0x01);Lcd_Delay_us(LCD_DELAY);Lcd_WriteCmd(0x06);Lcd_Delay_us(LCD_DELAY);
}void Lcd_ClearDRAM(void)
{Lcd_WriteCmd(0x30);Lcd_WriteCmd(0x01);//ÇåDDRAM£¬Ðèʱ4.6ms
//  Lcd_Delay_us(20000);    //´ËÑÓʱºÜ¹Ø¼ü£¬Ö±½ÓÓ°Ïìµ½LCDË¢ÆÁËÙ¶È
}void Lcd_ClearLineFB(uint8_t addr_x, uint8_t addr_y, uint8_t num)
{uint8_t x = 0, y = 0;Lcd_WriteCmd(0x34); //ʹÓÃÀ©³äÖ¸Áfor(y=0; y<16; y++){          for(x=0; x<num; x++){Lcd_WriteCmd(addr_y + y);// ÏȽ«´¹Ö±µÄλԪ×é×ø±ê(Y) дÈëGDRAMLcd_WriteCmd(addr_x + x);// ÔÙ½«Ë®Æ½×ø±ê(X) дÈëGDRAMLcd_WriteData(0x00);//дÊý¾Ý¸ß°ËλLcd_WriteData(0x00);//дÊý¾ÝµÍ°Ëλ }
//      Lcd_WriteCmd(0x36); // Ñ¡Ôñ8λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}Lcd_WriteCmd(0x36);Lcd_WriteCmd(0x30);
}void Lcd_LineFB(uint8_t addr_x, uint8_t addr_y, uint8_t num)
{uint8_t x = 0, y = 0;if((Drawx!=addr_x) || (Drawy!=addr_y) || (Bytenum!=num)){Lcd_ClearLineFB(Drawx, Drawy, Bytenum);Drawx = addr_x;Drawy = addr_y;Bytenum = num;  }Lcd_WriteCmd(0x34); for(y=0; y<16; y++){         for(x=0; x<num; x++){Lcd_WriteCmd(addr_y + y);Lcd_WriteCmd(addr_x + x);Lcd_WriteData(0xff);Lcd_WriteData(0xff); }Lcd_WriteCmd(0x36);}Lcd_WriteCmd(0x30);
}void Draw_Pic(uint8_t addr_x, uint8_t addr_y, uint8_t const *pdat, uint8_t wide, uint8_t high)
{uint16_t hang, lie;Lcd_WriteCmd(0x34);//À©Õ¹Ö¸ÁLcd_WriteCmd(0x36);//¹Ø»æͼ¹¦ÄÜif(wide%8 == 0) wide >>= 3;else wide = (wide>>3)+1;for(hang=0; hang<high; hang++){if(addr_y+hang>31){Lcd_WriteCmd(0x80+addr_y+hang-32);Lcd_WriteCmd(0x88+addr_x);}else{Lcd_WriteCmd(0x80+addr_y+hang);Lcd_WriteCmd(0x80+addr_x);}for(lie=0; lie<wide; lie++){Lcd_WriteData(pdat[hang*wide+lie]);}}Lcd_WriteCmd(0x36);// Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ªLcd_WriteCmd(0x30);
}void Lcd_Pos(unsigned char x,unsigned char y)
{unsigned char pos;switch(x){case 0:x=0x80;break;case 1:x=0x90;break;case 2:x=0x88;break;case 3:x=0x98;break;default:x=0x80;break;}pos=x+y;Lcd_WriteCmd(pos);
}void Draw_Font_16x16(uint8_t addr_x, uint8_t addr_y, uint8_t width, uint8_t const *pAry, uint8_t num)
{uint8_t x = 0, y = 0;
//  uint8_t res = 2*width;Lcd_WriteCmd(0x34); //ʹÓÃÀ©³äÖ¸Áfor(x=0; x<num; x++){for(y=0; y<width; y++){         Lcd_WriteCmd(addr_y + y);// ÏȽ«´¹Ö±µÄλԪ×é×ø±ê(Y) дÈëGDRAMLcd_WriteCmd(addr_x + x);// ÔÙ½«Ë®Æ½×ø±ê(X) дÈëGDRAM//                  Lcd_WriteData(pAry[y+res*x]);//дÊý¾Ý¸ß°Ëλ
//                  Lcd_WriteData(pAry[y+width+res*x]);//дÊý¾ÝµÍ°Ëλ Lcd_WriteData(pAry[y]);//дÊý¾Ý¸ß°ËλLcd_WriteData(pAry[y+width]);//дÊý¾ÝµÍ°Ëλ   }
//          Lcd_WriteCmd(0x36); // Ñ¡Ôñ8λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}  Lcd_WriteCmd(0x36);Lcd_WriteCmd(0x30);
}void Draw_Dot(unsigned char x, unsigned char y)
{unsigned char x_byte,x_bit;//ÔÚºá×ø±êµÄÄÄÒ»¸ö×Ö½Ú£¬ÄÄÒ»¸öλunsigned char y_byte,y_bit;//ÔÚÄÄÒ»Ò³unsigned char temp_h,temp_l; //ÕâÁ½±äÁ¿ÓÃÀ´´æ·Å¶Á³öÀ´µÄÊý¾Ýx &= 0x7f; //ÏÞ¶¨xµÄÊýÖµ·¶Î§ÔÚ0¡«127Ö®¼äy &= 0x3f; //ÏÞ¶¨yµÄÊýÖµ·¶Î§ÔÚ0¡«63Ö®¼äx_byte = x >> 4;//Ëã³öÔÚÄÄÒ»¸ö×Ö½Ú£¨µØÖ·£©£¬Ò»¸öµØÖ·ÊÇ16λx_bit = x & 0x0f;//Ëã³öÔÚÄÄÒ»¸öλy_byte = y >> 5; //È·¶¨ÔÚÉÏ°ëÆÁ»¹ÊÇÏ°ëÆÁ 0-ÉÏ  1-Ï y_bit = y & 0x1f;Lcd_WriteCmd(0x34);//À©Õ¹Ö¸ÁLcd_WriteCmd(0x36);//¹Ø»æͼ¹¦ÄÜLcd_WriteCmd(0x80 + y_bit);//ÏÈд´¹Ö±µØÖ·£¬×î¸ßλ±ØÐëΪ1Lcd_WriteCmd(0x80 + x_byte + 8 * y_byte);//ˮƽ×ø±ê//Ï°ëÆÁµÄˮƽ×ø±êÆðʼµØַΪ0X88//8 * y_byte ¾ÍÊÇÓÃÀ´È·¶¨ÔÚÉÏ°ëÆÁ»¹ÊÇÏ°ëÆÁReadByte_12864();//ÏÈ¿Õ¶ÁÒ»´Îtemp_h = ReadByte_12864();//¶Á¸ßλtemp_l = ReadByte_12864();    //¶ÁµÍλ//¶Á²Ù×÷»á¸Ä±äAC£¬ËùÒÔÒªÖØÐÂÉèÖÃÒ»´ÎLcd_WriteCmd(0x80 + y_bit);//ÏÈд´¹Ö±µØÖ·£¬×î¸ßλ±ØÐëΪ1Lcd_WriteCmd(0x80 + x_byte + 8 * y_byte);//ˮƽ×ø±êif(x_bit < 8){Lcd_WriteData(temp_h | (0x01 << (7 - x_bit)));//д¸ß×Ö½Ú¡£ÒòΪ×ø±êÊÇ´Ó×óÏòÓÒµÄ,//¶øGDRAM¸ßλÔÚ×󣬵×λÔÚÓÒ Lcd_WriteData(temp_l); //Ô­Êý¾ÝËÍ»Ø }else{   Lcd_WriteData(temp_h);Lcd_WriteData(temp_l | (0x01 << (15 - x_bit)));            }Lcd_WriteCmd(0x36);// Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ªLcd_WriteCmd(0x30);
}void Draw_Line(unsigned char  x1, unsigned char y1, unsigned char x2, unsigned char y2)
{int x, y, dx, dy, s1, s2, p, temp, interchange, i;x = x1;y = y1;dx = x2 > x1 ? (x2 - x1) : (x1 - x2);dy = y2 > y1 ? (y2 - y1) : (y1 - y2);if(x2 > x1)s1 = 1;elses1 = -1;if(y2>y1)s2 = 1;elses2 = -1;if(dy > dx){temp = dx;dx = dy;dy = temp;interchange = 1;}elseinterchange = 0;p = (dy << 1) - dx;for(i = 0;i <= dx;i++){Draw_Dot(x,y);if(p >= 0){if(interchange == 0)y = y + s2;elsex = x + s1;p = p - (dx << 1);}if(interchange == 0)x = x + s1; elsey = y + s2;p = p + (dy << 1);}
}void Lcd_ClearGRAM(void)
{uint8_t y, x,z;uint8_t addr_y, addr_x;addr_y = 0x80;addr_x = 0x80;Lcd_WriteCmd(0x34);for(z=0; z<2; z++){for(y=0; y<32; y++){for(x=0; x<8; x++)//°Ë¸öÖÐÎÄ×Ö{Lcd_WriteCmd(addr_y+y); // ½«´¹Ö±µÄλԪ×é×ø±ê( Y) дÈëGDRAMLcd_WriteCmd(addr_x+x); // ÏȽ«Ë®Æ½µ¥ÔªÐ´Èëºá×ø±ê£¨X£©) дÈëGDRAM Lcd_WriteData(0x00); //дÊý¾Ý¸ß°Ë룬16*16Lcd_WriteData(0x00); //дÊý¾ÝµÍ°Ëλ}//for(x=0; x<8; x++) endLcd_WriteCmd(0x36);  // Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}//for(y=0; y<32; y++)  endaddr_x = 0x88;}//for(z=0; z<2; z++)  endLcd_WriteCmd(0x30);
}void Lcd_Printf(uint8_t add, uint8_t *pdat)
{Lcd_WriteCmd(add);while(*pdat != '\0'){Lcd_WriteData(*pdat++);//  Lcd_Delay_us(5);}
}/
/*----------------È¡ÏûÏ»®Ïß/Ìî³äº¯Êý---------------------------------*/
void UnLcdDrw(uint8_t addr_x, uint8_t addr_y)
{uint8_t y, x;Lcd_WriteCmd(0x34);for(y=0; y<15; y++){for(x=0; x<1; x++){Lcd_WriteCmd(addr_y+y); // ÏȽ«´¹Ö±µÄλԪ×é×ø±ê( Y) дÈëGDRAMLcd_WriteCmd(addr_x+x); // ÔÙ½«Ë®Æ½×ø±ê( X) дÈëGDRAM         Lcd_WriteData(0x00);   //дÊý¾Ý¸ß°ËλLcd_WriteData(0x00); //дÊý¾ÝµÍ°Ëλ}//for(x=0; x<1; x++) end       Lcd_WriteCmd(0x36);  // Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}//for(y=0; y<16; y++) endLcd_WriteCmd(0x30);
}/*----------------µ¥×Ö½Ú·´°×/»­Ï»®Ïß---------------------------------*/void LcdDrw(uint8_t addr_x, uint8_t addr_y, uint8_t num, uint8_t fl)
{uint8_t y, x, i;if(fl == LINE) i = 14;else i = 0;if((Drawx!=addr_x)||(Drawy!=addr_y)||(Drwxy!=num)){    UnLcdDrw(Drawx,Drawy);Drawx=addr_x;   Drawy=addr_y;Drwxy=num;}//if((Drawx!=addr_x)||(Drawy!=addr_y)||(Drwxy!=num))    endLcd_WriteCmd(0x34);for(y=i; y<15; y++){for(x=0; x<1; x++){Lcd_WriteCmd(addr_y+y); // ÏȽ«´¹Ö±µÄλԪ×é×ø±ê( Y) дÈëGDRAMLcd_WriteCmd(addr_x+x); // ÔÙ½«Ë®Æ½×ø±ê( X) дÈëGDRAM         if (num == 0)//Ê××Ö½Ú·´°×{Lcd_WriteData(0xff);  //дÊý¾Ý¸ß°ËλLcd_WriteData(0x00); //дÊý¾ÝµÍ°Ëλ}//if (num == 0) endelse if (num == 1)//´Î×Ö½Ú·´°×{Lcd_WriteData(0x00);    //дÊý¾Ý¸ß°ËλLcd_WriteData(0xff); //дÊý¾ÝµÍ°Ëλ         }//else if (num == 1) end}//for(x=0; x<1; x++) end       Lcd_WriteCmd(0x36);  // Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}//for(y=0; y<16; y++) end  Lcd_WriteCmd(0x30);
}/*----------------×Ö·´°×/»­Ï»®Ïß---------------------------------*/
void LcdDrwWord(uint8_t addr_x, uint8_t addr_y, uint8_t fl)
{uint8_t y, x, i;if(fl == LINE) i = 14;else i = 0;if((Drawx!=addr_x)||(Drawy!=addr_y)){   UnLcdDrw(Drawx, Drawy);Drawx=addr_x;   Drawy=addr_y;}//if((Drawx!=addr_x)||(Drawy!=addr_y)||(Drwxy!=num))  endLcd_WriteCmd(0x34);for(y=i; y<15; y++){for(x=0; x<1; x++){Lcd_WriteCmd(addr_y+y); // ÏȽ«´¹Ö±µÄλԪ×é×ø±ê( Y) дÈëGDRAMLcd_WriteCmd(addr_x+x); // ÔÙ½«Ë®Æ½×ø±ê( X) дÈëGDRAMLcd_WriteData(0xff);   //дÊý¾Ý¸ß°ËλLcd_WriteData(0xff); //дÊý¾ÝµÍ°Ëλ}                 Lcd_WriteCmd(0x36);  // Ñ¡Ôñ8 λÊý¾ÝÁ÷,À©³äÖ¸Áî, »æͼÏÔʾ¿ª}//for(y=0; y<16; y++) endLcd_WriteCmd(0x30);
}// * º¯ÊýÃû£ºLCD12864_Init
// * ÃèÊö  £ºLCD12864³õʼ»¯
// * ÊäÈë  £ºÎÞ
// * Êä³ö  £ºÎÞ
// * µ÷Óà  £ºÍⲿµ÷ÓÃ
// */
void LCD12864_Init(void)
{Lcd_GPIOConfigOut();Lcd_Init();SetLcdBLK;  Lcd_ClearDRAM();Lcd_ClearGRAM();
}//1¡¢80-87
//2¡¢90-97
//3¡¢88-8f
//4¡¢98-9fvoid Ready_Mea_Scr(void)
{Lcd_Printf(0x81, "");Lcd_Printf(0x90, "  ÕýÔÚ×¼±¸²âÁ¿" );Lcd_Printf(0x88, "    ÇëÉÔµÈ... " );}

LCD12864.h

#ifndef __LCD12864_H
#define __LCD12864_H#include "stm32f10x.h"#define  FB     0  //LCDµ¥×Ö½Ú·´°×ÏÔʾ
#define  LINE   1  //LCDµ¥×Ö½ÚÏ»®ÏßÏÔʾ#define LCD_DELAY  30#define LCD_PORT GPIOD#define LCD_DATA_PIN  GPIO_Pin_8|GPIO_Pin_9|GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15
#define LCD_RS_PIN    GPIO_Pin_5
#define LCD_RW_PIN    GPIO_Pin_0
#define LCD_EN_PIN    GPIO_Pin_1#define LCD_BLK_PIN   GPIO_Pin_9
#define LCD_RST_PIN   GPIO_Pin_12#define SetLcdRS    GPIO_SetBits  (GPIOC, LCD_RS_PIN)
#define ResetLcdRS  GPIO_ResetBits(GPIOC, LCD_RS_PIN)#define SetLcdRW     GPIO_SetBits  (GPIOB, LCD_RW_PIN)
#define ResetLcdRW  GPIO_ResetBits(GPIOB, LCD_RW_PIN)#define SetLcdEN     GPIO_SetBits  (GPIOB, LCD_EN_PIN)
#define ResetLcdEN  GPIO_ResetBits(GPIOB, LCD_EN_PIN)#define SetLcdBLK      GPIO_SetBits(GPIOB, LCD_BLK_PIN)
#define ResetLcdBLK   GPIO_ResetBits(GPIOB, LCD_BLK_PIN)//#define SetLcdRST   GPIO_SetBits  (GPIOC, LCD_RST_PIN)
#define SetLcdRST     GPIO_SetBits  (GPIOB, LCD_RST_PIN)
#define ResetLcdRST GPIO_ResetBits(GPIOB, LCD_RST_PIN)void Lcd_Delay_us(u16 x);
void LCD12864_Init(void);
//void Scr1(void);
void Lcd_WriteCmd(uint8_t cmd);
void Lcd_WriteData(uint8_t dat);
void Draw_Font_16x16(uint8_t addr_x, uint8_t addr_y, uint8_t width, uint8_t const *pAry, uint8_t num);
void Draw_Line(unsigned char  x1, unsigned char y1, unsigned char x2, unsigned char y2);
void LCD_12864_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);
void Set_12864_point(u8 x,u8 y);
void Draw_Dot(unsigned char x, unsigned char y);
void Lcd_Pos(unsigned char x,unsigned char y);
void Draw_Pic(uint8_t addr_x, uint8_t addr_y, uint8_t const *pdat, uint8_t wide, uint8_t high);
void Lcd_ClearLineFB(uint8_t addr_x, uint8_t addr_y, uint8_t num);
void Lcd_ClearGRAM(void);
void Lcd_ClearDRAM(void);
void Lcd_Printf(uint8_t add, uint8_t *pdat);
void LcdDrw(uint8_t addr_x, uint8_t addr_y, uint8_t num, uint8_t fl);
void LcdDrwWord(uint8_t addr_x, uint8_t addr_y, uint8_t fl);
void Lcd_LineFB(uint8_t addr_x, uint8_t addr_y, uint8_t num);
void Ready_Mea_Scr(void);
void Show_Uarms_Scr(char *string);#endif /* __LCD12864_H */

LCD12864参考手册

这个网上一大堆,程序都是按照手册来写的,你可以去某个卖LCD12864的淘宝店,淘宝店页面就会分享有各种配套资料。



找不到的就私聊我

STM32 LCD12864 原理和实现代码相关推荐

  1. 【初篇】DHT11连接STM32、One wire单总线原理、GPIO代码详解

    目录 一.DHT11单总线原理 二.代码详解 三.代码 代码见文章末尾 一.DHT11单总线原理 DHT11温湿度传感器只需要一根线即可和MCU进行数据交换,无数据传输时,单线应为高电平状态,具体流程 ...

  2. MODBUS-RTU协议主机和从机代码STM32 包含2个程序代码,主机和从机

    MODBUS-RTU协议主机和从机代码STM32 包含2个程序代码,主机和从机(代码易懂) 基于温度传感器DS18B20的MODBUS-RTU从机 主机发送指令:01 03 20 00 00 01 8 ...

  3. Decawave官方双边测距(一对一)原理介绍及代码实现

    Decawave官方双边测距(一对一)原理介绍及代码实现 一.运行平台 运行软件平台:Keil5 运行硬件平台:STM32 开发板型号:UWB-S1学习板 开发板淘宝链接:https://item.t ...

  4. STM32 中断原理及外部中断的实现

    STM32 中断原理及外部中断的实现 NVIC 中断优先级管理 中断寄存器 库函数配置 小结 STM32 外部中断 基础知识 库函数配置 外部中断配置示例 小结 内容较充实,作为个人的学习记录 NVI ...

  5. 色彩(颜色)空间原理(实现代码)

    色彩(颜色)空间原理(实现代码) 编写代码 对于代码示例,我将展示生成线性变换矩阵的算法和在sRGB空间和XYZ空间之间进行完全转换的示例.为了实现其他RGB空间,您只需要实现适当的gamma校正曲线 ...

  6. 彻底搞透视觉三维重建:原理剖析、代码讲解、及优化改进

    视觉三维重建 = 定位定姿 + 稠密重建 + surface reconstruction +纹理贴图.三维重建技术是计算机视觉的重要技术之一,基于视觉的三维重建技术通过深度数据获取.预处理.点云配准 ...

  7. php 图片预览原理,JavaScript_纯JS实现的批量图片预览加载功能,1.实现原理直接见代码,需要一 - phpStudy...

    纯JS实现的批量图片预览加载功能 1.实现原理直接见代码,需要一张转圈的小图片,需要预览的所有图片默认的位置全是这张小图片,滚轮滚到原图需要出现的位置时候,预览加载替换小图片.实现效果 复制代码 代码 ...

  8. jQuery 原理的模拟代码 -4 重要的扩展函数 extend

    在上两篇文章中,我们看到每次要通过 jQuery 的原型增加共享方法的时候,都需要通过 jQuery.fn 一个个进行扩展,非常麻烦,jQuery.fn.extend 提供了一个扩展机制,可以方便我们 ...

  9. java加密解密代码_base64位加密解密原理及js代码实现

    base64位加密解密原理及js代码实现 在网上找了很多关于Base64加密解密的原理以一个比较通俗易懂的方式理解整理了一下大致原理如下 先上base64对照表 #加密 #1:将明文对照以acsii码 ...

最新文章

  1. set debug mode for flex builder
  2. CentOS5.4下安装和配置Apache、PHP、MySql、PHPMyAdmin
  3. 20155231 实验三 敏捷开发与XP实践
  4. Coding the Matrix Week 2 The Vector Space作业
  5. redis命令_INCR
  6. java reader 组合_Java IText 拼接合并PDF的三种方法
  7. 画出清明上河图的代码_怎样用一串代码画出《清明上河图》?
  8. joycon手柄拆解_任天堂switch手柄怎么拆解图文教程 教你如何拆joycon
  9. projection theorem
  10. 专访吴军:未来10年,AI的发展方向是应用,不会出现重大的理论突破
  11. 超声波水下通讯测试接收发射信号的完整性
  12. python vimdiff_vimdiff使用技巧
  13. 杏花巷口,清香两拂袖
  14. 亲测centos下mysql安装,不行锤我
  15. C++ reverse
  16. 使用python自动上传apk到蒲公英
  17. 【杂记】DirectX9实现粒子特效
  18. java 设计模式实战,适配器模式之万物拟人化
  19. facebook用户数量
  20. 分布式事务详解(看完不懂我当场认做你哥)

热门文章

  1. 西部数码虚拟主机服务器配置,西部数码虚拟主机预装软件功能介绍
  2. GNU/Linux 正则表达式与三剑侠(grep,sed,awk)(精)
  3. image adaptive 3dlut based on deep learning
  4. RPG游戏-小地图系统
  5. Android webview加载本地html详细教程
  6. 安卓自动无限试玩,只需一根WiFi玩法
  7. java 高精度数据类型_java基本数据类型
  8. 1400协议是什么和28181区别_28181平台对接接口详解
  9. TOUGH2系列建模方法及在CO2地质封存、水文地球化学、地热、地下水污染等领域中的技术
  10. 韩顺平Java学习 泛型