【Proteus仿真】【Arduino单片机】LCD1602-IIC液晶显示

文章目录


一、功能简介

本项目使用Proteus8仿真Arduino单片机控制器,使用PCF8574、LCD1602液晶等。

主要功能:

系统运行后,LCD1602液晶显示各种效果。


二、软件设计

c 复制代码
/*
作者:嗨小易(QQ:3443792007)

*/

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args)  write(args);
#else
#define printByte(args)  print(args,BYTE);
#endif

uint8_t bell[8]  = {0x4,0xe,0xe,0xe,0x1f,0x0,0x4};
uint8_t note[8]  = {0x2,0x3,0x2,0xe,0x1e,0xc,0x0};
uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0};
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
uint8_t duck[8]  = {0x0,0xc,0x1d,0xf,0xf,0x6,0x0};
uint8_t check[8] = {0x0,0x1,0x3,0x16,0x1c,0x8,0x0};
uint8_t cross[8] = {0x0,0x1b,0xe,0x4,0xe,0x1b,0x0};
uint8_t retarrow[8] = {	0x1,0x1,0x5,0x9,0x1f,0x8,0x4};
  
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  
  lcd.createChar(0, bell);
  lcd.createChar(1, note);
  lcd.createChar(2, clock);
  lcd.createChar(3, heart);
  lcd.createChar(4, duck);
  lcd.createChar(5, check);
  lcd.createChar(6, cross);
  lcd.createChar(7, retarrow);
  lcd.home();
  
  lcd.print("Hello world...");
  lcd.setCursor(0, 1);
  lcd.print(" i ");
  lcd.printByte(3);
  lcd.print(" arduinos!");
  delay(2000);
  displayKeyCodes();
  
}

// display all keycodes
void displayKeyCodes(void) {
  uint8_t i = 0;
  while (1) {
    lcd.clear();
    lcd.print("Codes 0x"); lcd.print(i, HEX);
    lcd.print("-0x"); lcd.print(i+16, HEX);
    lcd.setCursor(0, 1);
    for (int j=0; j<16; j++) {
      lcd.printByte(i+j);
    }
    i+=16;
    
    delay(2000);
  }
}

void loop()
{

}

三、实验现象

B站演示视频:https://space.bilibili.com/444388619


联系作者

视频地址:https://space.bilibili.com/444388619/video

专注于51单片机、STM32、国产32、DSP、Proteus、arduino、ESP32、物联网软件开发,PCB设计,视频分享,技术交流。

相关推荐
清风6666661 天前
基于单片机的多模式智能洗衣机设计
数据库·单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
无人装备硬件开发爱好者1 天前
《STM32 江湖 SPI 双绝:硬件外设与软件模拟的深度解析》
嵌入式硬件·移植·软件模拟spi
点灯小铭1 天前
基于单片机的预约保温型智能电饭锅控制系统设计与实现
单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
奋斗的牛马1 天前
硬件工程师-基础知识电阻(四)
单片机·嵌入式硬件·学习·fpga开发
axuan126511 天前
15.【NXP 号令者RT1052】开发——实战-XBAR
单片机·嵌入式硬件·mcu
xiaohai@Linux1 天前
STM32上使用HAL库完美实现驱动MAX98357声卡模块(I2S+DMA+音频环形缓冲区)
stm32·单片机·嵌入式硬件·音视频
思茂信息1 天前
CST License(Flexnet)设置与问题处理方法
服务器·网络·单片机·3d·php·1024程序员节·cst
C.咖.1 天前
STM32—— 嵌入式微控制器入门
stm32·单片机·嵌入式硬件
兆龙电子单片机设计1 天前
【STM32项目开源】STM32单片机物联网门禁控制系统
stm32·单片机·物联网·开源·自动化
云雾J视界1 天前
C语言位运算深度应用:嵌入式硬件寄存器控制与低功耗优化实践
c语言·stm32·嵌入式硬件·低功耗·数据压缩·寄存器