Go Down

Topic: Stealing data sent to an LCD (Read 9098 times) previous topic - next topic

bobhaha

Hey guys,

I have done some basic work interfacing an arduino and an LCD and as far as I understand the arduino sends serial information to the LCD in order for the onboard IC's to understand and display on the screen.

Well I want to reverse this....

I have a device that measures a lasers power then displays the result on to the detachable LCD module.

Well I would like to take the info that the circuit is transmitting to the LCD and take that in as serial data to the arduino. Is this possible? The LCD module is a standard 16 pin configuration, so I assume pin 7 - 14 are used as serial outputs to the LCD correct?

ams0178

We'd need a little more info. Do you have a datasheet, part number, etc for the LCD you have?

bobhaha

Model number is SVM802B-1/V2

Datasheet is here... http://www.datasheet4u.net/download.php?id=611907

I just need some direction (link, code snippet... anything) to intercept the data and make it into something the Arduino can understand.


robtillaart

Quote
so I assume pin 7 - 14 are used as serial outputs to the LCD correct?


Think not, I think it is parallel 7-14 = 8 datalines = 1 byte in parallel.

You could try to read them with a 74HC165 shiftin - http://www.arduino.cc/en/Tutorial/ShiftIn - and -  http://arduino.cc/en/Reference/ShiftIn -
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bobhaha

So the chip basically "records" all input then spits it out once the ardunio asks for it.. is that correct?

If so, does it matter what format the incoming communication is in? I believe I have found the 4 terminals responsible for the data transmission. But I have confirmed that pin 7 - 14 are D0 - D7 So I assume this is where the data is sent.

FeersumEndjinn

One thing - if it is a standard HD44780 compatible LCD, it is a Parallel device, not serial.  There are major differences between the 2 in how they work and what your solution has to be.

A Shift register will normally record 1 byte of data, i.e. 1 character.  It does this by shifting in 8 bits, 1 bit at a time.

Your Arduino really has to do nothing other than sit listening to the LCD lines though, in case it ends up missing something if it is off somewhere else executing something else in a program loop.




bobhaha

#7
Oct 11, 2011, 06:15 pm Last Edit: Oct 11, 2011, 06:17 pm by bobhaha Reason: 1
As far as I know it is a standard HD44780... so it is a parallel interface device.

So with the suggested CD4021B shift register I can accomplish this? If this is not available what type of shift register am I looking for?

EDIT: Is this what I'm looking for? http://jaycar.com.au/products_uploaded/ZC4858.pdf

Thanks in advance

robtillaart


Quote
Is this what I'm looking for?

looks good, maybe you should find a version that is easier to solder ?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bobhaha

Ok, So I've bought 2 of these shift registers now I need program them in.

I've connected them as shown below...



I've also used the code supplied here http://arduino.cc/en/Tutorial/ShftIn11

This only gives me outputs like below...

111000
-------------------
111000
-------------------
111000
-------------------
111000
-------------------
11100
-------------------
11000
-------------------
111000
-------------------
11100
-------------------
11000
-------------------
111000
-------------------
11000

Which I have tried to convert to bytes but only getting garbage.

I know the onboard chip runs at 4800 baud, how can I sync the shift register, Arduino and LCD display chip?

bobhaha


hellonearthis

What does your code look like?  Would be interesting to see what your doing.

Still instead of interception what about reading from the LCD.
The LCD has ram so you could try to access it and copy what is in the screens memory.

http://www.adafruit.com/datasheets/HD44780.pdf
http://www.adafruit.com/datasheets/TC1602A-01T.pdf

Or, working with what you have, the character generator rom table in the TC1602A pdf might help you decode the response.

bobhaha

I used the code found on the link I provided above.

Code: [Select]
//**************************************************************//
//  Name    : shiftIn Example 1.1                              //
//  Author  : Carlyn Maw                                        //
//  Date    : 25 Jan, 2007                                      //
//  Version : 1.0                                               //
//  Notes   : Code for using a CD4021B Shift Register    //
//          :                                                   //
//****************************************************************

//define where your pins are
int latchPin = 8;
int dataPin = 9;
int clockPin = 7;

//Define variables to hold the data
//for shift register.
//starting with a non-zero numbers can help
//troubleshoot
byte switchVar1 = 72;  //01001000

void setup() {
  //start serial
  Serial.begin(9600);

  //define pin modes
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, INPUT);

}

void loop() {

  //Pulse the latch pin:
  //set it to 1 to collect parallel data
  digitalWrite(latchPin,1);
  //set it to 1 to collect parallel data, wait
  delayMicroseconds(20);
  //set it to 0 to transmit data serially 
  digitalWrite(latchPin,0);

  //while the shift register is in serial mode
  //collect each shift register into a byte
  //the register attached to the chip comes in first
  switchVar1 = shiftIn(dataPin, clockPin);

  //Print out the results.
  //leading 0's at the top of the byte
  //(7, 6, 5, etc) will be dropped before
  //the first pin that has a high input
  //reading 
  Serial.println(switchVar1, BYTE);

//white space
Serial.println("-------------------");
//delay so all these print satements can keep up.


}

//------------------------------------------------end main loop

////// ----------------------------------------shiftIn function
///// just needs the location of the data pin and the clock pin
///// it returns a byte with each bit in the byte corresponding
///// to a pin on the shift register. leftBit 7 = Pin 7 / Bit 0= Pin 0

byte shiftIn(int myDataPin, int myClockPin) {
  int i;
  int temp = 0;
  int pinState;
  byte myDataIn = 0;

  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, INPUT);
//we will be holding the clock pin high 8 times (0,..,7) at the
//end of each time through the for loop

//at the begining of each loop when we set the clock low, it will
//be doing the necessary low to high drop to cause the shift
//register's DataPin to change state based on the value
//of the next bit in its serial information flow.
//The register transmits the information about the pins from pin 7 to pin 0
//so that is why our function counts down
  for (i=7; i>=0; i--)
  {
    digitalWrite(myClockPin, 0);
    delayMicroseconds(0.2);
    temp = digitalRead(myDataPin);
    if (temp) {
      pinState = 1;
      //set the bit to 0 no matter what
      myDataIn = myDataIn | (1 << i);
    }
    else {
      //turn it off -- only necessary for debuging
     //print statement since myDataIn starts as 0
      pinState = 0;
    }

    //Debuging print statements
    //Serial.print(pinState);
    //Serial.print("     ");
    //Serial.println (dataIn, BIN);

    digitalWrite(myClockPin, 1);

  }
  //debuging print statements whitespace
  //Serial.println();
  //Serial.println(myDataIn, BIN);
  return myDataIn;
}


I'm just trying to get some consistent results.

The output should look like this:

0mW
eng dnw up

But I'm getting a bunch of random letters with no consistency when I change the output to byte.

robtillaart


Think you must look if the LCD has some sort of clock signal, and synchronize your duino to that.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bobhaha

This is the pin config..

1. VSS
2. VDD
3. V0
4. RS
5. R/W
6. E
7 ---- 14
D0----D7

So which pin will give me the clock pin. Personally I think this can all be fixed with proper syncing. The wiring looks right.

Go Up