Hi. I am trying to read a gps I have (garmin 18 lvc) and all I can get is garbage on the lcd. I can successfully read the gps through hyperterminal at 4800 8/n/1. I am using MPLAB with C18 Compiler. Any help is appreciated.
gps datasheet https://www.electro-tech-online.com/custompdfs/2009/09/425_TechnicalSpecification.pdf
Here are my connections
GPS PIC
Serial --------> RC7
GND --------> Vss
+5 --------> Vdd
and here is the code (excluding lcd functions)
Code:
Thank you.
gps datasheet https://www.electro-tech-online.com/custompdfs/2009/09/425_TechnicalSpecification.pdf
Here are my connections
GPS PIC
Serial --------> RC7
GND --------> Vss
+5 --------> Vdd
and here is the code (excluding lcd functions)
Code:
Code:
void main()
{
OSCCON = 0b01110010; // Clock set to 8Mhz
TRISC = 0x00;
TRISB = 0x00;
PORTC = 0x00;
PORTB = 0x00;
ADCON1 = 0xFF;
lcd_init();
while (1)
{
serial();
}
}
void serial(void)
{
int i;
TXSTAbits.SYNC = 0;
RCSTAbits.SPEN = 1;
RCSTAbits.CREN = 0;
RCSTAbits.RX9 = 0;
TRISCbits.TRISC7 = 1;
TRISCbits.TRISC6 = 1;
BAUDCTLbits.BRG16 = 0;
OpenUSART (USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_LOW, 25); // calculated for 4800 baud
BAUDCONbits.RXDTP = 1; // gps uses inverted logic
while (!DataRdyUSART());
prnt(ReadUSART());
}
Thank you.