搜索
Search
回康医疗
jiajie Where are you now:
Homepage
/
/
Write your e-paper driver demo (Arduino IDE) according to the specification flow chart and command table

Write your e-paper driver demo (Arduino IDE) according to the specification flow chart and command table

  • Categories:News
  • Author:
  • Origin:
  • Time of issue:2022-11-17 22:47
  • Views:

(Summary description)

Write your e-paper driver demo (Arduino IDE) according to the specification flow chart and command table

(Summary description)

  • Categories:News
  • Author:
  • Origin:
  • Time of issue:2022-11-17 22:47
  • Views:
Information

Write your e-paper driver demo (Arduino IDE) according to the specification flow chart and command table

-Take the 2.13 inch electronic ink screen GDEY0213B74 of Good Display as an example

 

 

 

 

 

 

How does the E-paper display work?

 

The electronic ink screen uses the electrophoretic display technology mastered by E Ink to drive the charged microcapsule particles to work by changing the applied voltage. Each pixel is composed of a single e-ink, that is, a microencapsulated unit. Each capsule contains liquid charge, in which positive charge is dyed white and negative charge is dyed black. When a positive or negative voltage is applied to one side, the charged liquid will be attracted and repelled respectively to display a black or white image.

 

2.1Hardware parameters of the 2.13 inch E-Paper display GDEY0213B74

 

 

 

#Meaning of parameter symbols
Single grounding Vss
Logic supply voltage Vci
Logic high level Voh
Logic low level Vol
Typical power Ptyp
Sleep power Psleep
Sleep current
Deep sleep current Idsleep
VCOM pin output

 

 

Work Flow Chart of E-paper Display

 

 

 

Flow Chart with Example Code in Details

 

 

 

 

1. Supply power to the screen. Generally, 3.3V power is recommended
2. Initialize configuration
2.1. In this step, you need to configure SPI communication between ink screen and MCU, that is, IO setting
For SPI and SPI communication configuration of this ink screen, please refer to 6.3 Panel AC Characteristics in the specification
Refer to the following code:

 

 

#include <SPI.h>
#include"Ap_29demo.h"
//IO settings
int BUSY_Pin = 4; 
int RES_Pin = 5; 
int DC_Pin = 6; 
int CS_Pin = 7; 

#define EPD_W21_CS_0 digitalWrite(CS_Pin,LOW)
#define EPD_W21_CS_1 digitalWrite(CS_Pin,HIGH)
#define EPD_W21_DC_0  digitalWrite(DC_Pin,LOW)
#define EPD_W21_DC_1  digitalWrite(DC_Pin,HIGH)
#define EPD_W21_RST_0 digitalWrite(RES_Pin,LOW)
#define EPD_W21_RST_1 digitalWrite(RES_Pin,HIGH)
#define isEPD_W21_BUSY digitalRead(BUSY_Pin)
void setup() {
   pinMode(BUSY_Pin, INPUT); 
   pinMode(RES_Pin, OUTPUT);  
   pinMode(DC_Pin, OUTPUT);    
   pinMode(CS_Pin, OUTPUT);   
   //SPI
   SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); 
   SPI.begin ();  
}

 

 

2.2. According to the flow chart, after completing the SPI communication configuration, you need to perform the hardware initialization and software initialization of E-paper display:

 

/////////////////EPD settings Functions/////////////////////

void EPD_HW_Init(void)
{
  EPD_W21_RST_0;  // Module reset   
  delay(10);//At least 10ms delay 
  EPD_W21_RST_1;
  delay(10); //At least 10ms delay 
  
  Epaper_READBUSY();   
  Epaper_Write_Command(0x12);  //SWRESET
  Epaper_READBUSY();   

 

 

 

 

3. Send initialization code
The code fragments involved in this section are as follows:

 


 

  Epaper_Write_Command(0x01); //Driver output control      
  Epaper_Write_Data(0xF9);
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x00);

  Epaper_Write_Command(0x11); //data entry mode       
  Epaper_Write_Data(0x01);

  Epaper_Write_Command(0x44); //set Ram-X address start/end position   
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x0F);    //0x0F-->(15+1)*8=128

  Epaper_Write_Command(0x45); //set Ram-Y address start/end position          
  Epaper_Write_Data(0xF9);   //0xF9-->(249+1)=250
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x00); 

  Epaper_Write_Command(0x3C); //BorderWaveform
  Epaper_Write_Data(0x05); 

 

 

3.1. Driver Output Control


This part needs to write 3 bytes of data:
Write 0xF9 to A [8:0], that is, (249+1), and open a total of 250 gates
Write 0x00 to B [2:0], that is, from G0 to G249, G0 as the first output gate; Scanning sequence 0, 1, 2, 3... 249; Scan order from 0 to 249

 

 

3.2. Data Entry Mode Setting

 

 

 

Write instruction 0x11, and write 0x01 to A [2:0], that is, ID [1:0]=01, AM=0


According to the following figure and explanation, we set this mode:
The address counter will be updated in the X direction; And every time the data is written to RAM, the Y address counter automatically decreases by 1, and the X address counter automatically increases by 1

 

There is an address counter inside, which automatically adds or subtracts addresses in a certain direction, and sets the direction through AM; ID controls addition and subtraction.


When ID [0]="1", the X address counter will automatically increase by 1 after the data is written to RAM.
When ID [0]="0", the X address counter will automatically decrease by 1 after the data is written to RAM.
When ID [1]="1", the Y address counter will automatically increase by 1 after the data is written to RAM.
When ID [1]="0", the Y address counter will automatically decrease by 1 after the data is written to RAM.
When AM="0", the address counter is updated in the X direction.
When AM="1", the address counter is updated in the Y direction.
When the window address is selected, data will be written to the RAM area specified by the window address in the way specified by ID [1:0] and AM bits.

 

3.3. Set RAM X&Y-Address Start/End Position

 

 

 

  Epaper_Write_Command(0x44); //set Ram-X address start/end position   
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x0F);    //0x0F-->(15+1)*8=128

  Epaper_Write_Command(0x45); //set Ram-Y address start/end position          
  Epaper_Write_Data(0xF9);   //0xF9-->(249+1)=250
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x00);
  Epaper_Write_Data(0x00); 

 

 

 

You need to use the 0x44, 0x45 command now


0x44: A [5:0] Set the starting address in X direction of the window 0x44: B [5:0] Set the ending address in X direction of the window
Write 0x00 and 0x0F respectively, and confirm that X starts at 0 and ends at (15+1) * 8=128
0x45: A [8:0] Set the starting address in Y direction of the window 0x45: B [8:0] Set the ending address in Y direction of the window

According to the mode determined by 0x01 written in 0x01,

 

 

The start address is set at 249 and the end address is set at 0.

 

 

3.3. Border Waveform Control

 

Epaper_Write_Command(0x3C); //BorderWaveform
  Epaper_Write_Data(0x05);

 

 

 

4. Load Waveform LUT

 

 


  Epaper_Write_Command(0x18); //Read built-in temperature sensor
  Epaper_Write_Data(0x80);  

 

 

 

 

5. Display you E-paper

 

0x4E, 0x4F Set the initial value of RAM address counter
0x4E: A [5:0] Set the value of X direction counter of current RAM address, X is 0
0x4F: A [7:0] Set the value of the Y direction counter of the current RAM address, Y is 249

 

 

Epaper_Write_Command(0x4E);   // set RAM x address count
  Epaper_Write_Data(0x00);
  Epaper_Write_Command(0x4F);   // set RAM y address count  
  Epaper_Write_Data(0xF9);
  Epaper_Write_Data(0x00);

                              

Next, execute the 0x24 command. For the GDEY0213B74 black and white ink screen, write 0 for black and 1 for white, which correspond to 0x00 and 0xff respectively.

 

//////////////////////Single display///////////////////////////////////

void EPD_WhiteScreen_Black(void)
{
   unsigned int i;
    Epaper_Write_Command(0x24);   //write RAM for black(0)/white (1)
    for(i=0;i<4000;i++)
    {
        Epaper_Write_Data(0x00);    
    }
    EPD_Update();
}

void EPD_WhiteScreen_White(void)
{
   unsigned int i;
    Epaper_Write_Command(0x24);   //write RAM for black(0)/white (1)
    for(i=0;i<4000;i++)
    {
        Epaper_Write_Data(0xff);    
    }
    EPD_Update();
}

*0x0C Instructions called when calling external waveforms are not involved in this demo


/////////////////////////All screen update//////////////////////////////
void EPD_WhiteScreen_ALL(const unsigned char * datas)
{
   unsigned int i;
    Epaper_Write_Command(0x24);   //write RAM for black(0)/white (1)
   for(i=0;i<4000;i++)
   {               
     Epaper_Write_Data(pgm_read_byte(&datas[i]));
   }
   EPD_Update();   
}
void EPD_WhiteScreen_ALL_Fast(const unsigned char *datas)
{
   unsigned int i;  
  Epaper_Write_Command(0x24);   //write RAM for black(0)/white (1)
   for(i=0;i<4000;i++)
   {               
      Epaper_Write_Data(pgm_read_byte(&datas[i]));
   } 
   
   EPD_Update_Fast();  
}
/////////////////////////////////////////////////////////////////////////////////////////
void EPD_Update(void)
{   
  Epaper_Write_Command(0x22); //Display Update Control
  Epaper_Write_Data(0xF7);   
  Epaper_Write_Command(0x20); //Activate Display Update Sequence
  Epaper_READBUSY();  

}
void EPD_Update_Fast(void)
{   
  Epaper_Write_Command(0x22); //Display Update Control
  Epaper_Write_Data(0xC7);   
  Epaper_Write_Command(0x20); //Activate Display Update Sequence
  Epaper_READBUSY();   

}
void EPD_Part_Update(void)
{
  Epaper_Write_Command(0x22);//Display Update Control 
  Epaper_Write_Data(0xFF);   
  Epaper_Write_Command(0x20); //Activate Display Update Sequence
  Epaper_READBUSY();      
}
void EPD_DeepSleep(void)
{  
  Epaper_Write_Command(0x10); //enter deep sleep
  Epaper_Write_Data(0x01); 
  delay(100);
}
void Epaper_READBUSY(void)
{ 
  while(1)
  {   //=1 BUSY
     if(isEPD_W21_BUSY==0) break;
  }  
}

                                                    

5.1 Display Update Control


The above code fragments design three ways to update the ink screen:

 

EPD_Update        Epaper_Write_Data(0xF7);
EPD_Update_Fast   Epaper_Write_Data(0xC7);
EPD_Part_Update   Epaper_Write_Data(0xFF);

 

Epaper_Write_Command(0x21); //  Display update control
  Epaper_Write_Data(0x00);    
  Epaper_Write_Data(0x80);

 

 

 

 

If 0x00 is written, there are:
A[7:4] 0000-Normal
A[3:0] 0000-Normal
B [7] Writing 0x80 corresponds to 1, S8toS167 (writing 0x00 corresponds to S0toS175)
If you change 0x80 to 0x00, the actual effect is equivalent to moving the whole picture up by 8bit

 

                             

 

for(i=0;i<4000;i++)

comes from Ap_29demo.h

const unsigned char gImage_basemap[4000]

Therefore, you need to perform image processing first. The resolution of the image must be 250x122, and then follow the steps in the image processing instruction document (used with Image2LCD software); You can also directly use the online tool of Good Display - ImageToArray, so you only need to ensure that the image resolution meets 250x122 and the image format supports jpg and png.


If you select the vertical scanning mode, you will get 4000 bytes;

 

If you select the vertical scanning mode, you will get 3904 bytes; and you will get :

for(i=0;i<3904;i++)

 

6. E-paper display finished image update and enters sleep mode

void EPD_DeepSleep(void)
{  
  Epaper_Write_Command(0x10); //enter deep sleep
  Epaper_Write_Data(0x01); 

Scan the QR code to read on your phone

Generation Z and smart home, the prospect of smart display terminals
Generation Z and smart home, the prospect of smart display terminals
Get your hands on a E-paper display from scratch-Learn to play it-02-Full Refresh
Get your hands on a E-paper display from scratch-Learn to play it-02-Full Refresh
Insight into Future Trends of E-paper Display, Higher Market Demands, Broader Vision
Insight into Future Trends of E-paper Display, Higher Market Demands, Broader Vision
Get your hands on a E-paper display from scratch-Learn to play it
Get your hands on a E-paper display from scratch-Learn to play it
Why we need E-paper display? Future trend you need know
Why we need E-paper display? Future trend you need know
Previous page
1
2
14
这是描述信息

Address:No.18, Zhonghua West Road, Dalian, China,116033  

E-mail: sales@eink-display.com

img img img
img img img

©2007-2021   Dalian Diamo Electronic Technology Co., Ltd.   All Rights Reserved.   辽ICP备08000578号-1   Website construction:www.300.cn dalian.300.cn 

Dalian Diamo Electronic Technology Co., Ltd.   

辽ICP备08000578号  
Website construction:www.300.cn
 jinzhou.300.cn