当前位置:网站首页>Use of OLED screen
Use of OLED screen
2022-07-06 20:22:00 【Kshine2017】
1. 0.96 " 7 Pin OLED The screen
- The missing part of the text in the picture is caused by the mobile phone taking pictures , It's actually a complete text .
- Reference link :
https://wenku.baidu.com/view/eb67b928b91aa8114431b90d6c85ec3a87c28b86.html
https://wenku.baidu.com/view/11e968518d9951e79b89680203d8ce2f00666590.html - Pin interpretation :
GND GND
VDD VCC 3.3V~5V
PE5 D0 CLK Clock information (SCL) SPI_CLK
PE6 D1 Data port (SDA) SPI_MOSI
PE7 RES Reset Ordinary IO
PE8 DC data / Command to choose (D/C) Ordinary IO
PE9 CS Chip selection , Low level active SPI_CS

- The connection mode of resistance is shown in the following figure , Corresponding 4 Line SPI.

- IO simulation 4 Line SPI, drive OLED
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {
0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIOA->BSRR = OLED_DC_Pin;
GPIOA->BSRR = OLED_RES_Pin;
GPIOA->BSRR = GPIO_PIN_5;//SCK pull up
GPIOA->BSRR = GPIO_PIN_7;// pull up
//CS The pin is directly connected GND
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = OLED_DC_Pin|OLED_RES_Pin;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_7;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
#define MOSI_H GPIOA->BSRR = GPIO_PIN_7 //HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_SET) //
#define MOSI_L GPIOA->BRR = GPIO_PIN_7 //HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_RESET) //
#define SCK_H GPIOA->BSRR = GPIO_PIN_5 //HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET) //
#define SCK_L GPIOA->BRR = GPIO_PIN_5 //HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET) //
//#define MISO
#define NSS_H
#define NSS_L
void delayUS(uint32_t nus)
{
uint16_t i;
for(i=0;i<nus;i++)
{
}
}
// have access to SPI The way HAL_SPI_Transmit(&hspi1,&data,1,1);
void My_SPI_Transmit(unsigned char data)
{
unsigned char i; // Defining variables
for(i = 0; i < 8; i++) // loop 8 Time
{
SCK_L;
delayUS(1);
if(data&0x80)
MOSI_H;
else
MOSI_L;
data<<=1;
delayUS(1);
SCK_H;
delayUS(1);
}
}
Actually measured , MCU works in 72MHz Under the circumstances , Above My_SPI_Transmit The time of function is about 76.4 Microsecond .

Driver file
https://download.csdn.net/download/Kshine2017/85519013
边栏推荐
- Jupyter launch didn't respond after Anaconda was installed & the web page was opened and ran without execution
- Leetcode brush first_ Maximum Subarray
- Digital triangle model acwing 1018 Minimum toll
- String长度限制?
- 腾讯T4架构师,android面试基础
- Number of schemes from the upper left corner to the lower right corner of the chessboard (2)
- SSH connection denied
- golang的超时处理使用技巧
- Rhcsa Road
- 系统与应用监控的思路和方法
猜你喜欢

新一代垃圾回收器—ZGC
![[network planning] Chapter 3 data link layer (3) channel division medium access control](/img/df/dd84508dfa2449c31d72c808c50dc0.png)
[network planning] Chapter 3 data link layer (3) channel division medium access control

B-杰哥的树(状压树形dp)

New generation garbage collector ZGC
![[Yann Lecun likes the red stone neural network made by minecraft]](/img/95/c3af40c7ecbd371dd674aea19b272a.png)
[Yann Lecun likes the red stone neural network made by minecraft]

逻辑是个好东西

小孩子学什么编程?

JMeter server resource indicator monitoring (CPU, memory, etc.)
Tencent byte and other big companies interview real questions summary, Netease architects in-depth explanation of Android Development

爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
随机推荐
Tips for web development: skillfully use ThreadLocal to avoid layer by layer value transmission
5. 无线体内纳米网:十大“可行吗?”问题
Boder radius has four values, and boder radius exceeds four values
为什么新手在编程社区提问经常得不到回答,甚至还会被嘲讽?
永磁同步电机转子位置估算专题 —— 基波模型与转子位置角
【DSP】【第二篇】了解C6678和创建工程
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
枚举根据参数获取值
Tencent Android development interview, basic knowledge of Android Development
永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
腾讯T4架构师,android面试基础
String length limit?
[cloud lesson] EI lesson 47 Mrs offline data analysis - processing OBS data through Flink
POJ 3207 Ikki&#39; s Story IV – Panda&#39; s Trick (2-SAT)
How does kubernetes support stateful applications through statefulset? (07)
BUUCTF---Reverse---easyre
[weekly pit] output triangle
Speech recognition (ASR) paper selection: talcs: an open source Mandarin English code switching corps and a speech
Crawler (14) - scrape redis distributed crawler (1) | detailed explanation
Special topic of rotor position estimation of permanent magnet synchronous motor -- fundamental wave model and rotor position angle