EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / PIC18F2550 with GTPA010

PIC18F2550 with GTPA010

|

Microcontroller › PIC › PIC18F2550 with GTPA010

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 4 months ago by sampoornam.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • December 17, 2013 at 6:53 am #2764
    sampoornam
    Participant

    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 #10742
    AJISH ALFRED
    Participant

    Hi 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 #10743
    sampoornam
    Participant

    Please 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 LATB
     
    void 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 port
            LATB=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 reception
     
            lcd_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 data
                                                    i++;
                                                    }
                                                    i=0;
                                                    dis_cmd(0xC0);
                                                    while(i<12)
                                                    {
                                                    dis_data(longi_data);          // Print the Longitude data
                                                    i++;
                                                    }
                                                    }
                                                    }
                                                    }
                                            }
                                    }
                         //}
                    }
                    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 low
            return 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 cursor
            dis_cmd(0x06);                 // 0x0E – Display On, Cursor ON, 0x80-force sursor to begining of 1st line
            dis_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 mask
            lcdcmd(cmd_value1);                               // Send to LCD
            cmd_value1 = (cmd_value & 0x0F);        // Mask lower nibble because RB4-RB7 pins are being used
            lcdcmd(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=PORTB
            rs=0;
            en=1;
            Delay_ms(10);
            en=0;
    }
     
    void lcddata(unsigned char dataout)
    {
            lcdport=dataout;        //Send data to lcdport=PORTB
            rs=1;
            en=1;
            Delay_ms(10);
            en=0;
    }
  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Need Help Figuring Out the Schematics Of Circuit Board May 13, 2025
  • Wish to buy Battery, Charger and Buck converter for 12V , 2A router May 12, 2025
  • applying solder paste from a jar May 12, 2025
  • Question i-nears headphones magnetic drivers May 12, 2025
  • An Update On Tarrifs May 12, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise