Hi scalerobotics,

Thank you for your message.
After further reading on forums, I've changed my code as shown below. Now the code isn't stuck in the serin2 anymore but it displays "Timeout", which means I can't read the string sent by the GPS within 3s. According to the user manual, GPS is auto initialized at 4800 bauds and when done, it starts displaying strings, as $GPRMC. Even if I wait over 2 minutes, it still times out.
I've connected A0 to TTL TX pin (pin 3 on page 7 of the user manual).
Is SERIN2 able to read on any pin?
Are my pins settings right? (They are set to Digital I/O).
Why RS232 rather than TTL?
Should I choose True or Inverted should I choose Parity or none...?
I see various configurations on http://www.melabs.com/resources/pbpmanual/ser2modes.htm but I'm not sure how to use it.
I'm not using a MAX232 between the GPS and the PIC.


Code:
'based on: http://list.picbasic.com/forum/messages/6851/7091.html?1080565370

@ device  pic16F684, intrc_osc_noclkout, BOD_OFF, PWRT_OFF, wdt_off, mclr_off, protect_off

'quid freq horloge requise?


DEFINE OSC 8			'set OSC value to 8MHz for instructions PAUSE, PAUSEus and SOUND (instead of default 4MHz)

DEFINE LCD_DREG PORTC 'data port out is portC
DEFINE LCD_DBIT 0 'data on portC0-portC3

DEFINE LCD_RSREG PORTC 'r/s is on portC.4, with 10K WPU
DEFINE LCD_RSBIT 4

DEFINE LCD_EREG PORTC 'enable is on portC.5
DEFINE LCD_EBIT 5

DEFINE LCD_BITS 4 '4bits data bus
DEFINE LCD_LINES 2 '2lines display
DEFINE LCD_COMMANDUS 2000 '2ms cmd delay
DEFINE LCD_DATAUS 50 '50us data delay

INTCON = 0      'disable interrupts and clear int flags
OSCCON = %01110001	'int osc, hs, 8mhz
CMCON0 =  %00000111
ANSEL = %00000000
OPTION_REG = %11111111

'alias in SERIN2
GPSin VAR PORTA.0   'A0 has TTL levels

TRISA = %000001 			
TRISC = 0 

PORTA = %000001   'A0 is used for gps input, SERIN2 bitbanging (software eusart)
PORTC = 0

WPUA = 0 			
mystring var byte[65]
i var byte

'programming custom characters
LCDOUT  $FE,$40,$00,$0A,$0A,$00,$11,$0E,$00,$00  ' Cust Char #0: happy smiley  
LCDOUT  $FE,$48,$0E,$15,$1B,$19,$1B,$15,$0E,$00  ' Cust Char #1: copyright
LCDOUT  $FE,$50,$0E,$0E,$1F,$0E,$04,$00,$1F,$00  ' Cust Char #2: press  
LCDOUT  $FE,$58,$0A,$1F,$1F,$1F,$0E,$04,$00,$00  ' Cust Char #3: heart  
LCDOUT  $FE,$60,$03,$05,$19,$19,$19,$19,$05,$03  ' Cust Char #4: speaker  
LCDOUT  $FE,$68,$00,$00,$04,$0E,$0E,$0E,$0E,$00  ' Cust Char #5: bullet  
LCDOUT  $FE,$70,$1F,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #6: empty square  
LCDOUT  $FE,$78,$04,$0E,$1F,$0E,$0E,$00,$1F,$00  ' Cust Char #7: release

'blink led
for i = 0 to 10
    HIGH PORTA.1
    pause 300
    LOW PORTA.1
    PAUSE 300
NEXT i

  
'TEST block
'display a sample of the custom charas
  LCDOUT $fe,1,"new charas: "
  LCDOUT $fe,$c0,0,1,2,3,4,5,6,7
PAUSE 4000
'--------------------------------------------------------------------------------------------------------------------------------------------

LCDOUT $fe,1,"GPS display"
PAUSE 2000

gps:
LCDOUT $fe,1,"in GPS"
LCDOUT $fe,$c0,"Serin start"
PAUSE 2000 
mystring[0]=0    'init first byte of the string
serin2 portA.0,188,3000,toto,[WAIT("$GPRMC"),STR mystring\65\13]
If mystring[0]<>0 then 
    LCDOUT $fe,1,"Data avail."
    PAUSE 2000 
ELSE
    LCDOUT $fe,1,"No data"
    PAUSE 2000
eNDIF
goto gps

toto:
LCDOUT $fe,1,"timeout"
PAUSE 2000 
GOTO gps