Tengo un modulo GPS y no consigo que funcione.
Este es el programa que encontré en internete.
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 27/01/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device 18F452
XTAL = 10
Dim LATG[2] As Byte
Dim LATM[2] As Byte
Dim LATS[5] As Byte
Dim LONG[3] As Byte
Dim LONM[2] As Byte
Dim LONS[5] As Byte
Dim War[2] As Byte
Dim KNOTS[8] As Byte
Dim MINFRAC[4] As Byte
Dim MIWFRAC[4] As Byte
Dim SEGn As Byte
Dim SEGw As Byte
Dim i As Byte
TRISB = %00000000
HSERIAL_BAUD = 9600 ' Set baud rate to 9600
HSERIAL_RCSTA = %10010000 ' Enable serial port and continuous receive
HSERIAL_TXSTA = %00100000 ' Enable transmit and asynchronous mode
HSERIAL_CLEAR = On ' Optionally clear the
LAP:
HSerIn 5000,caer,[ Wait("$GPRMC"), skip 12, Str War\2, Str LATG\2, Str LATM\2, skip 1, Str MINFRAC\4, skip 3, Str LONG\3,_
Str LONM\2, skip 1, Str MIWFRAC\4, skip 3, Str KNOTS\8]
If War[0]= "A" Then
GoSub guardar
EndIf
GoSub recuperar
GoSub imprime
GoTo LAP
guardar:
For i = 0 To 1
EWrite i, [LATG[i]]
EWrite i+2, [LATM[i]]
EWrite i+4, [LONG[i]]
EWrite i+6, [LONM[i]]
Next
For i = 0 To 3
EWrite i+8, [MINFRAC[i]]
EWrite i+12, [MIWFRAC[i]]
Next
Return
recuperar:
For i = 0 To 1
LATG[i] = ERead i
LATM[i] = ERead i+2
LONG[i] = ERead i+4
LONM[i] = ERead i+6
Next
For i = 0 To 3
MINFRAC[i]=ERead i+8
MIWFRAC[i]=ERead i+12
Next
Return
imprime:
Cls
Print At 1,1, Str LATG\2,"g ",Str LATM\2,".",Str MINFRAC\4,"m_N"
Print At 2,1, Str LONG\3,"g ",Str LONM\2,".",Str MIWFRAC\4,"m_W"
DelayMS 1500
Cls
Print At 1,1, Str War, " estado", Str KNOTS
DelayMS 1500
Cls
Return
caer:
GoSub recuperar
GoSub imprime_ul
GoTo LAP
imprime_ul:
Cls
Print At 1,1, Str LATG\2,"g ",Str LATM\2,".",Str MINFRAC\4,"m_N"
Print At 2,1, Str LONG\3,"g ",Str LONM\2,".",Str MIWFRAC\4,"m_W"
DelayMS 1500
Cls
Print At 1,1, "Ultimo valor"
DelayMS 1500
Cls
Return
End
No se, si este es el programa correcto para este modulo.