#Picaxe 20X2
#Terminal 9600
#No_Table
#No_Data
initialise:
sertxd( "Initialising", cr, lf )
; Switch to 4800 baud
serout C.0, T9600 ,( $B5, $62, $06, $00, $14, $00, $01, $00, $00, $00, $D0, $08, $00, $00, $C0, $12, $00, $00, $07, $00, $03, $00, $00, $00, $00, $00, $CF, $E4 )
sertxd("Baud rate changed to 4800",13,10)
; Disable GPGGA
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $00, $00, $00, $00, $00, $00, $01, $00, $24 )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPGGA disabled", cr, lf )
; Disable GPGLL
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $01, $00, $00, $00, $00, $00, $01, $01, $2B )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPGLL disabled", cr, lf )
; Disable GPGSA
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $02, $00, $00, $00, $00, $00, $01, $02, $32 )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPGSA disabled", cr, lf )
; Disable GPGSV
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $03, $00, $00, $00, $00, $00, $01, $03, $39 )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPGSV disabled", cr, lf )
; Disable GPRMC
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $04, $00, $00, $00, $00, $00, $01, $04, $40 )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPRMC disabled", cr, lf )
; Disable GPVTG
serout C.0, T4800, ( $B5, $62, $06, $01, $08, $00, $F0, $05, $00, $00, $00, $00, $00, $01, $05, $47 )
serin [200,initialise], B.6, T4800, ( $B5, $62, $05, $01, $02, $00, $06, $01, $0F, $38 )
sertxd( "GPVTG disabled", cr, lf )
sertxd( cr, lf, "Polling", cr, lf)
mainloop:
Pause 10000
SerTxd( "Polling GLL", cr, lf )
SerOut C.0, T4800, ( "$IEGPQ,GLL*21", cr, lf )
serin [2000,mainloop], B.6, T4800, ( "$GPGLL," ), #w1,#w2,w3, #w4,#w5,w6, w7,w8,w9,w10,w11,w12,w13, #w14,w15
if w15 <> "A" then
sertxd( "no lock", cr, lf )
goto mainloop
end if
; Print 4916 45114 N
sertxd( #w1, " ", #w2, " ", w3, 9 )
; Print 12311 12437 W
sertxd( #w4, " ", #w5, " ", w6, 9 )
; Print 22:54:44
sertxd( w8, w9, ":", w10, w11, ":", w12, w13, cr, lf )
goto mainloop