找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1955|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

STM32的LCD12864源程序

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:318420 發(fā)表于 2018-4-28 14:15 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
STM32的LCD12864單片機(jī)源程序如下:
  1. /******************** (C) COPYRIGHT 2012 WildFire Team **************************
  2. * 文件名  :main.c
  3. * 描述    :用3.5.0版本建的工程模板。         
  4. * 實(shí)驗(yàn)平臺:野火STM32開發(fā)板
  5. * 庫版本  :ST3.5.0
  6. *
  7. **********************************************************************************/
  8. #include "stm32f10x.h"

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

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


復(fù)制代碼

所有資料51hei提供下載:
LCD 12864.rar (292.06 KB, 下載次數(shù): 47)


分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表