LCD I2C 2004A 4 wire Module Question

Hello friends.
I need help in identifying this code in reference to actual Arduino pin assignments. I will further explain after I load this code.

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


#define I2C_ADDR      0x27 // I2C address of PCF8574A
#define BACKLIGHT_PIN 3
#define En_pin        2
#define Rw_pin        1
#define Rs_pin        0
#define D4_pin        4
#define D5_pin        5
#define D6_pin        6
#define D7_pin        7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin, BACKLIGHT_PIN, POSITIVE);
void setup() 
{
  lcd.begin (20,4);  // initialize the lcd
// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,NEGATIVE);
  lcd.setBacklight(LED_ON);
}

void loop()  
{

// Reset the display 
  lcd.clear();
  delay(1000);
  lcd.home();
 
// Print on the LCD  
  lcd.setCursor(0,0); 
  lcd.print("Hello, world!");
  delay(5000);
}

The code of interest are the "Define" statements above. What am I defining actually, and are these above number related to Arduino pins or to the LCD module itself?

My unit is A 4 wire interface from the module 5+, GND, SDA, SCL

The reason this is so important is because I am wanting to interface my Arduino and use it
as a tachometer. I have read several postings related to this. The problem would be in the assignment of the interrupt to digital pin 2 or 3 in my addon code, if the above code actually is utilizing the Arduino pin assignments. This is where I need the clarification.

Here is picture from Ebay of the product:
LCD 2004A I2C 4 wire Module

Any help would be greatly appreciated. I already have the basic "Hello world" sample working fine.
TY,
houdinihar

The defines are pin numbers but you can still use the pins for other things

THe key ones are SDA and SCL.

I'm doing the saem exact think (Measuring RPM using an interrupt on Pin 2 and outputting the results to this 2004 display). Works fine.

PS #defines are kinda like a replace.

Pins refer to the PCF8574A.

The code of interest are the "Define" statements above. What am I defining actually, and are these above number related to Arduino pins or to the LCD module itself?

You are defining which of the pins on the PCF8574 or PCF8574A chip (which is on the I2C adapter) is used to drive each of the corresponding LCD module connections.

In your case #define En_pin 2 means that the LCD Enable pin will be driven by the PCF8574(A) pin number 2, etc.

Don

Thank you all for this valuable insight.
I feel much better about proceeding now without worrying about misusing the Arduino pins dealing with the interrrupts I need.

houdinihar

floresta:
You are defining which of the pins on the PCF8574 or PCF8574A chip (which is on the I2C adapter) is used to drive each of the corresponding LCD module connections.

In your case #define En_pin 2 means that the LCD Enable pin will be driven by the PCF8574(A) pin number 2, etc.

Don

But just to be clear the "pin number 2" is not the physical pin number on the pcf8574 16 pin chip.
It is the Px pin on the output port or the bit number in the output port register of the 8574.
i.e. pin number 2 or P2 is actually physical pin 6 of the chip.
So 0 means P0, 1 means P1 etc...

I had overlooked that point although it should have been obvious to me since IC pin numbering begins with 1 and not 0. I hope that correcting the wording of my answer doesn't make it more confusing by introducing some additional technical terms.

How about this?:

"You are effectively defining which of the pins on the PCF8574 or PCF8574A chip (which is on the I2C adapter) is used to drive each of the corresponding LCD module connections.

In your case #define En_pin 2 means that the LCD Enable pin will be driven by the PCF8574(A) pin that corresponds to bit number 2 of it's output port register, etc."

Don

floresta:
How about this?:

You are effectively defining which of the pins on the PCF8574 or PCF8574A chip (which is on the I2C adapter) is used to drive each of the corresponding LCD module connections.

I would say:

You are defining which of the i/o output port pins on the PCF8574 or PCF8574A chip (which is on the I2C adapter) is used to drive each of the corresponding LCD module connections.

That looks good.

Don