1225 views|2 replies

1455

Posts

1

Resources
The OP
 

【Portable Environmental Status Detector】OLED Screen Display Driver [Copy link]

 

The ESP32-S2-Kaluga-1 kit is equipped with an LCD display, which can be used for human-computer interaction. However, an error message appears during the compilation and download of the routine program, preventing normal use.

To this end, we first completed the display driver of an OLED screen to lay the foundation for subsequent development and testing, and then moved the completed development to the LCD screen for display, so as not to affect the design progress.

The OLED screen used here uses the I2C interface to work, so it occupies fewer pin resources.

To reduce the impact on subsequent development, the pin relationship used by the OLED screen is as follows:

GPIO15---SCL

GPIO9---SDA

The configuration function for the used pins is:

staticvoidconfigure_Oled(void)
{
gpio_reset_pin(SCL_GPIO);
gpio_set_direction(SCL_GPIO, GPIO_MODE_OUTPUT);
gpio_reset_pin(SDA_GPIO);
gpio_set_direction(SDA_GPIO, GPIO_MODE_OUTPUT);
}

The initialization function of the display is:

static void OLED_Init(void)
{
OLED_WR_Byte(0xAE,OLED_CMD);
OLED_WR_Byte(0x02,OLED_CMD);
OLED_WR_Byte(0x10,OLED_CMD);
OLED_WR_Byte(0x40,OLED_CMD);
OLED_WR_Byte(0x81,OLED_CMD);
OLED_WR_Byte(0xff,OLED_CMD);
OLED_WR_Byte(0xA1,OLED_CMD);
OLED_WR_Byte(0xC8,OLED_CMD);
OLED_WR_Byte(0xA6,OLED_CMD);
OLED_WR_Byte(0xA8,OLED_CMD);
OLED_WR_Byte(0x3f,OLED_CMD);
OLED_WR_Byte(0xD3,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0xd5,OLED_CMD);
OLED_WR_Byte(0x80,OLED_CMD);
OLED_WR_Byte(0xD9,OLED_CMD);
OLED_WR_Byte(0xF1,OLED_CMD);
OLED_WR_Byte(0xDA,OLED_CMD);
OLED_WR_Byte(0x12,OLED_CMD);
OLED_WR_Byte(0xDB,OLED_CMD);
OLED_WR_Byte(0x40,OLED_CMD);
OLED_WR_Byte(0x20,OLED_CMD);
OLED_WR_Byte(0x02,OLED_CMD);
OLED_WR_Byte(0x8D,OLED_CMD);
OLED_WR_Byte(0x14,OLED_CMD);
OLED_WR_Byte(0xA4,OLED_CMD);
OLED_WR_Byte(0xA6,OLED_CMD);
OLED_WR_Byte(0xAF,OLED_CMD);
OLED_WR_Byte(0xAF,OLED_CMD);
OLED_Clear();
OLED_Set_Pos(0,0);
}

The function that implements string display is:

voidOLED_ShowString(uint8_t x,uint8_ty,char *chr,uint8_tChar_Size)
{
    unsignedchar j=0;
    while (chr[j]!='\0')
 { 
            OLED_ShowChar(x,y,chr[j],Char_Size);
 x+=8;
            if(x>120){x=0;y+=2;}
            j++;
 }
}

The main program to achieve the following display effect is:

voidapp_main(void)
{
configure_Oled();
OLED_Init();
OLED_Clear();
OLED_ShowString(0,0,"ESP32-S2-Kaluga",16);
OLED_ShowString(16,2,"OLED Display",16);
OLED_ShowString(16,6,"by:jinglixixi",16);
while (1);
}

Display effect diagram

This post is from DigiKey Technology Zone

Latest reply

OLED is now popular, but my development board is still using a small resistor screen.  Details Published on 2022-10-11 06:44
 
 

4771

Posts

12

Resources
2
 

OLED is now popular, but my development board is still using a small resistor screen.

This post is from DigiKey Technology Zone

Comments

Yes, practicality is the principle.  Details Published on 2022-10-11 08:26
 
 
 

1455

Posts

1

Resources
3
 
Azuma Simeng published on 2022-10-11 06:44 OLED is now quite popular, but my development board is still using a small resistor screen

Yes, practicality is the principle.

This post is from DigiKey Technology Zone
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list