Hi everyone
I am trying to integrate a 20x4 LCD into a project running on a bigger MCU
Basically simple LCD4bit->PCF8574A->SDA/SCL_with_4.7KPullups->MCU circuit
Hardware (external to micro) not the issue: If I connect SCL/SDA and GND to a ATmega328p with same sketch uploaded, I2C works, and my LCD works too
Running the I2CScanner.pde sketch (from Playground) - it detects my PCF8574 on 0-x38 just fine and dandy from a 328p
Software also works - as two different scenarios has same symptoms:
- I2C Scanner: On ATMega328p : finds the I2C Device - On ATmega1284P : Does not find any I2C Devices
- LiquidCrystal_I2C - On ATMega328p - no issue, change Board to 1284 (Gen7 with Marlin cores on Arduino 1.0.3) - upload (i.e. no changes to code: I2C pins are coded in cores so no need to define, and I2C Address/pinout stays the same - same sketch goes to both boards) and darn, display does not even initialise
Now since the I2C Scanner sketch does not even detect any I2C devices on the 1284p it would not find a device to initialise at the address either (despite we knowing it is correct address)
Now about 2 months ago when I started developing this, I was using a ATmega644P (had on hand) and that was working with same (though slightly older) codebase (Arduino 1.0.0 with Gen 7 2.0 Cores). Then later in the project switched to 1284p. Now the actual project's code is of no importance, as I am simply testing with the LiquidCrystal_I2C sketch:
SO the question started arising, I2C in some way disabled on the 1284p? Looked at Engbedded's Fuse Calc and cannot see any fuses related to I2C/TWI (only SPI - which is enabled for my SD)
Someone mentioned PPR - a way to turn of LCD in code - but doubt strongly thats the case as it worked on the 644p...
Any ideas?
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x38 // Define I2C Address where the PCF8574A is
#define En_pin 6
#define Rw_pin 5
#define Rs_pin 4
#define D4_pin 3
#define D5_pin 2
#define D6_pin 1
#define D7_pin 0
int n = 1;
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
void setup()
{
pinMode(13, OUTPUT);
lcd.begin(20,4);
lcd.home(); // go home
lcd.print("I2C tester");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("F Malpartida library");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Test By OpenHardware");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print(".co.za ");}
void loop()
{
lcd.setCursor(14,3); // go col 14 of line 3
lcd.print(n++,DEC);
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}