標(biāo)題: stm32驅(qū)動4針lcd1602顯示程序 [打印本頁]

作者: 我叫小大打    時間: 2020-3-28 12:20
標(biāo)題: stm32驅(qū)動4針lcd1602顯示程序
芯片:stm32f10x系列
模塊:4針lcd1602模塊
程序是ok的
我(huang s y )不吝嗇分享給大家一起學(xué)習(xí)

單片機(jī)源程序如下:
  1. /***
  2.                 Copyright (c) 2016
  3.                 All rights reserved.
  4.                
  5.                 文件名稱:main.c
  6.                 文件標(biāo)識:HMI
  7.                 摘    要:基于HMI顯示的測試工程
  8.                
  9.                
  10.                 當(dāng)前版本:
  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. * 函數(shù)名:main
  42. * 描述  : 主函數(shù)
  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開始調(diào)試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************/
復(fù)制代碼

所有資料51hei提供下載:
STM32+4針LCD1602程序.7z (190.06 KB, 下載次數(shù): 29)




作者: 尋梗記    時間: 2020-5-13 16:30
怎么接線啊

作者: 我叫小大打    時間: 2020-5-14 10:19
尋梗記 發(fā)表于 2020-5-13 16:30
怎么接線啊

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




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