Naumanpak
Member level 2
Hi experts, need help once more..
I am trying to get data from serial pin TXD of GPS module Holux GR-89 and then display on the LCD using 8051 microcontroller.
Module works perfectly when interfaced with PC.
With your guidance, I was successfully able to interface the 16x4 LCD.
But now, I am getting dummy values displayed on LCD.
GPS(TXD)------>89c51(P3.0)RXD------>LCD(getting dummy values)
LCD displays every thing right other than the data from serial pin.
here is my code:
I am trying to get data from serial pin TXD of GPS module Holux GR-89 and then display on the LCD using 8051 microcontroller.
Module works perfectly when interfaced with PC.
With your guidance, I was successfully able to interface the 16x4 LCD.
But now, I am getting dummy values displayed on LCD.
GPS(TXD)------>89c51(P3.0)RXD------>LCD(getting dummy values)
LCD displays every thing right other than the data from serial pin.
here is my code:
Code:
#include <regx51.h>
#include <lcd.h>
#define lcd_port P0
#define XTAL 11.059200
#define XDIVIDER 12.0
#define delay_1ms 164 * (XTAL/XDIVIDER)
void delay(unsigned char);
void delay_ms(unsigned int);
void SerialInit()
{
TMOD = 0x20; // timer 1 (8 bit auto-reloed)
TH1 = 0xFA; //to obtain 4800 baud rate
TR1 = 1; //start timer
SCON = 0x50;
return;
}
unsigned char SerialRecvChar()
{
while(!RI); //waits till a byte is recieved
RI = 0;
return (SBUF);
}
main()
{
unsigned char ch;
unsigned int i=0;
lcd_command(0x01);
Lcd_Ini();
lcd_display('G');
lcd_display('P');
lcd_display('S');
lcd_display(' ');
lcd_display('B');
lcd_display('a');
lcd_display('s');
lcd_display('e');
lcd_display('d');
lcd_command(0xC2);
lcd_display('N');
lcd_display('a');
lcd_display('v');
lcd_display('i');
lcd_display('g');
lcd_display('a');
lcd_display('t');
lcd_display('i');
lcd_display('o');
lcd_display('n');
lcd_command(0x94);
lcd_display('*');
lcd_display('*');
lcd_display('*');
lcd_display('*');
while(1)
{
SerialInit();
ch=SerialRecvChar();
lcd_command(0xd0);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd1);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd2);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd3);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd4);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd5);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd6);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd7);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd8);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xd9);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xda);
lcd_display(ch);
ch=SerialRecvChar();
lcd_command(0xdb);
lcd_display(ch);
}
}