' {$STAMP BS2} ' {$PBASIC 2.5} 'Aug21Ground4.bs2 ' this si the fourth set of programs written TO be launched ON August 21 2016 ' this is the first of 2 programs which will used, this one will be on the Ground. ' The goal of this porgram is to have a forward data checking system. the idea is to have the balloon send the data twice, ' and on the ground check to make sure it went through the same way twice. ' also, there will be a portion of the program that will allow the operator on the ground to change the frequency of the gathering of data ' Temperature and GPS data will be gathered. '==== PreProgram stuff===================================================== 'Radio modem TXD PIN 10 ' RTX-12 pin 5 -- Transmit Data -- Takes the data from computer and turns it into a tran transmitable code RTS PIN 14 ' RTX-12 pin 6 -- Negative in/PTT -- Controls Transmit and Recieve modes of Modem; set to HIGH for transmit mode, set to LOW for recieve mode DSR PIN 15 ' RTX-12 pin 4 -- Carrier Detect -- Recognizes a carrier tone RXD PIN 9 ' RTX-12 pin 3 -- Recieve Data -- Takes recieved data and forms it to a code that can be read by a computer Baud CON 9005 ' 9005 is a 7-bit even parity true for a 1200 baud Callsign VAR Byte 'GPS latdeg1 VAR Byte latdeg2 VAR Byte latmin1 VAR Byte latmin2 VAR Byte latsec1 VAR Byte latsec2 VAR Byte longdeg1 VAR Byte longdeg2 VAR Byte longmin1 VAR Byte longmin2 VAR Byte longsec1 VAR Byte longsec2 VAR Byte x VAR Byte y VAR Byte z VAR Byte 'Temp Temp1 VAR Byte Temp2 VAR Byte '====Main Program============================================================= DO GOSUB Waiting_Carrier GOSUB Receive_Callsign GOSUB Waiting_Carrier GOSUB Receive_GPS GOSUB Waiting_Carrier GOSUB Recieve_Temp GOSUB Change_Frequency GOSUB Waiting_Carrier GOSUB Receive_Callsign LOOP '====SubRoutines=============================================================== Waiting_Carrier: LOW RTS DO DEBUG "Waiting carrier", CR, ? DSR, CR, CR LOOP UNTIL DSR = 1 RETURN Receive_Callsign: SERIN RXD, Baud, [STR Callsign\6] DEBUG STR Callsign\6, CR, CR RETURN Receive_GPS: SERIN RXD, Baud, [STR latdeg1\2] SERIN RXD, Baud, [STR latmin1\2] SERIN RXD, Baud, [STR latsec1\2] SERIN RXD, Baud, [STR longdeg1\3] SERIN RXD, Baud, [STR longmin1\2] SERIN RXD, Baud, [STR longsec1\2] SERIN RXD, Baud, [STR latdeg2\2] SERIN RXD, Baud, [STR latmin2\2] SERIN RXD, Baud, [STR latsec2\2] SERIN RXD, Baud, [STR longdeg2\3] SERIN RXD, Baud, [STR longmin2\2] SERIN RXD, Baud, [STR longsec2\2] x = latdeg1 y = latdeg2 GOSUB Check_GPS x = latmin1 y = latmin2 GOSUB Check_GPS x = latsec1 y = latsec2 GOSUB Check_GPS x = longdeg1 y = longdeg2 GOSUB Check_GPS x = longmin1 y = longmin2 GOSUB Check_GPS x = longsec1 y = longsec2 GOSUB Check_GPS DEBUG "Latitude", CR, "longitude", CR, CR DEBUG STR latdeg1\2, " ", STR latmin1\2, " ", STR latsec1\2, CR DEBUG STR longdeg1\2, " ", STR longmin1\2, " ", STR longsec1\2, CR, CR HIGH RTS PAUSE 2000 SEROUT TXD, Baud, [DEC 1] PAUSE 200 LOW RTS RETURN Check_GPS: SELECT x CASE y RETURN CASE <> y HIGH RTS PAUSE 2000 SEROUT TXD, Baud, [DEC 0] PAUSE 200 GOTO Receive_GPS ENDSELECT Recieve_Temp: SERIN RXD, Baud, [STR Temp1\2] SERIN RXD, Baud, [STR Temp2\2] GOSUB Check_Temp HIGH RTS PAUSE 2000 SEROUT TXD, Baud, [DEC 1] PAUSE 200 LOW RTS RETURN Check_Temp: SELECT Temp1 CASE Temp2 RETURN CASE <> Temp2 HIGH RTS PAUSE 2000 SEROUT TXD, Baud, [DEC 0] PAUSE 200 LOW RTS GOTO Recieve_Temp ENDSELECT Change_Frequency: DEBUG "Enter a number 01 to 12 to decide how many minutes", CR DEBUG "to wait for the next set of data collection: ", CR DEBUGIN DEC1 z SELECT z CASE >= 1, <= 12 DEBUG ? z, CR CASE > 1, < 12 DEBUG "Invalid number", CR GOTO Change_Frequency ENDSELECT HIGH RTS PAUSE 2000 SEROUT TXD, Baud, [DEC z] PAUSE 200 LOW RTS RETURN