这是一个有关stm32的oled动态显示程序
- /*
- STM32F103C8T6
- OLED接线定义:
- VCC--3.3V/5V
- GND--GND
- SCL--PA0
- SDA--PA1
- */
- #include "sys.h"
- #include "delay.h"
- #include "oled_iic.h"
- #include "stdio.h"
- #include "usart.h"
- int main(void)
- {
- extern const u8 BMP_1[];
- extern const u8 BMP_2[];
- extern const u8 BMP_3[];
- extern const u8 BMP_4[];
- extern const u8 BMP_5[];
- extern const u8 BMP_6[];
- extern const u8 BMP_7[];
- extern const u8 BMP_8[];
- extern const u8 BMP_9[];
- extern const u8 BMP_10[];
- extern const u8 BMP_11[];
- extern const u8 BMP_12[];
- extern const u8 BMP_13[];
- extern const u8 BMP_14[];
- extern const u8 BMP_15[];
- extern const u8 BMP_16[];
- extern const u8 BMP_17[];
- extern const u8 BMP_18[];
- extern const u8 BMP_19[];
- extern const u8 BMP_20[];
- extern const u8 BMP_21[];
- extern const u8 BMP_22[];
- extern const u8 BMP_23[];
-
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
- delay_init();
- OLED_Init(); //OLED屏幕初始化
-
- OLED_Clear();
- OLED_ShowCH(16,1,(u8 *)"转动的太空人");
- OLED_ShowCH(29,3,(u8 *)"Astronaut");
- OLED_ShowNum(49,5,1314,4,16);
- delay_ms(5000);
- OLED_Clear();
- delay_ms(100);
- OLED_ShowCH(0,0,(u8 *)"太");
- OLED_ShowCH(0,3,(u8 *)"空");
- OLED_ShowCH(0,6,(u8 *)"人");
- while(1)
- {
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_1);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_2);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_3);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_4);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_5);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_6);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_7);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_8);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_9);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_10);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_11);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_12);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_13);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_14);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_15);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_16);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_17);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_18);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_19);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_20);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_21);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_22);
- OLED_DrawBMP(28,0,101,8,(u8 *)BMP_23);
- }
- }
复制代码
代码:
旋转图片.zip
(370.71 KB, 下载次数: 38)
|