' Flight6.bs2 ' by John Nordlie, October 8, 1999 ' This program is the flight sequencer and id transmitter for ' the High Altitude Research Group balloon gondola #3 ' ** set up variables ** x var byte z var byte i var byte pics var byte t1 var word t2 var word master var word ' ** set output ports ** output 0 ' pin 0 is the vertical 35mm camera servo output 1 ' pin 1 keys the transmitter output 2 ' pin 2 is the audio output to the transmitter output 3 ' pin 3 is the audio output to the speaker input 4 ' pin 4 is connected to thermistor #1 input 5 ' pin 5 is connected to thermistor #2 output 6 ' pin 6 is the horizontal 35mm camera servo output 7 ' pin 7 is the cutdown relay ' ** initialize variables ** z = 1 ' set 35mm camera countdown pics = 36 ' set number of 35mm pics remaining master = 60 ' set mission master clock to 2 hours to cutdown low 7 ' set cutdown relay low, just in case! ' ** park servos for i=1 to 50 ' move the servo to the shutter up position pulsout 0,550 pause 20 next for i=1 to 50 ' move the servo to the shutter up position pulsout 6,200 pause 20 next gosub beep ' beep speaker to let us know the computer is awake ' ** start of main program ** start: gosub track ' transmit 30 second tracking signal pause 1000 ' wait for APRS packet gosub id ' transmit id pause 1000 ' wait for APRS packet for x=1 to 35 ' beep the speaker 35 times gosub beep next if z=0 then takepic ' if its time, take a picture ret3: z = z - 1 ' decrement camera loop count master = master - 1 ' decrement master mission clock if master=0 then cutdown ' if its time, cut the balloon free ret4: goto start ' do it all again ' ** main program ends, procedures start here ** ' ** procedure takepic causes the 35mm camera to take a picture ** takepic: if pics=0 then skippic ' if no more film left, skip the pic for i=1 to 50 ' move the servos to the shutter down position pulsout 0,140 pause 20 next for i=1 to 50 pulsout 6,500 pause 20 next for i=1 to 50 ' move the servos to the shutter up position pulsout 0,550 pause 20 next for i=1 to 50 pulsout 6,200 pause 20 next pics=pics - 1 ' decrement number of photos left skippic: z = 1 ' reset counter to 1 loops goto ret3 ' ** procedure beep causes the on-board speaker to play some notes ** beep: freqout 3,500,1000 freqout 3,500,2000 freqout 3,500,3000 freqout 3,500,2000 freqout 3,500,1000 return ' ** procedure track transmits a 30 second audio tone for tracking purposes. track: high 1 ' key transmitter pause 500 ' wait for squelch to open freqout 2, 30000, 1250 ' output 30 sec tone for tracking pause 1000 low 1 ' release transmitter key return ' ** procedure id transmits the callsign KC0CRU ** id: high 1 ' key transmitter pause 500 ' wait for squelch on receivers to open freqout 2,900,1000 ' transmit K in morse code pause 200 freqout 2,300,1000 pause 200 freqout 2,900,1000 pause 600 freqout 2,900,1000 ' transmit C pause 200 freqout 2,300,1000 pause 200 freqout 2,900,1000 pause 200 freqout 2,300,1000 pause 600 for i=1 to 5 ' transmit 0 freqout 2,900,1000 pause 200 next pause 600 freqout 2,900,1000 ' transmit C pause 200 freqout 2,300,1000 pause 200 freqout 2,900,1000 pause 200 freqout 2,300,1000 pause 600 freqout 2,300,1000 ' transmit R pause 200 freqout 2,900,1000 pause 200 freqout 2,300,1000 pause 600 freqout 2,300,1000 ' transmit U pause 200 freqout 2,300,1000 pause 200 freqout 2,900,1000 pause 200 pause 1000 low 1 ' release radio key return ' ** procedure cutdown fires the relay which triggers the cut-down mechanism cutdown: high 7 ' bring cutdown relay high pause 5000 ' wait five seconds low 7 ' bring cutdown relay low master = 2000 ' reset master mission clock to something absurd (66 hours) goto ret4