新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > STM32十一天燒寫中文字庫在LCD上顯示

STM32十一天燒寫中文字庫在LCD上顯示

作者: 時間:2016-11-19 來源:網(wǎng)絡(luò) 收藏
首先用PCToLCD2002,生成中文字庫,選擇所有文件,選擇GBK.bin
  1. #include"stm32f10x.h"http://包含了STM32的寄存器和變量類型
  2. #include"stm32f10x_conf.h"http://包含了庫函數(shù)的.h
  3. #include"led.h"
  4. #include"key.h"
  5. #include"delay.h"
  6. #include"uart1.h"
  7. #include//因為用到printf函數(shù)
  8. #include"spi2.h"
  9. #include"w25q64.h"
  10. #include"iic.h"
  11. #include"at24c02.h"
  12. #include"lcd.h"
  13. voidDelay(intt)
  14. {
  15. for(;t>0;t--);
  16. }
  17. intmain(void)
  18. {
  19. u8i=0;
  20. u32addr=0;
  21. u8data;
  22. //初始化延時函數(shù)
  23. delay_init(72);
  24. //初始化LED
  25. InitLED();
  26. //初始化KEY
  27. KEY_Init();
  28. //初始化USART1
  29. UART1_Init(115200);
  30. //1/1152000.0000087s*10=87us
  31. SPI2_Init(0,0);
  32. W25Q64_Init();
  33. IIC_Init();
  34. LCD_Init();
  35. //1、擦除扇區(qū)0塊0扇區(qū)
  36. while(i<64)
  37. {
  38. W25Q64_SectorErase(0x000000+i*0X4096);
  39. i++;
  40. }
  41. //1s發(fā)1K20S
  42. //隨便稍寫一個....//
  43. printf("EraseOKrn");
  44. while(1)
  45. {
  46. //接收數(shù)據(jù)
  47. while(!(USART1->SR&(1<<5)));//等待串口收到數(shù)據(jù)
  48. data=USART1->DR;//串口里面就是8位
  49. W25Q64_ReceiveByte(addr,data);
  50. addr++;
  51. //26196*64?
  52. //這樣就燒寫完了代碼...
  53. if(addr==261696)
  54. {
  55. printf("CompleteOKrn");
  56. while(1);
  57. }
  58. }
  59. }
//注意GBK,有261926個字節(jié)255KB,W25Q64有一個扇區(qū)4K,需要64個扇區(qū),先擦除然后寫入

本文引用地址:http://butianyuan.cn/article/201611/318147.htm



關(guān)鍵詞: STM32中文字庫LCD

評論


技術(shù)專區(qū)

關(guān)閉