LCD screen uses ST7567G+UC1701E

LCD screen usage record

      • LCD screen usage record
      • 1-Screen introduction
      • 2-ST7567G screen
      • 3-UC1701 screen
      • 4-Code Example
      • 4-Points of attention

1-Screen Introduction

Since the project uses the screen, make a simple record backup
The screen uses 128*64 dot matrix screen
The model number is ST7567G + UC1701E
Using SPI driver

Brief description of screen dot matrix display principle:

  1. The screen is 128*64 pixels
    Each bit controls one pixel

  2. Use LCD_RAM[8][128] array cache
    X axis-128 corresponds to 0-127 abscissa
    Y axis-8 corresponds to pages 0-7, vertical coordinate

  3. Function encapsulation:
    The X-axis is written in pixels
    The Y axis is written in page units

  4. The modulo size is 1616
    Characters are 8
    16
    Chinese characters are 16*16

  5. 1 pixel uses 1bit control
    One character is 816 and takes up 16 bytes,
    A Chinese character is 16
    16, occupying 32 bytes

  6. Character example:

Data writing example

2-ST7567G screen

  1. Support SPI and IIC driver
  2. Screen IO interface
    RSTB + CSB + A0 + RWR

  3. Read and write screen status and data
  4. Example of writing data to the screen:

3-UC1701 screen

  1. Read and write screen data

4-Code Example

/*
***Transfer LCD data-SPI
***In pages
***Write data page, column, data, length
**Pages 0-7
/
void LCD_WriteDataString(uint8_t page,uint8_t colume,uint8_t
Data,uint8_t DataLen)
{
//Screen difference command
if( LCD.DrvVer == UC1701)
{
//Transfer command
LCD_WriteCmd(0xB0 + page); //Set page address (0~7)
LCD_WriteCmd(0x04); //Column address high byte
LCD_WriteData(0x00); //Column address low byte
LCD_WriteCmd(0x01); //Write data
}
else if( LCD.DrvVer == LCD_T_ST7567 )
{
//Transfer command
LCD_WriteCmd(0xB0 + page);//Set page address (0~7)
LCD_WriteCmd(0x10); //Set column address high byte
LCD_WriteCmd(0x00); //Set column address low byte
}
else
{
return ;
}
//transfer data
LCD_DRV_CSB_LOW();
LCD_DRV_A0_HIGH();
spi_master_tx_rx((void
)lcd_spi_base_address,DataLen,Data, NULL);
LCD_DRV_CSB_HIGH();
}

4-Notes

  1. When powering on, you can tell which screen it is based on the different writing methods and reading instructions of the two screens.
  2. UC1701-CMD=0X02
  3. ST7567-CMD=0XFD
  4. Supports hot-swapping, and periodically detects the screen status, such as abnormal screen reading. If the reading is normal, the reset pin initializes the screen and refreshes the cache.

Reference 1
//Screen difference command
if(lcd_param.l_p_device_type == LCD_T_UC1701)
{
//Transfer command
LCD_WriteCmd(0xB0 + page); //Set page address (0~7)
LCD_WriteCmd(0x04); //Column address high byte
LCD_WriteData(0x00); //Column address low byte
LCD_WriteCmd(0x01); //Write data
}
else if(lcd_param.l_p_device_type == LCD_T_ST7567)
{
//Transfer command
LCD_WriteCmd(0xB0 + page); //Set page address (0~7)
LCD_WriteCmd(0x10); //Set column address high byte
LCD_WriteCmd(0x00); //Set column address low byte
}

Reference 2
59 Specifies the page number value page and column column starting from the character
60 */
61 void Lcd_address(unsigned char page, unsigned char column)
62 {
63 column = column – 1; //Start counting from the number 1
64 page = page – 1; //Start counting from the number 1
65 Transform_Cmd(0xb0 + page); //Set the address of the beginning of the page
66 Transform_Cmd( ((column>>4) & amp;0x0f) + 0x10 ); //Set the address of the beginning of the line, the high four bits
67 Transform_Cmd(column & amp;0x0f); //lower four bits
68 }

Reference 3
void Set_Pos(unsigned char x, unsigned char y) {
Write_IIC_Command(0xb0 + y); //Set the starting address of the target display position page. The value range is 0xb0 ~ 0xb7, a total of 8 pages.
Write_IIC_Command(((x & amp; 0xf0) >> 4) | 0x10); // Set the high bits of the column starting address. Only the lower 4 bits are available. Finally, 0x10
Write_IIC_Command(x & amp; 0x0f); // Set the low bits of the column starting address. Only the lower 4 bits are available.

Reference 4
//Write address
if(lcd_param.l_p_device_type == LCD_T_UC1701)
{
LCD_WriteCmd(0xB0 + y); //Set page address (0~7) Insert code piece here
LCD_WriteCmd(0x04); //Column address high byte
LCD_WriteData(0x00 + x); //Column address low byte
LCD_WriteCmd(0x01); //Write data
}
else if(lcd_param.l_p_device_type == LCD_T_ST7567)
{
LCD_WriteCmd(0xB0 + y); //Set page address (0~7)
LCD_WriteCmd(0x10 + ((x & amp;0xF0)>>4) ); //Set column address high byte
LCD_WriteCmd(0x00 + (x & amp;0x0F) ); //Set column address low byte
}
//write data
LCD_WriteData(string);

This is a standard runnable example
**//Write address
if(lcd_param.l_p_device_type == LCD_T_UC1701)
{<!-- -->
LCD_WriteCmd(0xB0 + y); //Set page address (0~7)
LCD_WriteCmd(0x04); //Column address high byte
LCD_WriteData(0x00 + x); //Column address low byte
LCD_WriteCmd(0x01); //Write data
}
else if(lcd_param.l_p_device_type == LCD_T_ST7567)
{<!-- -->
LCD_WriteCmd(0xB0 + y); //Set page address (0~7)
LCD_WriteCmd(0x10 + ((x & amp;0xF0)>>4) ); //Set column address high byte
LCD_WriteCmd(0x00 + (x & amp;0x0F) ); //Set column address low byte
}
//write data
LCD_WriteData(string);**