Parallax GPS is freezing up
Draetoxtheloon
Posts: 33
Hi, I have a circuit containing a Parallax 28146 GPS serial module. I'm able to use the GPS in SMART mode and so I have created 3 buttons on my circuit. If Button1 is pressed then the LCD will display "# of Satellites = " followed by the actual number of satellites. Button2 shows the Lat/Long, and Button3 shows the Time of the Day.
The problem is kind of tough to troubleshoot (at least for me anyway), since I have three buttons when one is pressed it displays the corresponding data, then when a separate button is pressed the LCD is cleared and the proper information is displayed. The problem is every once in a while when I press the buttons there is no data showing on the LCD, as if something is "tied up" and is stuck in a loop or something.
Does anyone know what might be causing this??
I'm adding the code below which is in the majority of the functions:
The problem is kind of tough to troubleshoot (at least for me anyway), since I have three buttons when one is pressed it displays the corresponding data, then when a separate button is pressed the LCD is cleared and the proper information is displayed. The problem is every once in a while when I press the buttons there is no data showing on the LCD, as if something is "tied up" and is stuck in a loop or something.
Does anyone know what might be causing this??
I'm adding the code below which is in the majority of the functions:
#define gpsPin1 PORTCbits.RC0 #define gpsTris1 TRISCbits.TRISC0 #define gpsPin2 PORTCbits.RC1 #define gpsTris2 TRISCbits.TRISC1 #define gpsPin3 PORTCbits.RC2 #define gpsTris3 TRISCbits.TRISC2 ANSELCbits.ANSC2 = 0; gpsTris1 = 1; gpsTris2 = 1; gpsTris3 = 1;
while(1) { if (gpsPin1 == 1) { Delay1KTCYx(10); gps = 1; } else if (gpsPin2 == 1) { Delay1KTCYx(10); gps = 2; } else if (gpsPin3 == 1) { Delay1KTCYx(10); gps = 3; } else { gps = 0; } switch(gps) { case 1: getSats(); gps = 0; break; case 2: getLat(); getLong(); gps = 0; break; case 3: getTime(); gps = 0; break; } }
while (receivecounter < 1) { if (PIR3bits.RC2IF) //If USART RX buffer is full { if ((RCSTA2bits.FERR) || (RCSTA2bits.OERR)) //If there is a framing error or overrun { receivecounter = 6; temp2 = RCREG2; // reading RCREG clears RCIF and FERR if(RCSTA2bits.OERR==1) { RCSTA2bits.CREN=0; // OERRR is reset by clearing CREN RCSTA2bits.CREN=1; // re-enable continuous receive } } else { receivecounter++; temp2 = RCREG2; } } } //----------The following code is for Satellites------// putrsXLCD("# of Sats = "); Delay1KTCYx(100); sprintf(idata, "%d", temp2); //print # of Sats putsXLCD(idata);
Comments