标题: stm32驱动4针lcd1602显示程序 [打印本页]

作者: 我叫小大打    时间: 2020-3-28 12:20
标题: 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, 下载次数: 29)




作者: 寻梗记    时间: 2020-5-13 16:30
怎么接线啊

作者: 我叫小大打    时间: 2020-5-14 10:19
寻梗记 发表于 2020-5-13 16:30
怎么接线啊

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




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1