+ Post New Thread
Results 1 to 6 of 6
  1. #1
    Newbie level 4
    Points: 176, Level: 2

    Join Date
    Feb 2012
    Posts
    7
    Helped
    0 / 0
    Points
    176
    Level
    2

    Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    Hello,

    How to interface GPS module with PIC 16F877A (MPLab IDE and HiTech C v9.8)
    my game plan is this

    * Receive the NMEA data from the GPS module baud rate 4800
    *Store it in a buffer in PIC 16F877A xtal 10MHz
    *Transmit the received dat via Bluetooth baud rate 4800

    here is the source code

    Code:
    #include <htc.h> 
    
    __CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS);
    
    unsigned char DATA;    //serial data buffer
    
    void interrupt isr(void)
    {
      if(RCIF && RCIE)
      {
        DATA = RCREG;
        if(TXIF)
        {
          TXREG = DATA;
        }
      }
    }
    
    void main(void)
    {
      ADCON1 = 0x06;    //all port pins digital I/O mode
      TRISB = 0xff ;     // set PORTB as INPUT
      PORTD = 0 ;    //clear PORTD output latch
      TRISD = 0 ;     // set PORTD as OUTPUT
      
      TRISC = 0b11000000;  //PORTC output, RC6 UART TX, RC7 UART RX
      SPBRG = 0x81;    //baud rate 4800bps w/10MHz xtal
      TXSTA = 0x24;    //asynchronous serial mode, enable transmit, high speed BRG mode
      RCSTA = 0x90;    //enable serial port, enable continuous receive
      PIE1 = 0x20;    //enable serial receive interrupt
      INTCON = 0xC0;    //enable peripheral interrupts, enable global interrupts
    
      //main code begins here
    
    
    }
    what i want to know is how to set up the hardware for this purpose dose my code work out or i need to change anything ?

    •   Alt18th March 2012, 11:53

      advertising

        
       

  2. #2
    Banned
    Points: 2,557, Level: 11

    Join Date
    Apr 2009
    Location
    Malaysia
    Posts
    330
    Helped
    98 / 98
    Points
    2,557
    Level
    11

    Re: Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    See this GPS example code.


    1 members found this post helpful.

    •   Alt18th March 2012, 11:58

      advertising

        
       

  3. #3
    Newbie level 4
    Points: 176, Level: 2

    Join Date
    Feb 2012
    Posts
    7
    Helped
    0 / 0
    Points
    176
    Level
    2

    Re: Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    Quote Originally Posted by engshahrul View Post
    I dont follow Malay anyway google translator is there :)
    btw is my code not useful at all ?



    •   Alt18th March 2012, 12:08

      advertising

        
       

  4. #4
    Banned
    Points: 2,557, Level: 11

    Join Date
    Apr 2009
    Location
    Malaysia
    Posts
    330
    Helped
    98 / 98
    Points
    2,557
    Level
    11

    Re: Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    Quote Originally Posted by sanoopgr8 View Post
    I dont follow Malay anyway google translator is there :)
    btw is my code not useful at all ?
    What you mean your code not usefull? That is only a piece of code, just receive UART. You still need to processing that.



  5. #5
    Newbie level 4
    Points: 176, Level: 2

    Join Date
    Feb 2012
    Posts
    7
    Helped
    0 / 0
    Points
    176
    Level
    2

    Re: Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    Quote Originally Posted by engshahrul View Post
    What you mean your code not usefull? That is only a piece of code, just receive UART. You still need to processing that.
    i just want to receive it and re-transmit it via bluetooth of same baud rate



    •   Alt18th March 2012, 16:34

      advertising

        
       

  6. #6
    Newbie level 5
    Points: 747, Level: 5

    Join Date
    Apr 2010
    Location
    Sri Lanka
    Posts
    9
    Helped
    1 / 1
    Points
    747
    Level
    5

    Re: Interfacing GPS module with RS232 with PIC 16F877A and transmit the received data

    you can do it.... just use RX pin to receive then TX to transmit through bluetooth. Do not forget to connect Ground for both.



--[[ ]]--