Microcontroller › PIC › Problem in program while interfacing with pic16f877a and gps (634r) skytraq
- This topic has 0 replies, 1 voice, and was last updated 11 years, 1 month ago by
pradeep.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
March 21, 2014 at 2:13 pm #2965
pradeep
Participantour motive is to receive longitude and latitude from the gps ($GPGGA) and store them in an array of microcontroller 16f877a..
I used LED in ports to find whether tthe data is received or not.
because i do not have lcd to c the output of gps….. bt i c them in PUTTY software…
i can see indication that i receive $ sign
the program does not work further r no other indication seen….
Tell if any mistake is there in our program and try to correct it and help me out..
(our program is given below)::: [program written in HIGH TECH C COMPILER]…..
#include<pic.h>#include<string.h>__CONFIG( HS & WDTDIS & BOREN & LVPDIS );static bit OO@((unsigned )&PORTB*8+1);static bit KK@((unsigned )&PORTB*8+2);static bit EE@((unsigned )&PORTB*8+3);static bit II@((unsigned )&PORTB*8+7);void delay(unsigned int y)//delay prg{while(y–);}unsigned char a=0,data;unsigned char lat[15],lon[15],i,j,ch,gps[10];unsigned char UART_Getc(){while(RCIF == 0);return RCREG;}void interrupt ISR(void){if(RCIF == 1){data=UART_Getc();RCIF==0;}}void GPS_Status(){// delay(100);do{}while(data != ‘$’);OO=1; //this LED GLOWS WHEN I switch on GPS i.e we receive $ signi = 0;do{gps[i++] =data;}while(gps[i-1] != ‘,’);gps[i-1] = 0;if(strcmp(“GPGGA”,gps) == 0){KK=1;do{ch =data;}while(ch != ‘,’);i = 0;EE=1;for(j=0;j<2;j++){do{lat[i++] =data;}while(lat[i-1] != ‘,’);}lat[i-1] = 0;i = 0;for(j=0;j<2;j++){do{lon[i++] =data;}while(lon[i-1] = ‘,’);}lon[i-1] = 0;}}void main(){TRISC=0XFF;TRISB=0X00;TXSTA=0X24;RCSTA=0X90;PORTB=0X00;SPBRG=25;BRGH=1;GIE=1;PEIE=1;RCIE=1;TRISD=0X00;while(1){GPS_Status();delay(10000);while(1);}} -
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.