资源简介
在Arduino IDE 1.0以上版本,支持采用PCF8574T芯片的国产1602显示屏。已测试。
代码片段和文件信息
//YWROBOT
#include “LiquidCrystal_I2C.h“
#include
#include “Wire.h“
#include “Arduino.h“
// When the display powers up it is configured as follows:
//
// 1. Display clear
// 2. Function set:
// DL = 1; 8-bit interface data
// N = 0; 1-line display
// F = 0; 5x8 dot character font
// 3. Display on/off control:
// D = 0; Display off
// C = 0; Cursor off
// B = 0; blinking off
// 4. Entry mode set:
// I/D = 1; Increment by 1
// S = 0; No shift
//
// Note however that resetting the Arduino doesn‘t reset the LCD so we
// can‘t assume that its in that state when a sketch starts (and the
// LiquidCrystal constructor is called).
LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addruint8_t lcd_colsuint8_t lcd_rows)
{
_Addr = lcd_Addr;
_cols = lcd_cols;
_rows = lcd_rows;
_backlightval = LCD_NOBACKLIGHT;
}
void LiquidCrystal_I2C::init(){
init_priv();
}
void LiquidCrystal_I2C::init_priv()
{
Wire.begin();
_displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x8DOTS;
begin(_cols _rows);
}
void LiquidCrystal_I2C::begin(uint8_t cols uint8_t lines uint8_t dotsize) {
if (lines > 1) {
_displayfunction |= LCD_2LINE;
}
_numlines = lines;
// for some 1 line displays you can select a 10 pixel high font
if ((dotsize != 0) && (lines == 1)) {
_displayfunction |= LCD_5x10DOTS;
}
// SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION!
// according to datasheet we need at least 40ms after power rises above 2.7V
// before sending commands. Arduino can turn on way befer 4.5V so we‘ll wait 50
delayMicroseconds(50000);
// Now we pull both RS and R/W low to begin commands
expanderWrite(_backlightval); // reset expanderand turn backlight off (Bit 8 =1)
delay(1000);
//put the LCD into 4 bit mode
// this is according to the hitachi HD44780 datasheet
// figure 24 pg 46
// we start in 8bit mode try to set 4 bit mode
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// second try
write4bits(0x03);
delayMicroseconds(4500); // wait min 4.1ms
// third go!
write4bits(0x03);
delayMicroseconds(150);
// finally set to 4-bit interface
write4bits(0x02);
// set # lines font size etc.
command(LCD_FUNCTIONSET | _displayfunction);
// turn the display on with no cursor or blinking default
_displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_blinkOFF;
display();
// clear it off
clear();
// Initialize to default text direction (for roman languages)
_displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT;
// set the entry mode
command(LCD_ENTRYMODESET | _displaymode);
home();
}
/********** high level commands for the user! */
void LiquidCrystal_I2C::clear(){
command(LCD_CLEARDISPLAY);// clear display set cursor position to zero
delayMicroseconds(2000); // this command takes a long time!
}
void LiquidCrystal_I2C::home()
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-07-23 16:50 LiquidCrystal_I2C\
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 93218 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 1588 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 13 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 51878 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 12090 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 9044 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 16140 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 41580 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 3028 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 25124 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 5588 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 16524 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 22756 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 8748 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 6532 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 8240 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 6416 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 4052 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 6992 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\ap
文件 1413 2013-07-23 15:39 LiquidCrystal_I2C\examples\CustomChars\CustomChars.pde
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\hello_2004\
目录 0 2013-07-23 15:39 LiquidCrystal_I2C\examples\hello_2004\ap
文件 93218 2013-07-23 15:39 LiquidCrystal_I2C\examples\hello_2004\ap
............此处省略55个文件信息
- 上一篇:基于FPGA病房呼叫系统
- 下一篇:s7_300_GRAPH中文编程手册
相关资源
- arduino1602屏幕滚动显示
- PMS5003T Arduino Uno
- Arduino_PS2X库文件
- arduino与Unity串口通讯.docx
- arduino new ping
- 关于12864显示屏与arduino的连接图
- 基于arduino驱动步进电机旋转魔方的全
- GY530-VL53L0X ARDUINO激光测距代码
- MsTimer2.zip
- Arduino 亚博智能平衡小车源码
- Arduino_Uno-原理图
- flexitimer2库
- Arduino 超声波库函数
- arduino 读取温湿度dht11
- arduino电子时钟
- 人体检测模块
- arduino 原理图 PCB
- DallasTemperature,OneWire库
- DS1302的Arduino函数库
- TB6600步进电机Arduino控制程序
- Arduino UNO引脚分布图
- 气压传感器SDP810的Arduino控制代码
- arduino软串口库文件SoftwareSerial
- Arduino感光灯
- Arduino驱动四线电阻触摸屏代码
- 武术擂台机器人代码arduino
- arduino 5路循迹小车代码
- 基于Arduino的PM2.5和空气湿度检测装置
- 手势识别传感器paj7620 arduino板使用代
- ARDUINO开发板与读卡模块的连接使用
评论
共有 条评论