標(biāo)題: lcd12864液晶STM32驅(qū)動程序 [打印本頁]

作者: 不知可不可以    時間: 2017-3-29 11:25
標(biāo)題: lcd12864液晶STM32驅(qū)動程序


完整的STM32代碼下載:
LCD 12864.7z (186.66 KB, 下載次數(shù): 69)



lcd12864驅(qū)動程序的主程序:
  1. /******************** (C) COPYRIGHT 2012 WildFire Team **************************
  2. * 文件名  :main.c
  3. * 描述    :用3.5.0版本建的工程模板。         
  4. * 實驗平臺:野火STM32開發(fā)板
  5. * 庫版本  :ST3.5.0
  6. *
  7. * 作者    :wildfire team
  8. **********************************************************************************/
  9. #include "stm32f10x.h"

  10. /*
  11. * 函數(shù)名:main
  12. * 描述  : 主函數(shù)
  13. * 輸入  :無
  14. * 輸出  : 無
  15. */
  16. int main(void)
  17. {
  18.         SysInit_Configuration();                                //系統(tǒng)初始化函數(shù)
  19.         printf("\r\n this is a LCD 12864 demo \r\n");
  20. //        delay_ms(1000);
  21. //        SendCMD(0x88);//1000,0001 設(shè)定DDRAM 7位地址000,0001到地址計數(shù)器AC
  22. //        SendDat(0x33);
  23. //        SendDat(0x42);
  24. //        SendDat(0x43);
  25. //        SendDat(0x44);
  26. ////        SendCMD(0x00);
  27. //        delay_ms(1000);
  28. //        while(1) ;
  29.         
  30.         while(1)
  31.         {
  32.                 display(0x80,"STM32");display(0x83,"12864");display(0x86,"3.3V");
  33.         
  34.                 display(0x90,"陜西");display(0x93,"西安");
  35.                
  36.                 display(0x88,"2014");display(0x8A,"0424");
  37.                
  38.                 display(0x98,"測試");display(0x9A,"程序");
  39.                 delay_ms(1000);
  40.                 while(1) ;
  41. //                SendCMD(0x00);
  42.         }
  43. }

  44. void SysInit_Configuration(void)
  45. {        
  46.         RCC_Configuration();      //利用外部高速時鐘HSE對系統(tǒng)相關(guān)時鐘進行配置,
  47.         GPIO_Configuration();     //IO口進行基本配置
  48. //        TIM1_Configuration();     //定時器1配置
  49. //        TIM2_Configuration();     //定時器2配置
  50. //        ADC_Configuration();          //模數(shù)轉(zhuǎn)換器配置               
  51.         USART1_Configuration();   //串口1配置
  52. //        USART2_Configuration();          //串口2配置
  53.         SysTick_Configuration();  //系統(tǒng)節(jié)拍定時器配置
  54.         initlcm();                                  //12864初始化
  55. //        TIM_Cmd(TIM2, ENABLE);    //定時器2啟動
  56. }
  57. int fputc(int ch, FILE *f)
  58. {
  59.         /* 將Printf內(nèi)容發(fā)往串口 */
  60.         USART_ClearFlag(USART1,USART_FLAG_TC);
  61.         USART_SendData(USART1, (unsigned char) ch);
  62.         while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!= SET);
  63.         return ch;
  64. }
  65. /******************* (C) COPYRIGHT 2012 WildFire Team *****END OF FILE************/


復(fù)制代碼



作者: koko5    時間: 2017-7-18 18:35
樓主這里面沒有頭文件,和12864那個引腳怎么練,本人很菜,跪求樓主指點
作者: heicad    時間: 2022-10-17 20:55
koko5 發(fā)表于 2017-7-18 18:35
樓主這里面沒有頭文件,和12864那個引腳怎么練,本人很菜,跪求樓主指點

有頭文件 用Keil4來編譯吧




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1