Microcontroller › 8051 › Interface a GPS module with 8051 extract the RMC data and display on 16×2 lcd
- This topic has 1 reply, 2 voices, and was last updated 13 years, 1 month ago by
praveen.
-
AuthorPosts
-
March 19, 2012 at 4:26 pm #1563
Tyrone
ParticipantI’m trying to build up a sort of a GPS trecker using the SkyNave SKM53 gps module and interface it with the 89C51AC2 microcontroller. I’ve tried of all sort and thanks to this site I made up lots of improvement. Here I found a project that is similar to what I want to biuld, here’s the link:
I’ve done the same programming as I found here but I changed the output pins of the lcd instead of P2 I used P0 but the lcd dispaly nothing. Now I’m trying to just display the date so at least I can begin from somewhere I have diplayed “DATE” on the fist line and on the second line the result is something like this %%-%%-%% . Below is the program of what I’ve done so far could someone please help me to extract the correct date please…
#include<reg51.h>char info[70];char test[6]={“$GPRMC”};char comma_position[13];unsigned int check=0,i;unsigned char a;void lcd_data (unsigned int i);void lcd_cmd(unsigned int i);void delay(int j);void initialise_lcd();void lcd_date();void serial();void find_comma();void lcd_string();// SERIAL PORT SETTINGvoid serial(){TMOD=0x20; //MODE=2TH1=0xFD; // 9600 BAUDRATESCON=0x50 ; // SERIAL MODE 1 ,8- BIT DATA ,1 STOP BIT ,1 START BIT , RECEIVING ONTR1=1; //TIMER START}void receive_data() interrupt 4{info[check++]=SBUF; //Read SBUFif(check<7){if(info[check-1]!=test[check-1])check=0;}RI=0;}void main(){serial();while(1){find_comma();lcd_date();}}// Send the begining commads – Alwaysvoid initialise_lcd(){lcd_cmd(0x38); //init. LCD 2 lines,5×7 matrixdelay(1000);lcd_cmd(0x0e); //display on, cursor ondelay(1000);lcd_cmd(0x01); //clear lcddelay(1000);lcd_cmd(0xc0); //cursordelay(1000);}// Sending Command To LCDvoid lcd_cmd(unsigned int i){P0 = i ;P2 = 0X04; //rs = 0, rw = 0, e = 1P2 = 0X00; //clear enable to make pulse}// Sending Data To LCDvoid lcd_data (unsigned int i){P0 = i ;P2 = 0X05; //rs = 1, rw = 0, e = 1P2 = 0X01; //clear enable to make pulse}void lcd_date(){unsigned int c9=comma_position[8];unsigned char i =0;char write[] = “DATE”;initialise_lcd();lcd_cmd(0x80);for(i=0; i<4; i++){delay(1000);lcd_data(write);}delay(1000);lcd_cmd(0xC0);delay(1000);lcd_data(info[c9+1]);delay(1000);lcd_data(info[c9+2]);delay(1000);lcd_data(‘-‘);delay(1000);lcd_data(info[c9+3]);delay(1000);lcd_data(info[c9+4]);delay(1000);lcd_data(‘-‘);delay(1000);lcd_data(info[c9+5]);delay(1000);lcd_data(info[c9+6]);delay(1000);while(1);}//DELAY FUNCTIONvoid delay(unsigned char i){unsigned int rr;for (rr = 0; rr < i; rr++);}void find_comma(){unsigned int i,count=0;for(i=0;i<70;i++){if(info==’,’){comma_position[count]=i;}}}ThanksTyroneMarch 22, 2012 at 7:12 pm #7319praveen
Participanti have problem in inerrupt 4……the value from gps is not matching with the test array…..what should be done
-
AuthorPosts
- You must be logged in to reply to this topic.