Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Gps_8051_KEIL_reading

Status
Not open for further replies.

jameer489

Newbie level 2
Joined
Mar 4, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,347
Hello Sir iam a B.tech Student doing the project "virtual distance measuring tape using gps"
for this iam extracting gprmc nmea data and dispaly on lcd,but the problem is it displaying the other fields which i dont need pls reply here is my code...IAM USING KEIL3

#include <reg51.h> //Define 8051 Registers
#include <stdio.h>
#include <string.h> //Define I/O Functions
#define DATA P1 //Define DATA to Port1


#ifdef MONITOR51 /* Debugging with Monitor-51 needs */
char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
#endif /* Stop Exection with Serial Intr. */
/* is enabled */

//Define control pins

sbit RS = P3^5; //Register Select
sbit RW = P3^6; //LCD Read/Write
sbit lcd_e = P3^7; //LCD Enable
unsigned char check;unsigned char utc; char active; char latitude[];
char lat_hem; char longitude[]; char lon_hem;
unsigned char temp; int n=0;
unsigned char buf[50];code unsigned char temp1; int p=0;code unsigned char longit[50];unsigned char data2;


//----------------------------------
// LCD Functions
//----------------------------------
//void lcd_cmd(unsigned char);
//void lcd_display(unsigned char);

void DelayMs(int);


//----------------------------------
// LCD command Function
//----------------------------------
void lcd_cmd(unsigned char cmnd)
{
DATA = cmnd;
RS = 0;
RW = 0;
lcd_e = 1;
DelayMs(35);
lcd_e = 0;
}


//----------------------------------
// LCD Data Function
//----------------------------------
void lcd_display(unsigned char dat)
{
DATA = dat;
RS = 1;
RW = 0;
lcd_e = 1;
DelayMs(35);
lcd_e = 0;
}



//----------------------------------
// LCD Delay Function
//----------------------------------
void DelayMs(int k)
{
unsigned int a;
for(a=0;a<=k;a++);
}



//----------------------------------
// LCD Initialization
//----------------------------------
void lcd_init(void)
{
unsigned char i;
unsigned char j;
lcd_cmd(0x38); //2x16 Character 5x7 dot
DelayMs(15); //matrix LCD,8-bit format
lcd_cmd(0x0c); //Display On, cursor off
DelayMs(15);
lcd_cmd(0x06); //Shift Cursor to right
DelayMs(15);
lcd_cmd(0x01); //Clear display screen
DelayMs(15);


//-------------------------------------------
// First Line Message Display
//-------------------------------------------
lcd_cmd(0x80); //First Line Initialization
DelayMs(35);
i=0;
while(buf!='\0')
{
lcd_display(buf);
i++;
}
DelayMs(50);
//second line
/* lcd_cmd(0xc1);
DelayMs(35);
while(longit[j]!='\0')
{
lcd_display(longit[j]);
j++;
} */

while(1);
}



//----------------------------------
// LCD Main Program
//----------------------------------
void main(void)
{

while(1)
{
#ifndef MONITOR51
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0XFD; /* TH1: reload check for 1200 baud @ 16MHz */
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
#endif

check= scanf("%c",&check);
if(check='$')
{ check=scanf("%c",&check);
if(check='G')
{ check=scanf("%c",&check);
if(check='P')
{ check=scanf("%c",&check);
if(check='R')
{ check=scanf("%c",&check);
if(check='M') { check=scanf("%c",&check);
if(check='C') { check=scanf("%c",&check);
if(check=',')
{
do
{
scanf("%c", &temp );
}
while(temp!=',') ;
check=scanf("%c",&temp);
if(check='A') {
do{
scanf("%c", &temp); }
while(temp!=',');

do
{ scanf("%c", &temp);
sprintf(buf+n,"%c", temp); n=n+1; }
while(temp!=',');
do{
scanf("%c", &lat_hem); }
while(lat_hem!=',');
do
{ scanf("%c", &data2);
sprintf(buf+n,"%c",data2);n=n+1;
}
while(data2!=',');
}

} }}}}}


lcd_init(); //LCD Initialization
DelayMs(50);
}}}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top