2
\$\begingroup\$

I have a Quectel L80 GPS module with PIC24fj128ga202. I am using UART2 to get GPS data from the module and I transfer the received data to hyperterminal, using UART1. Between PIC and PC I there is an RS3232 converter. Here I did not get response data from GPSmodule in hyperterminal.

My code:

void silicon(void)
{
    OSCCON = 0x0000;
    CLKDIV   =  0x0000;  
    OSCTUN = 0; 
    RPINR18bits.U1RXR   = 7;
    RPOR4bits.RP8R  =   3;
    RPINR19bits.U2RXR   = 14;
    RPOR6bits.RP13R  =   5;      
    ANSA = 0x0000;
    ANSB = 0x0000;
    PORTA = 0x0000;
    TRISA = 0x0000;
    PORTB = 0x0000;
    TRISB = 0xc000;
    U1MODE = 0x0000;
    U1STA = 0x0400;     
    U1BRG = 25;
    U1MODEbits.UARTEN = 1;
    U2STA = 0x0400;     
    U2BRG = 25;
    U2MODEbits.UARTEN = 1;
    PORTBbits.RB15=1;
    TMR1 = 0;
    while (TMR1 < DELAY)
    {

    }
    PORTBbits.RB15 =0;
    TMR1 = 0;
    while (TMR1 < DELAY)
    {

    }        
}

void uartsend(char in_c)
{
    while(U1STAbits.UTXBF != 0);
    U1TXREG = in_c;
}

char uartrec()
{
    char c;
    while(U1STAbits.URXDA == 0); 
    c = U1RXREG;
    return c;   
}
void uartsend2(char in_c)
{
    while(U2STAbits.UTXBF != 0);
    U2TXREG = in_c;
}

char uartrec2()
{
    char c;
    while(U2STAbits.URXDA == 0); 
    c = U2RXREG;
    return c;   
}

int main()
{
    int i,j;
    led = 1;
    silicon();
    while(1)
    {
        uartsend(uartrec2());
        led =!led;
        for(j=0;j<250;j++)
        {
            for(i=0;i<1275;i++);
        }
    }
    return 0;
}
\$\endgroup\$
  • 1
    \$\begingroup\$ Are you able to send something else with UART1 to the hyperterminal, like: uartsend('T');? \$\endgroup\$ – Bence Kaulics Aug 18 '15 at 13:26
  • 1
    \$\begingroup\$ Why do you have such a huge delay after each character is processed? (250*1275 = 318750 iterations of the inner loop) \$\endgroup\$ – Dave Tweed Aug 18 '15 at 16:50
  • 1
    \$\begingroup\$ Get each EUSART working by itself first. Connect PC to 2, test. Connect PC to 1, test. Connect GPS to 1, test. Blink an LED or something when data comes in. Then connect GPS to 2, test. Then connect PC to 1. Once sure both work as intended, be prepared for some tomfoolery in getting the PIC to "buffer" data bidirectionally. I ended up using interrupts for both EUSARTs, as polling and delays were much too slow. \$\endgroup\$ – rdtsc Aug 18 '15 at 17:11
  • \$\begingroup\$ uart1 working fine@bence \$\endgroup\$ – arun Aug 19 '15 at 13:10
1
\$\begingroup\$

When no antenna is connected externally then module it self falls back to internal antenna . As per your description , you are testing indoor which is not suitable environment for L80 . Please check this in open Sky condition .

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.