mem VAR Byte char VAR Byte wrcount VAR Byte tx CON 0 rx CON 1 ow CON $9 wr CON $8 cl CON $0A sp CON $20 ret CON $0D init_baud CON 240 baud CON 500 GOSUB changebaud '****************[INITIALISE VDRIVE]************** SEROUT tx,baud,["ipa",ret] PAUSE 200 SEROUT tx,baud,["scs",ret] PAUSE 2000 '****************[MAIN LOOP]********************** '************************************************* main: GOSUB open GOSUB StoreGPSData GOSUB close GOTO main '************************************************* '****************[OPEN FILE]********************** open: SEROUT tx,baud,[ow,sp,"Edwin.txt",ret] SERIN rx,baud,[WAIT (">")] RETURN '****************[WRITE FILE]********************* StoreGPSData: FOR mem = 0 TO wrcount GET mem, char SEROUT tx,baud,[wr,sp,DEC 1,ret,char,ret] SERIN rx,baud,[WAIT (">")] NEXT RETURN '****************[CLOSE FILE]********************* close: SEROUT tx,baud,[cl,sp,"Edwin.txt",ret] SERIN rx,baud,[WAIT (">")] RETURN '****************[CHANGE BAUD]******************** changebaud: SEROUT tx,init_baud,["sbd ",$71,$02,$00,$0D] PAUSE 5000 RETURN