Our Latest News

HAL library graphical programming of OLED screen application

1.OLED Introduction

OLED (Organic Light-Emitting Diode), that is, organic light-emitting diode, in the cell phone OLED is a new product, known as the “dream display”.

OLED display technology differs from traditional LCD displays by eliminating the need for a backlight and using a very thin coating of organic materials and a glass substrate (or flexible organic substrate) that emits light when an electric current is passed through it. And OLED display screen can be made lighter and thinner, larger viewing angle, and can significantly save power consumption.

OLED is also known as the third generation of display technology, OLED is not only thinner, lower energy consumption, high brightness, good luminosity, can display pure black, and can also be bent, such as today’s curved screen TVs and cell phones, etc.. Today’s major international manufacturers are scrambling to strengthen the research and development of OLED technology, making OLED technology in today’s TVs, computers (monitors), cell phones, tablets and other areas of spiritual applications more and more widespread.

Hardware interface

The display is 0.91″ OLED screen, 4-wire serial interface: clock CLK, data line MOSI, data command select line DS, chip select line CS. screen reset signal pin RES (low level reset).

Communication protocol

On the rising edge of each SCLK SDIN is converted to an 8-bit shift register in the order of D7, D6… . D0 is converted to an 8-bit shift register. The data bytes in the shift register are written to the graphics display data RAM (GDDRAM) or command register on the same clock. In serial mode, only write operations are allowed.

Example of sending a byte function:

void OLED_SPI_ReadWriteOneByte(u8 data,u8 cmd)
{
u8 i;
if(cmd) OLED_DC(1);
else OLED_DC(0);
OLED_CS(0);//片选拉低,选择OLED屏
OLED_SCK(0);
for(i=0;i<8;i++)
{
OLED_SCK(0);
if(data&0x80)OLED_MOSI(1);
else OLED_MOSI(0);
OLED_SCK(1);
data<<=1;
}
OLED_CS(1);
OLED_SCK(0);
}

3. Software design
Open the STM32CubeMx software and configure the DHT11 hardware interface and the OLED screen interface.

4. Generate code
4.1 Basic hardware interface configuration

4.2 OLED screen-related interface functions
OLED screen SPI send one byte function example:The clock line idle level is low and the data is sent at the lower will edge of the clock. In oled.c.
OLED hardware interface macro definition, in oled.h.
4.3 Main Functions

4.4 Using the mold pickup tool

The OLED screen itself does not come with a font, so to display Chinese characters or characters, you need to obtain the dot matrix code information by taking the mold tool.

    GET A FREE QUOTE

    FPGA IC & FULL BOM LIST

    We'd love to

    hear from you

    Highlight multiple sections with this eye-catching call to action style.

      Contact Us

      Exhibition Bay South Squre, Fuhai Bao’an Shenzhen China

      • Sales@ebics.com
      • +86.755.27389663