At first I'd like to say hello to you here on arduino forum. I come here for help and advice on project I'm currently working on.
I've got an electronic module, based on Atmega164, which controls HD44780 16x02 LCD display. I try to connect pins on which would be LCD placed to my Arduino in order to grab LCD's output, without using an LCD. I want to convert it then to a string and send via bluetooth to my cellphone.
For testing purposes I connected another LCD to my Arduino, and then I grab module's output through PCF8574, wait for LCD's Enable signal, and when it's high, I read and then send data to my LCD. But it doesn't work. I tried debugging by Serial.print as well as measuring with my multimeter (I don't really know whether it's pointless or not), and it shows me that I might have a problem with synchronization between module and arduino.
I'm actually a bit clueless what to do next. Do you maybe have any idea what should I do to read that LCD? ![]()
Below I paste my code and a picture of my setup in case I explained something to intricately. On the right there's a module I read data from, connected to PCF8574, those to arduino, arduino to LCD on the left.
http://reklamy-interaktywne.pl/pub/aaa.jpg
#include <PCF8574.h>
#include <Wire.h>
PCF8574 expander1;
PCF8574 expander2;
// 3 - RS
// 4 - E,
// 5..13 - DB0..7
void setup()
{
expander1.begin(0x20);
expander2.begin(0x21);
pinMode(2, INPUT);
digitalWrite(2, HIGH);
expander1.enableInterrupt(2, onInterrupt);
expander2.attachInterrupt(0, onEnable, CHANGE);
for (int i = 3; i < 13; ++i)
{
pinMode(i, OUTPUT);
}
for (int i = 0; i < 8; ++i)
{
expander1.pinMode(i, INPUT); // DB0..7
expander2.pinMode(i, INPUT); // DB0..7
}
//expander2.pinMode(0, INPUT); // E
//expander2.pinMode(1, INPUT); // RS
Serial.begin(9600); // Setup serial for read echo
}
void onInterrupt()
{
expander2.checkForInterrupt();
expander1.checkForInterrupt();
}
volatile bool a = false;
void onEnable()
{
a = true;
}
void loop()
{
if (a == true)
{
digitalWrite(3, expander2.digitalRead(1));
for (int i = 0; i < 7; i++)
{
digitalWrite(i+5, expander1.digitalRead(i));
}
digitalWrite(4, LOW);
delay(10);
digitalWrite(4, HIGH);
delay(10);
digitalWrite(4, LOW);
a = false;
}
}