找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3825|回复: 0
打印 上一主题 下一主题
收起左侧

stm32驱动12864 串行方式 源码

[复制链接]
跳转到指定楼层
楼主
发现51黑电子论坛上有一个驱动并行的帖子,好像还没有串行的,我现在把我最近发现的发到论坛中

完整源码下载:
stm32控制LCD 12864——串行.rar (5.04 MB, 下载次数: 82)


下面是主程序:
  1. /******************** (C) COPYRIGHT 2012 WildFire Team **************************
  2. * 文件名  :main.c
  3. * 描述    :用3.5.0版本建的工程模板。         
  4. * 实验平台:野火STM32开发板
  5. * 库版本  :ST3.5.0
  6. *
  7. * 作者    :wildfire team
  8. **********************************************************************************/
  9. #include "stm32f10x.h"

  10. /*
  11. * 函数名:main
  12. * 描述  : 主函数
  13. * 输入  :无
  14. * 输出  : 无
  15. */
  16. int main(void)
  17. {
  18.         SysInit_Configuration();                                //系统初始化函数
  19.         printf("\r\n this is a LCD 12864 demo \r\n");
  20. //        delay_ms(1000);
  21. //        SendCMD(0x88);//1000,0001 设定DDRAM 7位地址000,0001到地址计数器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对系统相关时钟进行配置,
  47.         GPIO_Configuration();     //IO口进行基本配置
  48. //        TIM1_Configuration();     //定时器1配置
  49. //        TIM2_Configuration();     //定时器2配置
  50. //        ADC_Configuration();          //模数转换器配置               
  51.         USART1_Configuration();   //串口1配置
  52. //        USART2_Configuration();          //串口2配置
  53.         SysTick_Configuration();  //系统节拍定时器配置
  54.         initlcm();                                  //12864初始化
  55. //        TIM_Cmd(TIM2, ENABLE);    //定时器2启动
  56. }
  57. int fputc(int ch, FILE *f)
  58. {
  59.         /* 将Printf内容发往串口 */
  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************/


复制代码


评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表