sanoopgr8
Newbie level 4
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
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 ?
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 ?