找回密码
 立即注册

QQ登录

只需一步,快速开始

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

stm32驱动4针lcd1602显示程序

[复制链接]
跳转到指定楼层
楼主
芯片:stm32f10x系列
模块:4针lcd1602模块
程序是ok的
我(huang s y )不吝啬分享给大家一起学习

单片机源程序如下:
  1. /***
  2.                 Copyright (c) 2016
  3.                 All rights reserved.
  4.                
  5.                 文件名称:main.c
  6.                 文件标识:HMI
  7.                 摘    要:基于HMI显示的测试工程
  8.                
  9.                
  10.                 当前版本:
  11.                 作    者:Hacker
  12.                 完成日期:2016-1-23 17:29:14
  13.                
  14.                 取代版本:
  15.                 原作者  :
  16.                 完成日期:
  17.                
  18.                 Copyright (c) 2016
  19.                 All rights reserved.
  20.                
  21.                 File name                        :main.c
  22.                 file identification :
  23.                 Subject             :A matrix led project based on MAX7219
  24.                                                         @example Matrix_printf("string");
  25.                                                         Hello World character will be shown on matrix led
  26.                
  27.                 Current Version     :
  28.                 Author              :Hacker
  29.                 Date                :2016-1-23 17:29:14
  30.                
  31.                 Instead Version     :
  32.                 Date                :
  33. ***/

  34. #include "stm32f10x.h"
  35. #include "binary.h"
  36. #include "delay.h"
  37. #include "usart1.h"
  38. #include "1602_iic_sw.h"

  39. extern u8 buffer[10];
  40. /*
  41. * 函数名:main
  42. * 描述  : 主函数
  43. * 输入  :无
  44. * 输出  : 无
  45. */
  46. int main(void)
  47. {
  48.         int i = 0x21;
  49.         int j = 0;

  50.         DelayInit(72);

  51.         USART1_Config();
  52.         init_1602();
  53.         
  54.         printf("\r\n开始调试r\n");
  55.         setCursor(3, 0);
  56.         
  57. //        printf("debug:1\r\n");
  58. //        lcdPrint("hello");
  59. //        Delay1ms(2000);
  60. //        printf("debug:2\r\n");
  61. //        setCursor(0, 1);
  62. //        printf("debug:3\r\n");
  63. //        lcdPrint("12345067");
  64. //        setCursor(0,0);
  65. //        
  66.         
  67.         while(1)
  68.         {
  69.                 writeOneChar(DATA, i);
  70.                 Delay1ms(500);
  71.                 i++;j++;
  72.                 if(j == 16)
  73.                 {
  74.                         setCursor(0, 1);
  75.                         j = 0;
  76.                 }
  77.                 if(i == 255)
  78.                 {
  79.                         setCursor(0, 1);
  80.                         i = 0x21;
  81.                 }
  82.         }
  83.           // add your code here ^_^。
  84. }




  85. /******************* (C) COPYRIGHT 2016 Hacker *****END OF FILE************/
复制代码

所有资料51hei提供下载:
STM32+4针LCD1602程序.7z (190.06 KB, 下载次数: 27)



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

使用道具 举报

沙发
ID:339976 发表于 2020-5-13 16:30 | 只看该作者
怎么接线啊
回复

使用道具 举报

板凳
ID:699194 发表于 2020-5-14 10:19 | 只看该作者

用IIC 接线的,你找里面的IIC.h文件就可以看的到了
回复

使用道具 举报

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

本版积分规则

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

Powered by 单片机教程网

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