Device = 18F2550
Xtal 4
Config_Start
PLLDIV = 1 ;No prescale (4 MHz oscillator input drives PLL directly)
CPUDIV = OSC4_PLL6 ;[Primary Oscillator Src: /1][96 MHz PLL Src: /2]
USBDIV = 1 ;USB clock source comes directly from the primary oscillator block with no postscale
FOSC = XT_XT ;HS oscillator (HS)
FCMEN = OFF ;Fail-Safe Clock Monitor disabled
IESO = OFF ;Oscillator Switchover mode disabled
PWRT = OFF ;PWRT disabled
BOR = OFF ;Brown-out Reset disabled in hardware and software
VREGEN = OFF ;USB voltage regulator disabled
WDT = OFF ;WDT disabled (control is placed on the SWDTEN bit)
PBADEN = OFF ;PORTB<4:0> pins are configured as digital I/O on Reset
LPT1OSC = OFF ;Timer1 configured for higher power operation
MCLRE = OFF ;RE3 input pin enabled; MCLR pin disabled
STVREN = OFF ;Stack full/underflow will not cause Reset
LVP = OFF ;Single-Supply ICSP disabled
XINST = OFF ;Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
Debug = OFF ;Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
Config_End
All_Digital = true
Declare Hserial_Baud = 9600
Declare Hserial_RCSTA = PORTC.7
Declare Hserial_TXSTA = PORTC.6
Declare Hserial_Clear = On
Declare LCD_Type = 0
Declare LCD_DTPin PORTB.0
Declare LCD_RSPin PORTB.4
Declare LCD_ENPin PORTB.5
Declare LCD_Lines 2
Declare LCD_Interface 4
TRISB = 0
'trisc = 1
Dim latitud As String *8
Dim longitud As String *9
Dim valido As String *1
Cls
DelayMS 100
inicio:
Cls
DelayMS 500
Print At 1,1," buscado"
Print At 2,1," satelite"
HSerIn [Wait( "$GPGGA" ),skip 37 ,Str valido]
If Val(valido,Dec)<>1 Then GoTo inicio
programa:
DelayMS 500
'Espera hasta Recibir $GPGGA lo que venga detras es guardado en las variables: latitud,longitud
HSerIn [Wait( "$GPGGA" ),skip 12 ,Str latitud,skip 3 ,Str longitud]
Print At 1,1,Str latitud," Latitud"
Print At 2,1,Str longitud," Longitud"
DelayMS 500
GoTo programa