Stage Separation
Previously, digital input IN 6 of the sensor port was
connected to a switch that triggered a recording run when
the rocket left the launch rail. An alternative method of
triggering is now used that frees this input for other tasks (e.g.,
detecting booster-stage separation). The trigger subroutine
now monitors vertical acceleration and initiates recording
when a pre-defined threshold is exceeded twice within a
specified period of time. Although it is no longer possible
setfreq m8
'Set internal clock to 8MHz
symbol memmin = 0
symbol memmax = 32766
symbol memaddress = W6
symbol liftoff = 160
symbol redled = 2
symbol download = 3
symbol booster = pin6
symbol cable = pin7
symbol power = 0
'Start address
'End address
'Memory counter (word)
'Set trigger level at 2G
'Define constants.....
high power
pause 4000
'Hold power on
'Wait for power to settle
playback:
pause 2000
serout download, T4800, (CR,CR,CR,"CLEARDATA",CR)
pause 2000
serout download, T4800,
("LABEL,",",",",","Acc,Apo,Sun,Evt",CR)
pause 2000
serout download, T4800,
'Always download data on power-up
'Setup SelmaDAQ export to MS Excel
("2 Stage Rocket Instrumentation V.6",CR)
i2cslave %10100000, i2cfast, i2cword
'Configure master 12c port
for memaddress = memmin to memmax step 6 'Generate memory address in steps of 6
readi2c memaddress, (b0,b1,b2,b3,b4,b5) 'Read data from six FRAM addresses
serout download, T4800,("DATA,",",",",",#w0,",",#w1,",",#b4,",",#b5,CR) 'Send data in SelmaDAQ compatible format
next memaddress 'Next three addresses
if cable = 0 then trigger
low power
'Start trigger routine if cable disconnected,
'else, power down
trigger:
readadc 0,b0
low redled
pause 100
high redled
readadc 0,b1
pause 100
if b0> liftoff AND b1> liftoff then record
goto trigger
record:
i2cslave %10100000, i2cfast, i2cword
for memaddress = memmin to memmax step 6
b5 = pins AND %11000000
readadc10 0, w0
readadc10 2, w1
readadc 1,b4
writei2c memaddress, (b0,b1,b2,b3,b4,b5)
pause rate
next memaddress
power low
'Acceleration monitoring loop
'Measure acceleration
'Red LED on
'Red LED off
'Monitor acceleration again after delay
'If acceleration exceeds trigger level twice within loop
'time, start recording
'Configure master 12c port
'Generate memory addresses in steps of 6
'Read input bit 6 & input bit 7
'10-bit acceleration reading
'10-bit pressure reading
'8-bit light level reading
'Write six bytes of data to FRAM
'Set scan rate
'Next three addresses
'Powerdown
■ FIGURE 3.
Revised
(10-bit ADC)
PICAXE-18X
program for
flight recorder.
January 2009 37