1
\$\begingroup\$

LCD screen shotI have a project to work as follow: this is a PIC based (PIC16C62B) porudct which measures value coming from mechanical gyro sensor. analog data from gyro amplified and sent to AD7707 to convert into serial. PIC reads this serial of AD7707 and shows gyro values/data on 16x2 LCD after internal processing. I dont know about the internal program/code of PIC being used into it. the PIC is code protected and I cannot read its hex. now I am required to show LCD vlues/data same on computer in any case.

I dont understand how to do it. if anyone have any idea to do this or had worked on please help me in this situation. I will be thankful for all positive response.

char a,b,c,d,e,f,g,h,var;
char i=0;
char con=0;
char low=0;

//byte sBuffer[256];
//unsigned int nLen;

//nLen = HexToASCII(sBuffer, "65 66 67");

void setup() {
 Serial.begin(1200);
 //pinMode(13, INPUT);
pinMode(12,INPUT);    //Define RS
pinMode(11,INPUT);    //Define EN
pinMode(5,INPUT);
pinMode(4,INPUT); 
pinMode(3,INPUT);
pinMode(2,INPUT);
pinMode(9,INPUT);
pinMode(8,INPUT);
pinMode(7,INPUT);
pinMode(6,INPUT);
  a=0;
   b=0;
   c=0;
   d=0;
   e=0;
   f=0;
   g=0;
   h=0;
   con=0;
   low=0;
}

void loop() {




  if(digitalRead(11)==HIGH && low==0)                //EN hight
  {
    low=1;
  }
  if(digitalRead(11)==LOW && low==1){
     if (digitalRead(12)==HIGH){                     //RS high
   a=digitalRead(9);
   b=digitalRead(8);
   c=digitalRead(7);
   d=digitalRead(6);
   e=digitalRead(5);
   f=digitalRead(4);
   g=digitalRead(3);
   h=digitalRead(2);
//   var = (h*128)+(g*64)+(f*32)+(e*16)+(d*8)+(c*4)+(b*2)+(a*1);
   var = (h<<7)+(g<<6)+(f<<5)+(e<<4)+(d<<3)+(c<<2)+(b<<1)+(a);

   con=1;
   low=0;
   }
  }
  if(con==1){
  //  String str(var);
    Serial.print(var);
    //Serial.print("\n");
     a=0;
     b=0;
     c=0;
     d=0;
     e=0;
     f=0;
     g=0;
     h=0;
     con=0;
     var=0;
  }

}

connection of LCD with Arduino

\$\endgroup\$
  • 1
    \$\begingroup\$ You will have to provide a great more detail than that; obligatory "we are not psychic". \$\endgroup\$ – uint128_t Jan 13 '16 at 5:48
  • \$\begingroup\$ sure dude. I understand. I edit my question and give more details that I am able to give. thanx \$\endgroup\$ – abdul razzaq Jan 13 '16 at 6:01
2
\$\begingroup\$

It sounds like you've got

schematic

simulate this circuit – Schematic created using CircuitLab

and you want to tap off the data somewhere. You have two choices:

  • Tap off the digital signal before the PIC and write your own code to process the data and display it.
  • Monitor the parallel data into the LCD. To do this you would need to monitor all the data lines with a micro - Arduino, for example. In micro memory create 2 * 16 memory registers and figure out what each command written to the LCD means and update your registers with the displayed values. You then transmit all 32 registers or the few you're interested in to your PC over serial.

Arduino LCD

Arduino.cc image of LCD setup. In your case you would be monitoring the LCD rather than writing to it.

I hope you have plenty of time available. Your going to need it.

Pseudo code

The main problem here will be keeping up with the LCD writing while trying to serial print the received data. I suggest that you try and capture one complete LCD update, serial print it, then wait for the start of the next update. (Watch for control code to move back to position 0 or whatever.)

void setup() {
  int chars[80]; // Line 1 uses DDRAM address 0x00 to 0x0F.
                 // Line 2 uses DDRAM address 0x40 to 0x4F.
}

void loop() {
  if(picWriting) {
    char = readLCDdata();            // Read the LCD byte.
    if(isControlCode) {              // Is it a control code or a character?
      updateLcdDdramPointer(char);   // Point to the array location for this character.
    } else {
      storeCharacter(char, pointer); // Put this character into the array.
    }
  }
  if(pointer == lastChar) {          // The last character has been read.
    // Serial.print out all the characters of interest.
  }
  // If printing takes too long the PIC may have started updating the display already.
  // Wait for start of next LCD refresh.
}
\$\endgroup\$
  • \$\begingroup\$ If I create new code to read serial of AD7707 then much difficult because of sensor calibration used. so I prefer to fetch data parallel from LCD pins. to implement this, I am not able to open schematic and Arduino code images attached in answer. please attach images again. also note that PIC sends 8bit data to LCD. thanx transistor \$\endgroup\$ – abdul razzaq Jan 13 '16 at 15:52
  • \$\begingroup\$ There is no schematic and no Arduino code image in my answer. Just a block diagram (that you should have created for your question) and a typical Arduino LCD setup. Your job will be easier with 8-bit data to LCD. \$\endgroup\$ – Transistor Jan 13 '16 at 19:08
  • \$\begingroup\$ I did it by reading all parallel data bits of 16x2 LCD on arduino leonardo. it starts get data and sends serial to computer successfully but the problem is that some of data is missing... like if data on lcd is 6 digit 123456 then continuously received data is like 125623 etc as random... i think some computation is involved and pointer is busy in doing serial and misses some data. now how can I solve it....? \$\endgroup\$ – abdul razzaq Jan 15 '16 at 4:18
  • \$\begingroup\$ That was quick! Edit your post and include a schematic of how you are connecting to the LCD. How do you know when to read? \$\endgroup\$ – Transistor Jan 15 '16 at 7:37
  • \$\begingroup\$ according to LCD data read and writing timing diagram, when en pin is high then read data. \$\endgroup\$ – abdul razzaq Jan 16 '16 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.