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 / pic 18F452 interfacing with gps

pic 18F452 interfacing with gps

|

Microcontroller › PIC › pic 18F452 interfacing with gps

  • This topic has 0 replies, 1 voice, and was last updated 10 years, 3 months ago by Kaiwalya Anil Ghundare Patil.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • February 23, 2015 at 3:53 pm #3489
    Kaiwalya Anil Ghundare Patil
    Participant

    Hello friends, I am working on my project of interfacing gps with pic 18f452.Please can anyone can help me by giving the working code.

     

    My code is not working. 

    My code is as follows:

     

    #include <p18f452.h>
    #pragma config OSC = HS
    #pragma config PWRT = OFF
     
    #pragma config WDT = OFF
    #pragma config LVP = OFF
     
     
    /*#define spbrg_value (((FREQ/64)/baud)-1)*/
    #define LCD_DATA    PORTD               //LCD data port
    #define lcdport        PORTE               //LCD signal port
    #define en          PORTEbits.RE2      // enable signal
    #define rw          PORTEbits.RE1      // read/write signal
    #define rs          PORTEbits.RE0     // register select signal
    #define BUSY        PORTDbits.RD7
     
    unsigned char rx_data();
    void lcd_ini(void);
    void lcdcmd(unsigned char);
    void lcddata(unsigned char);
    void Delay_ms(unsigned int time);
     
    char longi_data[12];
     char lati_data[12];
    unsigned char value,data=0;
    unsigned int i=0,pos;
     
    unsigned char rx_data(void)
    {
    while(PIR1.RCIF==0); // Wait until RCIF gets low
     RCREG=PORTD; // Store data in Reception register
    }
     
    void Delay_ms(unsigned int time)
    {
            unsigned int i, j;
            for (i = 0; i < time; i++)
                    for (j = 0; j < 350; j++);/*Calibrated for a 1 ms delay in MPLAB*/
    }
     
     
    void lcd_ini(void)
    {
    lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5×7 font
    lcdcmd(0x0C); // Display On and Cursor Off
    lcdcmd(0x01); // Clear display screen
    lcdcmd(0x06); // Increment cursor
    lcdcmd(0x80); // Set curso r position to 1st line, 1st column
    return;
    }
     
    void lcdcmd(unsigned char cmdout)
    {
    lcdport=cmdout; //Send command to lcdport=PORTB
    rs=0;
    rw=0;
    en=1;
    Delay_ms(10);
    en=0;
    }
     
    void lcddata(unsigned char dataout)
    {
    lcdport=dataout; //Send data to lcdport=PORTB
    rs=1;
    rw=0;
    en=1;
    Delay_ms(10);
    en=0;
    }
     
     
     
     
     
     
     
    void main()
    {
    TRISB=0;        //Configuring the PORTE pins as digital I/O 
    RCSTA=0x90;      //enable serial port and receiver
    SPBRG=15;        //9600 baud rate  
    TRISD = 0x00;         //Configuring PORTD as output
         TRISE = 0x00; 
     // To enable continuous reception
    lcd_ini();
    while(1)
     {
    data=rx_data(); 
    ; // Check the string '$GPGGA,'
    if(data=='$')
       {
    data=rx_data(); 
          if(data=='G')
            {
      data=rx_data(); 
               if(data=='P');
               {
         data=rx_data(); 
                    if(data=='G');
                     {
        data=rx_data(); 
                        if(data=='G')
                         {
                 data=rx_data(); 
                           if(data=='A')
                           {
               data=rx_data(); 
                            if(data==',')
                              {
               data=rx_data(); 
                                while(data!=',')
              data=rx_data(); 
                                     for(i=0;data!='N';i++)
    data=rx_data(); 
                         lati_data=data; // Store the Latitude data
                              }
         data=rx_data(); 
                                    if(data==',')
                                    {
                                       for(i=0;data!='E';i++)
                                        {
          data=rx_data(); 
                                          longi_data=data; // Store the Longitude data
                                        }
                                    }
                                         i=0;
                                         lcdcmd(0x80);
                                          while(i<11)
                                          {
                                              lcddata(lati_data); // Print the Latitude data
                                               i++;
                                          }
                                                    i=0;
                                                    lcdcmd(0xC0);
                                                    while(i<12)
                                                    {
                                                       lcddata(longi_data); // Print the Longitude data
                                                        i++;
                                                    }
                            }
                          }
                      }
                  }
                  }
    }
     
    Delay_ms(1000);
    for(i=0;i<12;i++)
    {
    data=0;
    lati_data=0;
    longi_data=0;
    }
    }
     
    }

     

     

    Error is:

    G:kaiwalyacollege folderBE sem2m programsgpsmodifiedgpsmodified.c:30:Error [1151] struct or union object designator expected
     
    Please help

     

  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Why can't I breadboard this oscillator? June 15, 2025
  • Failure of polypropylene motor-run capacitors June 14, 2025
  • a point I can't understand about the sinc expression June 14, 2025
  • Quick advice on remote car starter? June 14, 2025
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz June 14, 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