芯片:STM32F103C6T6
0.96寸OLED 4针脚IIC协议
汉字的字模库对应英文长宽比10*16
STM32单片机源程序如下:
- #include "stm32f10x.h" // Device header
- #include "delay.h"
- #include "OLED.h"
- void OLED_GPIO_Init(void)
- {
- GPIO_InitTypeDef GPIO_InitStruct;
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
- GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6|GPIO_Pin_7;
- GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPIOB,&GPIO_InitStruct);
- GPIO_ResetBits(GPIOB,GPIO_Pin_6);
- GPIO_SetBits(GPIOB,GPIO_Pin_7);
- }
- int main()
- {
- OLED_GPIO_Init();
-
- OLED_Init();
- OLED_ShowString(1,1,"51");
- OLED_ShowCN(1,2,0);
- OLED_ShowCN(1,3,1);
- OLED_ShowCN(1,4,2);
- OLED_ShowCN(1,5,3);
- OLED_ShowCN(1,6,4);
- OLED_ShowCN(2,1,5);
- OLED_ShowCN(2,2,6);
-
-
- while(1)
- {
-
- }
- }
复制代码
另外分享一下OLED的驱动手册SSD1306规格书,网上找半天才找到的,给有需要的人吧~~~
STM32代码下载:
程序+SSD1306规格书.7z
(963.48 KB, 下载次数: 89)
|