当前位置:网站首页>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
边栏推荐
- "Penalty kick" games
- What happened to the kernel after malloc() was transferred? Attached malloc () and free () implementation source
- 永磁同步电机转子位置估算专题 —— 基波模型类位置估算概要
- Discussion on beegfs high availability mode
- 某东短信登录复活 安装部署教程
- Error analysis ~csdn rebound shell error
- String length limit?
- Catch ball game 1
- Leetcode brush first_ Maximum Subarray
- Standardized QCI characteristics
猜你喜欢
【GET-4】
某东短信登录复活 安装部署教程
Tencent T3 teaches you hand in hand. It's really delicious
深度学习分类网络 -- ZFNet
逻辑是个好东西
看过很多教程,却依然写不好一个程序,怎么破?
[network planning] Chapter 3 data link layer (4) LAN, Ethernet, WLAN, VLAN
Special topic of rotor position estimation of permanent magnet synchronous motor -- fundamental wave model and rotor position angle
SQL injection 2
Anaconda安裝後Jupyter launch 沒反應&網頁打開運行沒執行
随机推荐
Unity writes a timer tool to start timing from the whole point. The format is: 00:00:00
5. 無線體內納米網:十大“可行嗎?”問題
8086 instruction code summary (table)
Monthly report of speech synthesis (TTS) and speech recognition (ASR) papers in June 2022
解剖生理学复习题·VIII血液系统
Qinglong panel white screen one key repair
【GET-4】
夏志刚介绍
Error analysis ~csdn rebound shell error
Node. Js: express + MySQL realizes registration, login and identity authentication
Learn to punch in Web
B-杰哥的树(状压树形dp)
Tencent architects first, 2022 Android interview written examination summary
Enumeration gets values based on parameters
Wechat applet common collection
【每周一坑】正整数分解质因数 +【解答】计算100以内质数之和
Rhcsa Road
Rhcsa Road
Poj3617 best cow line
JVM_ Common [interview questions]