Proteus simulation STM32 driver oled12864

Tools: proteus8, stm32cubemx, keil5

In order to complete the course design of mechanical and electrical products (packaging machine), use protues for simulation. . .

The chip uses stm32f103 series. . . There are very few types of library chips that come with proteus. . .

First use cubemx:

Configure the relevant pins with stm32cubemx, I use the software IIC method. Hardware iic should not be used! Hardware iic should not be used! Hardware iic should not be used! (The important thing is said three times. This is a trap. I have been working on the hardware IIC for a whole morning and haven’t figured it out ==.

As long as the SCL and SDA pins are set to open-drain output mode, remember to connect the pull-up resistor~

Then use keil to write oled.c and oled.h files:

Most of the operation codes for oled come from: Jiangke University Self-Chemical Association (yes, the up master who taught stm32 at station B)

oled.c code is as follows:

#include "OLED.h"
#include "OLEDFont.h"
/* pin configuration */
#define OLED_W_SCL1 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_SET)
#define OLED_W_SDA1 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9, GPIO_PIN_SET)
#define OLED_W_SCL0 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8, GPIO_PIN_RESET)
#define OLED_W_SDA0 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9, GPIO_PIN_RESET)

/*pin initialization*/
void OLED_I2C_Init(void)
{
OLED_W_SCL1;
OLED_W_SDA1;
}

/**
  * @brief I2C start
  * @param None
  * @retval None
  */
void OLED_I2C_Start(void)
{
OLED_W_SDA1;
OLED_W_SCL1;
OLED_W_SDA0;
OLED_W_SCL0;
}

/**
  * @brief I2C stop
  * @param None
  * @retval None
  */
void OLED_I2C_Stop(void)
{
OLED_W_SDA0;
OLED_W_SCL1;
OLED_W_SDA1;
}

/**
  * @brief I2C sends a byte
  * @param Byte A byte to send
  * @retval None
  */
void OLED_I2C_SendByte(uint8_t Byte)
{
uint8_t i;
for (i = 0; i < 8; i ++ )
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9, Byte & amp; (0x80 >> i));
OLED_W_SCL1;
OLED_W_SCL0;
}
OLED_W_SCL1; //An extra clock, do not process the response signal
OLED_W_SCL0;
}

/**
  * @brief OLED write command
  * @param Command the command to write
  * @retval None
  */
void OLED_WriteCommand(uint8_t Command)
{
OLED_I2C_Start();
OLED_I2C_SendByte(0x78); //Slave address
OLED_I2C_SendByte(0x00); //write command
OLED_I2C_SendByte(Command);
OLED_I2C_Stop();
}

/**
  * @brief OLED write data
  * @param Data the data to write
  * @retval None
  */
void OLED_WriteData(uint8_t Data)
{
OLED_I2C_Start();
OLED_I2C_SendByte(0x78); //Slave address
OLED_I2C_SendByte(0x40); //write data
OLED_I2C_SendByte(Data);
OLED_I2C_Stop();
}

/**
  * @brief OLED set cursor position
  * @param Y Take the upper left corner as the origin, the coordinates in the downward direction, range: 0~7
  * @param X Take the upper left corner as the origin, the coordinates in the right direction, range: 0~127
  * @retval None
  */
void OLED_SetCursor(uint8_t Y, uint8_t X)
{
OLED_WriteCommand(0xB0 | Y); //Set Y position
OLED_WriteCommand(0x10 | ((X & amp; 0xF0) >> 4)); //Set the lower 4 bits of the X position
OLED_WriteCommand(0x00 | (X & amp; 0x0F)); //Set X position high 4 bits
}

/**
  * @brief OLED clear screen
  * @param None
  * @retval None
  */
void OLED_Clear(void)
{
uint8_t i, j;
for (j = 0; j < 8; j ++ )
{
OLED_SetCursor(j, 0);
for(i = 0; i < 128; i ++ )
{
OLED_WriteData(0x00);
}
}
}

/**
  * @brief OLED display a character
  * @param Line line position, range: 1~4
  * @param Column column position, range: 1~16
  * @param Char A character to be displayed, range: ASCII visible characters
  * @retval None
  */
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char)
{
uint8_t i;
OLED_SetCursor((Line - 1) * 2, (Column - 1) * 8); //Set the cursor position in the upper half
for (i = 0; i < 8; i ++ )
{
OLED_WriteData(OLED_F8x16[Char - ' '][i]); //Display the upper half of the content
}
OLED_SetCursor((Line - 1) * 2 + 1, (Column - 1) * 8); //Set the cursor position in the lower half
for (i = 0; i < 8; i ++ )
{
OLED_WriteData(OLED_F8x16[Char - ' '][i + 8]); //Display the content of the second half
}
}

/**
  * @brief OLED display string
  * @param Line start line position, range: 1~4
  * @param Column start column position, range: 1~16
  * @param String The string to be displayed, range: ASCII visible characters
  * @retval None
  */
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String)
{
uint8_t i;
for (i = 0; String[i] != '\0'; i ++ )
{
OLED_ShowChar(Line, Column + i, String[i]);
}
}

/**
  * @brief OLED power function
  * @retval The return value is equal to the Y power of X
  */
uint32_t OLED_Pow(uint32_t X, uint32_t Y)
{
uint32_t Result = 1;
while (Y--)
{
Result *= X;
}
return Result;
}

/**
  * @brief OLED display numbers (decimal, positive)
  * @param Line start line position, range: 1~4
  * @param Column start column position, range: 1~16
  * @param Number The number to be displayed, range: 0~4294967295
  * @param Length The length of the number to be displayed, range: 1~10
  * @retval None
  */
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
uint8_t i;
for (i = 0; i < Length; i ++ )
{
OLED_ShowChar(Line, Column + i, Number / OLED_Pow(10, Length - i - 1) % 10 + '0');
}
}

/**
  * @brief OLED display numbers (decimal, signed numbers)
  * @param Line start line position, range: 1~4
  * @param Column start column position, range: 1~16
  * @param Number The number to be displayed, range: -2147483648~2147483647
  * @param Length The length of the number to be displayed, range: 1~10
  * @retval None
  */
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int32_t Number, uint8_t Length)
{
uint8_t i;
uint32_t Number1;
if (Number >= 0)
{
OLED_ShowChar(Line, Column, ' + ');
Number1 = Number;
}
else
{
OLED_ShowChar(Line, Column, '-');
Number1 = -Number;
}
for (i = 0; i < Length; i ++ )
{
OLED_ShowChar(Line, Column + i + 1, Number1 / OLED_Pow(10, Length - i - 1) % 10 + '0');
}
}

/**
  * @brief OLED display numbers (hexadecimal, positive)
  * @param Line start line position, range: 1~4
  * @param Column start column position, range: 1~16
  * @param Number The number to be displayed, range: 0~0xFFFFFFFF
  * @param Length The length of the number to be displayed, range: 1~8
  * @retval None
  */
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
uint8_t i, SingleNumber;
for (i = 0; i < Length; i ++ )
{
SingleNumber = Number / OLED_Pow(16, Length - i - 1) % 16;
if (SingleNumber < 10)
{
OLED_ShowChar(Line, Column + i, SingleNumber + '0');
}
else
{
OLED_ShowChar(Line, Column + i, SingleNumber - 10 + 'A');
}
}
}

/**
  * @brief OLED displays numbers (binary, positive)
  * @param Line start line position, range: 1~4
  * @param Column start column position, range: 1~16
  * @param Number The number to be displayed, range: 0~1111 1111 1111 1111
  * @param Length The length of the number to be displayed, range: 1~16
  * @retval None
  */
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length)
{
uint8_t i;
for (i = 0; i < Length; i ++ )
{
OLED_ShowChar(Line, Column + i, Number / OLED_Pow(2, Length - i - 1) % 2 + '0');
}
}

/**
  * @brief OLED initialization
  * @param None
  * @retval None
  */
void OLED_Init(void)
{
uint32_t i, j;
\t
for (i = 0; i < 1000; i ++ ) // power-on delay
{
for (j = 0; j < 1000; j ++ );
}
\t
OLED_I2C_Init(); //Port initialization
\t
OLED_WriteCommand(0xAE); //Close the display
\t
OLED_WriteCommand(0xD5); //Set display clock frequency division ratio/oscillator frequency
OLED_WriteCommand(0x80);
\t
OLED_WriteCommand(0xA8); //Set the multiplexing rate
OLED_WriteCommand(0x3F);
\t
OLED_WriteCommand(0xD3); //Set display offset
OLED_WriteCommand(0x00);
\t
OLED_WriteCommand(0x40); //Set display start line
\t
OLED_WriteCommand(0xA1); //Set the left and right directions, 0xA1 is normal, 0xA0 is left and right reversed
\t
OLED_WriteCommand(0xC8); //Set up and down direction, 0xC8 is normal, 0xC0 up and down reverse

OLED_WriteCommand(0xDA); //Set COM pin hardware configuration
OLED_WriteCommand(0x12);
\t
OLED_WriteCommand(0x81); //Set contrast control
OLED_WriteCommand(0xCF);

OLED_WriteCommand(0xD9); //Set the pre-charge cycle
OLED_WriteCommand(0xF1);

OLED_WriteCommand(0xDB); //Set VCOMH deselection level
OLED_WriteCommand(0x30);

OLED_WriteCommand(0xA4); //Set the whole display on/off

OLED_WriteCommand(0xA6); //Set normal/reverse display

OLED_WriteCommand(0x8D); //Set charge pump
OLED_WriteCommand(0x14);

OLED_WriteCommand(0xAF); //Open display
\t\t
OLED_Clear(); //OLED clear screen
}

oled.h code is as follows:

#ifndef __OLED_H
#define __OLED_H

#include "main.h"


void OLED_Init(void);
void OLED_Clear(void);
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char);
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String);
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int32_t Number, uint8_t Length);
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);

#endif

OLEDFont.h code is as follows:

#ifndef __OLEDFONT_H
#define __OLEDFONT_H

/*OLED?--?¨o“8?′ ?é16?′ */
extern const unsigned char OLED_F8x16[][16]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//0
\t
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
\t
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
\t
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,
0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//#3
\t
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,
0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$4
\t
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,
0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
\t
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,
0x1E, 0x21, 0x23, 0x24, 0x19, 0x27, 0x21, 0x10, // & 6
\t
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
\t
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,
0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//(8
\t
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,
0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
\t
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,
0x02, 0x02, 0x01, 0x0F, 0x01, 0x02, 0x02, 0x00, //* 10
\t
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+11
\t
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
\t
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//-13
\t
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//.14
\t
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,
0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,///15
\t
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
\t
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,
0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//1 17
\t
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,
0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,//2 18
\t
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,
0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,//3 19
\t
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,
0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,//4 20
\t
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,
0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
\t
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,
0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
\t
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,
0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
\t
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,
0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
\t
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,
0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
\t
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,
0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
\t
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
\t
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,
0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, //< 28
\t
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
\t
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,
0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,/>30
\t
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,
0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
\t
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,
0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
\t
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,
0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
\t
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,
0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
\t
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,
0x07, 0x18, 0x20, 0x20, 0x20, 0x10, 0x08, 0x00, //C 35
\t
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,
0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
\t
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
\t
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,
0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
\t
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,
0x07, 0x18, 0x20, 0x20, 0x22, 0x1E, 0x02, 0x00, //G 39
\t
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
\t
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,
0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
\t
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,
0xC0, 0x80, 0x80, 0x80, 0x7F, 0x00, 0x00, 0x00, //J 42
\t
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,
0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
\t
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,
0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
\t
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,
0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
\t
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,
0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
\t
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
0x0F, 0x10, 0x20, 0x20, 0x20, 0x10, 0x0F, 0x00, //O 47
\t
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,
0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
\t
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,
0x0F, 0x18, 0x24, 0x24, 0x38, 0x50, 0x4F, 0x00, //Q 49
\t
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,
0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
\t
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,
0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
\t
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,
0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
\t
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,
0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
\t
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,
0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
\t
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,
0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
\t
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,
0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
\t
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,
0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
\t
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,
0x20, 0x38, 0x26, 0x21, 0x20, 0x20, 0x18, 0x00, //Z 58
\t
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,
0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
\t
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
\t
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
\t
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^62
\t
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_63
\t
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//`64
\t
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
\t
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,
0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
\t
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,
0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
\t
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,
0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
\t
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e69
\t
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,
0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
\t
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
\t
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,
0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
\t
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,
0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
\t
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,
0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
\t
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,
0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
\t
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,
0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
\t
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
\t
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,
0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
\t
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,
0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
\t
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,
0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
\t
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,
0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
\t
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
\t
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
\t
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,
0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
\t
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,
0x00, 0x1F, 0x20, 0x20, 0x20, 0x10, 0x3F, 0x20, // u 85
\t
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
\t
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,
0x0F, 0x30, 0x0C, 0x03, 0x0C, 0x30, 0x0F, 0x00, //w 87
\t
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,
0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x88
\t
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,
0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
\t
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,
0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
\t
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,
0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
\t
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
\t
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,
0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
\t
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~94
};

#endif

Add OLED_Init() to the main function;

Write the writing function of oled in the while loop, and add OLED_Clear() to refresh each loop.

Proteus simulation effect:

It can be turned on, but the refresh rate is extremely slow, and I don’t know why. . .

It is better to play the real machine directly if possible, and it is not recommended to play the simulation. . .