很多时候应用中不用sd卡,其他储存IC,也不用字库。直接在stm32单片机上显示几个数字,这里给了一个范例!
单片机源程序如下:
- #include "sys.h"
- #include "usart.h"
- #include "delay.h"
- #include "led.h"
- #include "key.h"
- #include "exti.h"
- #include "wdg.h"
- #include "timer.h"
- #include "lcd.h"
- #include "chinese.h"
- int main(void)
- {
- u8 x=0;
- Stm32_Clock_Init(9);//系统时钟设置
- delay_init(72); //延时初始化
- uart_init(72,9600); //串口1初始化
- LED_Init();
- LCD_Init();
- POINT_COLOR=RED;
- while(1)
- {
- switch(x)
- {
- case 0:LCD_Clear(WHITE);break;
- case 1:LCD_Clear(BLACK);break;
- case 2:LCD_Clear(BLUE);break;
- case 3:LCD_Clear(RED);break;
- case 4:LCD_Clear(MAGENTA);break;
- case 5:LCD_Clear(GREEN);break;
- case 6:LCD_Clear(CYAN);break;
- case 7:LCD_Clear(YELLOW);break;
- case 8:LCD_Clear(BRRED);break;
- case 9:LCD_Clear(GRAY);break;
- case 10:LCD_Clear(LGRAY);break;
- case 11:LCD_Clear(BROWN);break;
- }
- TEST_FONT();
- x++;
- if(x==12)x=0;
- LED0=!LED0;
- delay_ms(1000);
- }
- }
复制代码
所有资料51hei提供下载:
自定义汉字显示实验.7z
(158.64 KB, 下载次数: 13)
|