Microcontroller › PIC › PIC18F2550 with GTPA010
- This topic has 2 replies, 2 voices, and was last updated 10 years, 3 months ago by sampoornam.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
December 17, 2013 at 6:53 am #2764sampoornamParticipant
Hi,
I am trying to read lat and long values from GPS, having reference as you code.
But it doesn’t seem to work.
Can you please kindly check the GPS interface 18F4550 code once again and update.
sorry for the trouble.
– regards
– samp
December 18, 2013 at 6:51 am #10742AJISH ALFREDParticipantHi Sampoornam,
I guess all the projects in this site are uploaded after proper testing, you can find a working video as a proof.
December 18, 2013 at 6:55 am #10743sampoornamParticipantPlease find the code attached. It doesn’t display any. I am using mikroPRO C. Kindly help
– regards
-samp
//
// Program to Interface GPS GTPA010 with PIC18F2550 Microcontroller//LCD Control pins#define rs LATB.F4#define en LATB.F5//LCD Data pins#define lcdport LATBvoid lcd_ini();void dis_cmd(unsigned char);void dis_data(unsigned char);void lcdcmd(unsigned char);void lcddata(unsigned char);unsigned char rx_data();unsigned char longi_data[12];unsigned char lati_data[12];unsigned char data1,value=0;unsigned int i=0,pos;void main(){TRISB=0; // Set Port B as output portLATB=0;TRISA=0;LATA=0;UART1_init(9600);Delay_ms(100);// RCSTA.SPEN=1; // To activate serial port (Tx and Rx pins)// RCSTA.CREN=1; // To enable continuous receptionlcd_ini();while(1){data1=rx_data(); // Check the string ‘$GPGGA,’if(data1==’$’){data1=rx_data();if(data1==’G’){data1=rx_data();if(data1==’P’);{data1=rx_data();if(data1==’G’);{data1=rx_data();if(data1==’G’){data1=rx_data();if(data1==’A’){data1=rx_data();if(data1==’,’){data1=rx_data();while(data1!=’,’)data1=rx_data();for(i=0;data1!=’N’;i++)data1=rx_data();lati_data=data1; // Store the Latitude data}data1=rx_data();if(data1==’,’){for(i=0;data1!=’E’;i++){data1=rx_data();longi_data=data1; // Store the Longitude data}}i=0;dis_cmd(0x80);while(i<11){dis_data(lati_data); // Print the Latitude datai++;}i=0;dis_cmd(0xC0);while(i<12){dis_data(longi_data); // Print the Longitude datai++;}}}}}}//}}Delay_ms(1000);for(i=0;i<12;i++){data1=0;lati_data=0;longi_data=0;}}}unsigned char rx_data(void){while(PIR1.RCIF==0); // Wait until RCIF gets lowreturn RCREG; // Store data in Reception register}void lcd_ini(){dis_cmd(0x02); // To initialize LCD in 4-bit mode.dis_cmd(0x28); // To initialize LCD in 2 lines, 5×7 dots and 4bit mode.dis_cmd(0x0C); // 0x01 – clear screen, 0x02, return home, 0x046- increment cursor , 0x04- decrement cursordis_cmd(0x06); // 0x0E – Display On, Cursor ON, 0x80-force sursor to begining of 1st linedis_cmd(0x80); //0xC0 – Force cursor to beginning of third line, 0x94 beginning of second line 0xd4, beginning of 4th line}void dis_cmd(unsigned char cmd_value){unsigned char cmd_value1;cmd_value1 = ((cmd_value>>4)&0x0F); // Shift 4-bit and masklcdcmd(cmd_value1); // Send to LCDcmd_value1 = (cmd_value & 0x0F); // Mask lower nibble because RB4-RB7 pins are being usedlcdcmd(cmd_value1); // Send to LCD}void dis_data(unsigned char data_value){unsigned char data_value1;data_value1=((data_value>>4)&0x0F);lcddata(data_value1);data_value1=(data_value&0x0F);lcddata(data_value1);}void lcdcmd(unsigned char cmdout){lcdport=cmdout; //Send command to lcdport=PORTBrs=0;en=1;Delay_ms(10);en=0;}void lcddata(unsigned char dataout){lcdport=dataout; //Send data to lcdport=PORTBrs=1;en=1;Delay_ms(10);en=0;} -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.