• 大小: 331KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-18
  • 语言: 其他
  • 标签: LCM1602  

资源简介

单片机开发,不能错过的精品文档,里面包含AM 库文件 芯片资料 原理图,及所有的源代码。

资源截图

代码片段和文件信息

//YWROBOT

#include “LiquidCrystal_I2C.h“
#include 
#if defined(ARDUINO) && ARDUINO >= 100

#include “Arduino.h“

#define printIIC(args) Wire.write(args)
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
send(value Rs);
return 0;
}

#else
#include “WProgram.h“

#define printIIC(args) Wire.send(args)
inline void LiquidCrystal_I2C::write(uint8_t value) {
send(value Rs);
}

#endif
#include “Wire.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
delay(50); 
  
// 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 << 4);
   delayMicroseconds(4500); // wait min 4.1ms
   
   // second try
   write4bits(0x03 << 4);
   delayMicroseconds(4500); // wait min 4.1ms
   
   // third go!
   write4bits(0x03 << 4); 
   delayMicroseconds(150);
   
   // finally set to 4-bit interface
   write4bits(0x02 << 4); 


// 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_ENTR

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      50798  2018-02-09 10:08  LCM1602IICShieldV1\原理图\Protel Schematic.pdf

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\原理图

     文件       1528  2018-02-09 09:40  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\diff.txt

     文件       1655  2018-02-09 09:45  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\CustomChars\CustomChars.ino

    ..AD...         0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\CustomChars

     文件        277  2017-09-19 18:22  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\LCM1602IIC_HelloWorld\LCM1602IIC_HelloWorld.ino

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\LCM1602IIC_HelloWorld

     文件        277  2017-01-02 20:04  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\LCM1602_Demo\LCM1602_Demo.ino

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\LCM1602_Demo

     文件        811  2018-02-09 09:45  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\SerialDisplay\SerialDisplay.ino

    ..AD...         0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples\SerialDisplay

    ..AD...         0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\examples

     文件       1095  2009-09-12 00:15  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\keywords.txt

     文件       8560  2018-02-09 09:40  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp

     文件       3428  2012-05-16 17:27  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\LiquidCrystal_I2C.h

     文件      41564  2009-09-12 00:15  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C\LiquidCrystal_I2C.o

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\库文件\LiquidCrystal_I2C

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\库文件

     文件     191206  2014-05-24 19:22  LCM1602IICShieldV1\芯片资料\LMB162AFC-Manual-Rev0.1.pdf

     文件     135713  2011-06-17 09:02  LCM1602IICShieldV1\芯片资料\PCF8574.pdf

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1\芯片资料

     目录          0  2018-02-09 10:09  LCM1602IICShieldV1

----------- ---------  ---------- -----  ----

               436912                    22


评论

共有 条评论