The ink screen driver module is now used in Dalian Jiaxian 4.2-inch ink screen. There are notes on the ink screen program and instructions for use. Please see below.
Module introduction:
- Module volume: 30mm*36mm
- Supply voltage: 5 V
- Ink screen suitable for SPI communication. This module connects the control chip and the bare screen. The main control board uses the VET6 basic board.
The module as a whole is relatively simple, but there are still a few things that need attention and need to be looked at carefully:
- on power
- The 4.2-inch screen used this time requires a 5V power supply.
- For e-ink screens above 2.9 inches, such as 3.5-inch, 4.3-inch, 6-inch, and 8-inch e-paper, if a 3.7V lithium battery is used for power supply, a boost IC is required to increase 3V to 5V. For 2.04-inch or 2.9-inch electronic paper and smaller sizes, there is no need for a boost IC, and it can be driven directly by 3V.
- Main control board selection
- Component selection
- The capacitor withstand voltage value needs to be greater than or equal to 15V. For the selection of MOS tube, the officially recommended model is Si1304BDL or Si1308EDL. Of course, you can also choose a similar MOS according to the parameters. The current value of the inductor should not be too small. Make sure it is above 500mA. It may be too small. Can cause fever.
- The FPC socket is a very important component. The pull-out FPC connector is used here . Be sure to pay attention to the pin order of the FPC socket . The schematic diagram must not have the first and last pins upside down. Pay attention to comparison.
- welding
- Since the FPC row seats are 0.5mm apart, welding is slightly more difficult. It is recommended to solder the row seats first and then other components.
- Refresh method
- Only monochrome ink screens support partial refresh, and color ink screens only support full refresh.
- Full refresh: E-paper refresh requires the screen to flash multiple times before finally displaying the required screen. The purpose of flashing is to clear the display residual image to achieve the best display effect.
- Partial brushing: There is no screen flicker when e-paper is refreshed. When using it, the user needs to perform a full brushing operation after refreshing several times to clear the display afterimages.
- way of communication
- Use analog SPI communication method, SPI working frequency should not exceed 2MHz
- IO port configuration input: BUSY output: CS, RES, D/C, SCLK, SDIN.
Program migration steps
- To download the test program, you can download it directly from the attachment or log in to the official website to download it.
- Modify the pins and start running the routine
- The original program is written in keil 4. If you are using keil 4, you can open it directly. If you are using keil 5, you need to change the properties, otherwise you may not be able to download it.
- actual process
- Modify the suffix of the keil 4 project file to keil 5 project file
- Specifically, add the letter x to the project file suffix, and the properties will automatically change.
Originally it was
Later it was
- According to your own pin definition, change the program. If it is just for testing, then change the pin sequence interface. The official routine comes with a display effect.
- We first open the file under the EPD file
Display_EPD_W21_spi.c
and need to modify void EPD_GPIO_Init(void)
the pin initialization function in the function. The following picture is the changed content.
* Open Display_EPD_W21_spi.h
the file and modify the pin macro definition
The actual effect is as follows
Ink Screen Program Instructions
Next, the display steps of the three-color ink screen will be briefly explained, and the functions that need to be used will be explained in detail. For different display contents, corresponding function calling templates will be given, which can be called directly. After reading this article , you can control the ink screen as easily as you control a common OLED.
- The display content of the ink screen is also composed of pixels one by one. This time, the 4.2-inch ink screen is used. Its pixel size is 400x300, that is, the X-axis coordinate range is 0~400, and the Y-axis coordinate range is 0 ~ 300
- The three-color ink screen cannot be partially refreshed and is suitable for situations where the display content does not need to change frequently. For partial refresh, a two-color ink screen using black and white can be used.
- The contents that can be displayed on the ink screen include: the entire picture, specified characters and text, specified dots, lines, circles, rectangles and other graphics
- How does a three-color ink screen display three colors? In fact, it is a superposition of two pictures. First, the black and white picture is placed on the bottom layer, and then a red and white picture is superimposed on the upper layer.
- To transplant the ink screen program, you only need to modify the definition of IO. BUSY needs to be set to input mode, and other pins need to be set to output mode.
- The display method of the entire picture is different from that of the specified character graphics and other contents.
Description of some basic functions:
function name |
parameter |
function effect |
Comment |
---|
EPD_GPIO_Init(); |
null |
GPIO initialization |
|
EPD_init(); |
null |
Ink screen initialization |
|
EPD_sleep(); |
null |
Enter sleep mode |
Necessary functions, cannot be deleted |
delay_s(a); |
seconds |
delay function |
Delay a second |
PIC_display_Clear(); |
null |
Clear screen function |
Clear screen content |
EPD_init_GUI(); |
null |
GUI initialization |
Load GUI |
Paint_SelectImage(); |
array pointer |
Set virtual canvas data storage location |
|
Paint_Clear(); |
Color(WHITE BLACK RED) |
Clear picture color |
Not used alone |
EPD_Display(); |
array pointer |
display function |
Display the specified content |
Paint_DrawNum(); |
X, Y, number, size, background block color, number color |
Specify digital content |
Not used alone |
Paint_DrawPoint(); |
X, Y, color, thickness, fill style |
Draw points at specified coordinates |
Not used alone |
Paint_DrawLine(); |
X0, Y0, X1, Y1, color, solid/dashed line, thickness |
Draw a straight line with any slope |
Not used alone |
Paint_DrawRectangle(); |
X0, Y0, X1, Y1, color, whether to fill, thickness |
Draw a rectangle |
Not used alone |
Paint_DrawCircle(); |
Circle center X, circle center Y, radius R, color, whether to fill, thickness |
Draw a circle of specified size at a specified location |
Not used alone |
Paint_DrawString_EN(); |
X, Y, string, size, background block color, font color |
display string |
Not used alone |
Paint_DrawString_CN(); |
X, Y, Chinese characters or strings, size, background block color, text color |
Display the specified Chinese characters at the specified position |
Not used alone |
Specific implementation of the program:
- Program initialization
- Program initialization includes initialization of ink screen, initialization of pins, initialization of interrupts, and GUI initialization.
- necessary process functions
- Setting functions: including setting canvas space, setting screen size and display direction, etc.
- Clear function: applied to display characters and other content, functions required for the transition process
- Sleep function: After the electronic screen is refreshed, it must enter sleep mode and then re-initialize.
- The display process of the entire image and the specified characters are different, which will be explained separately below.
Display of the entire image
- The steps to display the entire image are to first take the modulus and then call the following four functions. You can call them directly. No function can be omitted.
EPD_init(); //初始化
PIC_display(gImage_BW,gImage_R); //显示函数
EPD_sleep(); //睡眠模式,不可删除
delay_s(2); //延时2s
- Specific instructions:
- By calling the above four lines of statements, the stored image can be displayed on the screen. The black and white image is on the bottom layer, and the red and white image is on the top layer. The three-color effect is achieved by superimposing. The dot matrix data of the image is stored in
Ap_29demo.h
the file and stored separately in two arrays. gImage_BW[15000]
Store black and white image data and gImage_R[15000]
red and white image data. Do not modify the names of the two arrays. We only need to modify the dot matrix data.
- Image taking can
image2lcd
be achieved through software, which is included in the attachment.
- Note that the required format of the image is: Size: 400 * 300. The file format is .bmp file. Try to use two colors with large differences.
- The software needs to be registered first to eliminate the watermark. The registration code can be 0000-0000-0000-0000-6A3B. The software can set the parameters as shown below. Then click to open the imported image. If you want to display it normally, check the box before color inversion and adjust Adjust the brightness and contrast to achieve the best display effect, then save it as
.c
a file, copy the hexadecimal file and replace it with the two array files.
- Call the above four sentences function in . If you don’t need to loop the display, just
while(1)
add one sentence after the four sentences.while(1);
Specify the display of characters, graphics, etc.
- Steps: Initialize → Set black and white space → Specify black and white content → Clear color → Set red and white space → Specify red and white content → Clear color → Display → Sleep
- A template will be given below:
Paint_NewImage(BW_Image,EPD_WIDTH,EPD_HEIGHT,0,WHITE); //设置黑白屏幕尺寸和方向
Paint_NewImage(R_Image,EPD_WIDTH,EPD_HEIGHT,0,WHITE); //设置红白屏幕尺寸和方向
EPD_init_GUI(); //初始化GUI
Paint_SelectImage(BW_Image); //设置黑白画布空间
Paint_Clear(WHITE); //清除图片颜色
/* 指定黑白内容开始 */
/* 指定黑白内容结束 */
Paint_SelectImage(R_Image); //设置红白画布空间
Paint_Clear(WHITE); //清除图片颜色
/* 指红白内容开始 */
/* 指定红白内容结束 */
EPD_Display(BW_Image,R_Image); //显示图像
EPD_sleep(); //进入必要的休眠模式,不可删除
delay_s(2); //延时2s
-
Specific instructions
- To display the specified content, copy the above statement, and then write the specified content between the two lines of comments. The different contents will be introduced below.
- The execution flow of the above program is: first set the screen parameters, then initialize the GUI, that is, the graphical user interface, and then set the underlying black and white display space, then you can write the black and white content. After specifying the content, set the red and white space, and write Enter the red and white content. At this point, all the content to be displayed has been specified, but it cannot be displayed only here. You need to call the display function to display the above content and finally enter the sleep mode.
- To display numbers, English characters, draw points, lines, circles, and rectangles, you can directly call the function. To display Chinese, you need to take the font first. The font taking software is also placed in the attachment. The process of taking the font will be introduced below.
- Try not to modify the above program at will. For example: if the data space is not set, delete Paint_SelectImage(BW_Image); then the bottom layer will be all black, and if Paint_SelectImage(R_Image) is not set; then the top layer will be all red.
- The following will introduce how to display numbers, characters, points, lines, rectangles, circles, and Chinese characters. You only need to put them in the comments of the above program.
-
- Display numbers and strings, because the use of the two is similar, so they are put together
- Examples of display numeric functions:
Paint_DrawNum(0, 0, 123456789, &Font24, WHITE, BLACK);
- Example of display string function:
Paint_DrawString_EN(0, 70, "Hallo World", &Font24, BLACK, WHITE);
- The parameters from the left are: starting X coordinate, Y coordinate, displayed number/string, number/string size, background size, number/string size
- X coordinate range: 0 ~ 400 Y coordinate range: 0 ~ 300
- The two functions are relatively simple to use. The first three are easy to understand. Let’s talk about the last three parameters:
- &Font24: Character sizes, there are 5 types in total, namely &Font8, &Font12, &Font16, &Font20, &Font24, you can use it directly
- Background color: The display area of the characters on the ink screen is a rectangle. The specified content can be displayed if the display color of the background block and the characters are opposite. This parameter is the color of the background block.
- Character color: the color of the text. Different background and text colors can achieve an inversion effect.
- Display point at specified location
- Call functions:
Paint_DrawPoint(X, Y, BLACK, DOT_PIXEL_8X8, DOT_STYLE_DFT);
- Parameters: whether the size of the color point for the X coordinate Y coordinate point is filled
- The size range of the points is 1X1 ~ 8X8, and the default points are filled.
- Draw a line segment with any slope
- Call functions:
Paint_DrawLine(X0, Y0, X1, Y1, BLACK, LINE_STYLE_SOLID, DOT_PIXEL_8X8);
- Parameters: From left to right - X coordinate, Y coordinate of the starting position, X coordinate, Y coordinate of the key position, line color, solid line or dotted line, line thickness
- After the first four functions, namely the starting point (X, Y) and the end point (X, Y), in this way, an arbitrary slope is reached
- Next is the type of line: solid line or dashed line, the default is solid line
- The last thing is the thickness of the line, which is also 1X1 ~ 8X8
- Displays a rectangle of specified size at a specified location
- Call functions:
Paint_DrawRectangle(X0, Y0, X1, Y1, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1);
- Parameters: coordinates X and Y of the upper left corner, coordinates X and Y of the lower right corner, the color of the rectangle, whether it is filled, and the thickness of the sides
- The image below shows the difference between padding and no padding
- Show any circle
- Call functions:
Paint_DrawCircle(X, Y, R, BLACK, DRAW_FILL_EMPTY, DOT_PIXEL_1X1);
- Parameters: coordinates of the center of the circle - (X, Y), radius R, color, whether to fill, and thickness of the circle
- The image below shows the difference between padding and no padding
- Display Chinese characters
- Call functions:
Paint_DrawString_CN(X,Y, "菊花台", &Font24CN, WHITE,BLACK);
- Parameters: starting point coordinates (X, Y), displayed Chinese, Chinese font size, background color, text color
- Among them, font size only supports
Font12CN
andFont24CN
- When using Chinese, you need to manually take the character model. You can use the model taking software
PCtoLCD2002
. I will put it in the attachment. Please see the picture below for the software parameter settings. You need: Yin code line by line forward output hexadecimal C51 format
Font12CN
The corresponding character width and height are 16 x 21. The settings are as follows. You can also change the font
Font24CN
The corresponding character width and height are 32 x 41, set as follows
- Next, enter text and click
生成字模
, and hexadecimal data will be automatically generated:
- If you need
Font12CN
model text, open the file FONTS
under File font12CN.c
and copy the data generated by the modulo software just now into the array. It should be noted that the format of the generated data needs to be the same as the format of the example given, that is
{"你",
0x00,0x00,0x00,0x10,0x00,0x10,0x02,0x20,0x06,0x20,0x06,0x7E,0x0C,0x73,0x0C,0xC7,
0x19,0x9C,0x1B,0x10,0x38,0x10,0x68,0x92,0x09,0x93,0x09,0x93,0x0B,0x11,0x08,0x70,
0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
},/*"你"*/
Font24CN
The steps are the same for the model. As long as you have the font in the array, you can use it freely in the function.