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 / PIC16F877 and GPS module (EM-406A)

PIC16F877 and GPS module (EM-406A)

|

Projects › Projects › PIC16F877 and GPS module (EM-406A)

  • This topic has 4 replies, 4 voices, and was last updated 13 years, 7 months ago by midhun.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 30, 2012 at 1:00 pm #1824
    osama
    Participant

    Hi every one 

     

    i wrote this code for a project to interface EM-406A with PIC 16F877

    but it does’t work .

     

     

     
    char uart_rd;
    char uart[11];
     
    // LCD module connections
    sbit LCD_RS at LATB2_bit;
    sbit LCD_EN at LATB3_bit;
    sbit LCD_D4 at LATB4_bit;
    sbit LCD_D5 at LATB5_bit;
    sbit LCD_D6 at LATB6_bit;
    sbit LCD_D7 at LATB7_bit;
     
    sbit LCD_RS_Direction at TRISB2_bit;
    sbit LCD_EN_Direction at TRISB3_bit;
    sbit LCD_D4_Direction at TRISB4_bit;
    sbit LCD_D5_Direction at TRISB5_bit;
    sbit LCD_D6_Direction at TRISB6_bit;
    sbit LCD_D7_Direction at TRISB7_bit;
    // End LCD module connections
     
    void main() {
      TRISB = 0;
      PORTB = 0x00;
     
      UART1_Init(4800);              // Initialize UART module at 9600 bps
      Delay_ms(3000);                 // Wait for UART module to stabilize
     
      //UART1_Write_Text(“Start”);
      Lcd_Init();                        // Initialize LCD
      Lcd_Cmd(_LCD_CLEAR);                // Clear display
      Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
     
      lcd_out(1,1,”lcd”);
      delay_ms(1000);
     
      uart1_write(0x08);
      delay_ms(5000);
      while(1) {
          // uart1_write_text(“$GPGGA,002153.000,3342.6618,N,11751.3858,W,1,10,1.2,27.0,M,-34.2,M,,0000*5E,0x0d,0x0a”);
         //uart1_write_text(“$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41,0x0d,0x0a”);
         //uart1_write(0x0d);
         //uart1_write(0x0a);
         delay_ms(2000);
         delay_ms(10000);
         if(UART1_Data_Ready()) {      // If data is received,
         uart_rd=uart1_read();
       //  gps_value=gps_data(GPS_LATHIGH);
         lcd_chr(2,12,uart_rd);
         uart1_read_text(uart, “.”, 15);
         lcd_out(1,5, uart);
         delay_ms(500);
      }
      }
    }
     
     
     
     
     
     
     
     
    any suggestions 
     
     
    thank u.
     
     
    May 30, 2012 at 4:57 pm #7940
    AJISH ALFRED
    Participant

     

    Hi,

     

    Have you initialized the uart1 properly for the baud rate of 9600?

    Don’t try writing into the uart, all you have to do is to read the data coming into the uart1 from the gps.

    Could you please comment your code properly and update, so that it would be easy for some one who can really help you with it.

    May 31, 2012 at 9:53 am #7943
    osama
    Participant

     

     

     

     
    char uart_rd;
    char uart[11];
     
    // LCD module connections
    sbit LCD_RS at LATB2_bit;
    sbit LCD_EN at LATB3_bit;
    sbit LCD_D4 at LATB4_bit;
    sbit LCD_D5 at LATB5_bit;
    sbit LCD_D6 at LATB6_bit;
    sbit LCD_D7 at LATB7_bit;
     
    sbit LCD_RS_Direction at TRISB2_bit;
    sbit LCD_EN_Direction at TRISB3_bit;
    sbit LCD_D4_Direction at TRISB4_bit;
    sbit LCD_D5_Direction at TRISB5_bit;
    sbit LCD_D6_Direction at TRISB6_bit;
    sbit LCD_D7_Direction at TRISB7_bit;
    // End LCD module connections
     
    void main() {
      TRISB = 0;
      PORTB = 0x00;
     
      UART1_Init(4800);              // Initialize UART module at 9600 bps
      Delay_ms(3000);                 // Wait for UART module to stabilize
     
      //UART1_Write_Text(“Start”);
      Lcd_Init();                        // Initialize LCD
      Lcd_Cmd(_LCD_CLEAR);                // Clear display
      Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
     
      lcd_out(1,1,”lcd”);
      delay_ms(1000);
     
      uart1_write(0x08);
      delay_ms(5000);
      while(1) {
          
         delay_ms(2000);
         delay_ms(10000);
         if(UART1_Data_Ready()) {      // If data is received,
         uart_rd=uart1_read();
                                                   //  gps_value=gps_data(GPS_LATHIGH);
         lcd_chr(2,12,uart_rd);
         uart1_read_text(uart, “.”, 15);
         lcd_out(1,5, uart);
         delay_ms(500);
      }
      }
    }
    June 5, 2012 at 9:47 am #7970
    Anonymous
    Guest

    i have the same prob , i send a msg when i find the solution.

    June 19, 2012 at 12:57 pm #8078
    midhun
    Participant

     

    char uart_rd;
    char uart[11];
     
    // LCD module connections
    sbit LCD_RS at LATB2_bit;
    sbit LCD_EN at LATB3_bit;
    sbit LCD_D4 at LATB4_bit;
    sbit LCD_D5 at LATB5_bit;
    sbit LCD_D6 at LATB6_bit;
    sbit LCD_D7 at LATB7_bit;
     
    sbit LCD_RS_Direction at TRISB2_bit;
    sbit LCD_EN_Direction at TRISB3_bit;
    sbit LCD_D4_Direction at TRISB4_bit;
    sbit LCD_D5_Direction at TRISB5_bit;
    sbit LCD_D6_Direction at TRISB6_bit;
    sbit LCD_D7_Direction at TRISB7_bit;
    // End LCD module connections
     
    void main() {
      TRISB = 0;
      PORTB = 0x00;
     
      UART1_Init(4800);              // Initialize UART module at 9600 bps*******************************************UART1_Init(9600);
      Delay_ms(3000);                 // Wait for UART module to stabilize
     
      //UART1_Write_Text(“Start”);// not required, you only receive data. dont send any.
      Lcd_Init();                        // Initialize LCD
      Lcd_Cmd(_LCD_CLEAR);                // Clear display
      Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
     
      lcd_out(1,1,”lcd”); why to display “LCD”?
      delay_ms(1000);
     
      uart1_write(0x08);// why writing this???? remove it.
      delay_ms(5000);// not required.
      while(1) {
          
         delay_ms(2000);
         delay_ms(10000);/// together you can write it asdelay_ms(12000);
         if(UART1_Data_Ready()) {      // If data is received,
         uart_rd=uart1_read();
                                                   //  gps_value=gps_data(GPS_LATHIGH);
         lcd_chr(2,12,uart_rd);
         uart1_read_text(uart, “.”, 15);
         lcd_out(1,5, uart);
         delay_ms(500);
      }
      }
    }
     
     
    just try it nw….
    BEST OF LUCK.
     
  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Variable audio oscillator January 17, 2026
  • Sine wave distortion January 17, 2026
  • My Advanced Realistic Humanoid Robots Project January 17, 2026
  • Micro mouse January 17, 2026
  • flexible copper cable January 16, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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