I can't figure out how to output 4-bit graphics to the display.
jlx256160_st75256.pdf (614,0 КБ)
ST75256_V1.4 (1).pdf (2,6 МБ)
Some documentation. Seek page 90 of the PDF (page 82 of the document).
hi I' ve found a Library from BuyDisplay.com thats works with st75256 lcd controller. This Library allows to display Grayscale Images, you shouldn't have any problems if your display's resolution is 192x96. I'm having some problems because my display uses 256x128 resolution. The library works well, but i cannot use all the display surface.
What library?
because i'm a new user i can't post the file, but you can get from Buydisplay.com. In the search bar of Buydisplay you can find a single display with st75256 controller and you can find here the Arduino library. There is a single problem works on your display but it will use only 192x96 pixels. You should work on library code to get it compatible
Read 10 posts on 10 topics for 10 minutes (or something like that) and you will be authorized to post files.
Okok i'll do it
recovered_ERM19296-1_Arduino_Tutorial.zip (139,8 KB)
This is the Library. To get a usable contrast you should change the Contrast Value: In the Library code you'll find the init sequence: data(Contrast&0x3F);
data((Contrast>>4)&0x07);
change the Value to 4, and you can use your display.
data(Contrast&0x3F);
data((Contrast>>6)&0x07);
the display started at these settings
- add library for ESP32 dev 1
#include <pgmspace.h>
Probably because your is not the same as mine, mine is 256x128, your is 256x160. Now the problem is to adapt the library for our display's resolution.
Ps i'm using STM32F401 based MCU.
How to generate bitmap images
- Make sure the resolution of the image is less than 800 x 600 pixels. Start the tool mspaint.exe on Windows to open the image to be converted;
- Select the option 24-bit bitmap' in the Save as Type list, to save the image as a BMP format file;
- Start the software tool provided by Waveshare: uC-GUI-BitmapConvert.exe;
- Click File -> Open, and select the bitmap image you want to convert;
- Click Image -> Convert Into -> Gray4 (2 BPP);
- Click File -> Save As, and select the option *Windows Bitmap file(.bmp)' in the Save as Type list, and then enter the correct file name and save the image. Please take note of the format of the file name.
this is to create bitmaps, but the library uses only 192x96 pixels, on a surface of 256x128 pixels. i want adapt the code to use the full resolution of my display. but on your diaplay how works the library?
The image is displayed on half the screen. In addition, when creating images (2 bit), the output is not correct. Let's think))
We are having the same problem. I tried to use the init sequence from the u8g2 library, that allows to use our resolutions, but without results: The display shows an error, random pixels generation, but on full resolution area. And output from 2 bits images is weird. Now i can try to use u8g2 init sequence.
Good afternoon. Did it work out for you?
I tried the u8g2 init sequence for 256x128 resolution, without results... The Custom code uses all resolution area, but creates an output error, random pixels... today i'll try another road
Did you use this library?? If you have used our library, how did you adapt the code?? Sadly today i had no time to work at the code
Yes, this is the library. Fixed the extension from 192
to 256
, from 96
to 160
. It is also necessary to take into account the data types, replaced all uint8_t
types with int
. Although the library is simple, it is not optimized. We will think about it. I want to transfer all the functionality from u8g2 here.
It is also necessary to correct some data in the command
.
void er_lcd_display(int *pBuf)
{
int page, i;
command(0xf0); // Display Mode
dat(0x10); // Monochrome Mode
command(0x15);
dat(0x00);
dat(0xff);
command(0x75);
dat(0x00);
dat(0x28);
command(0x5c);
for (page = 0; page < 160 / 8; page++)
{
for (i = 0; i < 256; i++)
{
dat(pBuf[i + (page * 256)]);
}
}
}
void er_lcd_begin()
{
uint16_t Contrast = 240;
pinMode(LCD_BL, OUTPUT);
pinMode(LCD_RST, OUTPUT);
pinMode(LCD_DC, OUTPUT);
pinMode(LCD_CS, OUTPUT);
pinMode(LCD_SCK, OUTPUT);
pinMode(LCD_MOSI, OUTPUT);
// SPI.setClockDivider(SPI_CLOCK_DIV128);
SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
SPI.begin();
digitalWrite(LCD_CS, LOW);
digitalWrite(LCD_RST, HIGH);
delay(10);
digitalWrite(LCD_RST, LOW);
delay(10);
digitalWrite(LCD_RST, HIGH);
delay(10);
command(0x30); // Extension Command 1
command(0x94); // Sleep Out
delay(50);
command(0x31); // Extension Command 2
command(0x32); // Analog Circuit Set
dat(0x00);
dat(0x01);
dat(0x03);
command(0x51); // Booster Level x10
dat(0xFA); // 8X
command(0x30);
command(0x75);
dat(0x00);
dat(0x28);
command(0x15);
dat(0x00);
dat(0xFF); // xe 256
dat(0xA6);
command(0x30); // Extension Command 1
command(0x20); // Power Control
dat(0x0b); // VB ON ; VR,VF ON
command(0x81); // Vop Control
dat(Contrast & 0x3F);
dat((Contrast >> 6) & 0x07);
command(0x0C); // Data Format Select DO=1; LSB on top
command(0xf0); // Display Mode
dat(0x10); // Monochrome Mode
command(0xCA); // Display Control
dat(0x00);
dat(0x9f); // duty 160
dat(0x00);
command(0xBC); // Data Scan Direction
dat(0x00); // MY=0
command(0xaf); // Display On
digitalWrite(LCD_BL, LOW);
}
we should analize the codes of u8g2 funcions.
. drawLine, . drawBox, . drawCircle and others. But the mai quest is optimize the library. i admit that i'm not a coder haahha, i'm studyng at university and only now i'm learnig how to program in C an C++. But unint8_t uses only 8bit?? After i'll try your modifications.