Free Flight Computer

Home

Introduction

Specification

Photographs

Screenshots

Hardware

Software

Utilities

Physics

HISTORY

2000
2001
2002
2003
2004

Traces

Links

25/02/02        Was the PIC; PIC16C76 works as intended!

                Tidied config screen.
                Added 10ms timer so key debounce not too fast!


27/02/02        Fixed timer display.
                Fixed temperature display.
                Switched in conv2int for pressure.
                Corrected MAXTAS - is a byte not a word!
                Combined UART and DATALINK flag into MMIFLAGS.5


28/02/02        Initialised S2F to zero.


01/03/02        Reset TEN_MS_TICK, and initialise to zero.
                Change MAXQFE to MAXALTITUDE
                Added MAXALTITUDE and MAXTAS update


05/03/02        Corrected bug introduced into LONG_DEBOUNCE.
                Corrected screen keypress handling (goes through correct set now)


07/03/02        Corrected vario calculation.
                Added vario averaging buffer.
                Initialised all vario variables.
                Added new PEAK_VARIO_TICK second countdown.
                Fixed lsb and missing 'm' for pressure
                Fixed display of : on timer
                Shuffled SND/TMR/DL right a space
                Shuffled TAS left a space
                Correct display of vario
                Fixed display of barograph rate
                Added peak and average vario code
                Intialise nShutdown according to MMIFLAGS on boot-up


08/03/02        Fixed infinite loop bug introduced in vario yesterday
                Wrote eeprom image download program


10/03/02        Fixed temperature display bug (had 26 and not d'26')
                Fixed big altitude display, R1R0 corruption!
                Fixed a bug found in the beep display, wrong bank
                Fixed incorrect bank usage when initial reads from eeprom
                Tweaks on display: TEMP renamed TMP, rate and max qfe shifted
                Added code to skip leading zeros on big alti and vario


11/03/02        Discovered that incf and decf don't affect carry flag!  Altered
                btfsc status,c instructions relying on this to btfsc status,z.
                Affected:
                        Vario rate
                        Altitude / pressure calculation
                        Signed number display
                        Eeprom read and write
                        UART interface
                Not bad eh?

                Corrected temperature use and now store as signed byte.  Was in
                fact 38 which was 0 degrees C, not 26 (which is the hex!).

12/03/02        Commented out service uart so works.  Suspect need to take maxim
                ic out of shutdown while interrupts disabled, clear them, then
                re-enable.

                Corrected big number skipping leading zero display.

                Fixed bug in digitise (didn't do ten thou correct, simple mistake)


13/03/02        Clear any rx errors before start interrupts going.

                Add pre-processing of received char to rx uart handler - throw
                away character if not 10, 13 or in the range 32 to 122 inclusive.

                Display just a large minus now for sign on big altitude and vario.

                Correct display_signed_number; corrupted R1R0 before saved it!

                Corrected display_vario.  Similar corruption and the cause of the
                rogue - signs being written across the screen!  Didn't move to
                position until after writin the sign.  Obvious in hindsight - vario
                is written after S2F!

                Corrected display of large altitude, leading zero stripping was
                incorrect.


14/03/02        Corrected position of vario display, now displays the sign!

                Disable rx interrupts when service uart, could cause errors or
                maybe even be the cause of crashing the code.

                _engtbl section wasn't in linker file; but _engtable was.  So
                probably wasn't in its own section or not in at all!  Probably
                why was crashing rather than interrupt possibility.  Sorted this.
                Also removed _mmijump as didn't seem to be used any more and
                needed extra bytes for rom_a.


15/03/02        Still resetting, found another reason - had initialised UART
                buffer in wrong bank.  Buffer also too long (16 in hex and not d'16').

                Both fixed, fingers crossed ...  WORKS!!!  And have comms again!


16/03/02        Worked on MMI, added all actions and processes; including
18/03/02        barograph stuff.
19/03/02
                Moved to 19200 baud as cannot get 9600 baud with 4MHz PIC.

                Store barograph pointer on eeprom when finish trace,
                restore on init.


20/03/02        Use of pagesel in mmi.asm causing problems (hence didn't work) so
                changed to setpage.  Which should of course have been using!

                Also updated uart.asm which had some explicit setpagse code which
                replaced with setpage.

                Returned to 2400 baud, 19200 doesn't seem to like 4MHz PICs!
                Didn't work with PIC16C73A either (earlier in the project).

                Corrected testing of valid keys on entry to do_mmi code.


25/03/02        Replaced all spacing with tabs (set to 8) to reduce file sizes
                and make all the same.

                Added explicit display update to FLAGS.  MMI code can now also
                use this to give more responsive screen updates.

                Added CURSORPOS and code so cursor displayed in correct
                position now, and doesn't move with screen update!


26/03/02        Tweaked cursor move code, now toggles between : and =
                Fixed couple of MMI bugs


27/03/02        Fixed display cursor (data not cmd!), put in correct positions
                Fixed display number so left flushes properly


31/03/02        Correct rd and wr routines so address correct.
                Coded fix for rapid-fire.


01/04/02        Were not sending device/upper address correct to eeprom.  Sorted
                this and tided up read/write routines.  Also added necessary 10ms
                routines to terminate_baro and so forth.

                Swapped dec2word byte order so returns R1R0 in line with rest of
                program.  Adjusted calling code as required.


02/04/02        Quick and easy fixes:
                        calc_hex broken above when half-moved to R8
                        rapid-fire of minus key
                        timer toggle

                Altered rd and wr commands so supply bytes rather than decimal dibits

                Added ADC (adc) (channel) command for internal and external ADCs.


03/04/02        Found and fixed memory stomp into Rx buffer.  Writing to R22
                at one place in math.asm was bank 0 instead of bank 1 because of a
                typo.  Instead of writing to 0xC7 wrote to 0x47 - rx buffer!

                Fixed bug in new adc command, didn't copy channel number to R2
                correctly.


04/04/02        Fixed bug in external adc read_word routine; ended up going to
                read_byte when waiting for interface to be ready.

                Fixed storing of MMIFLAGS - loaded from wrong bank, again!

                Altered temperature zero degrees point to that of LM335Z.  Existing
                TC02 sensor turned out to be 0 degrees at 0 volts and needed a
                negative rail.  The LM335Z device usefully has an offset of 2.73V.

                Rewrote key handler so neater and can now use "waiting for release"
                flag properly.


04/04/02b       Fixed small bugs introduced above!


06/04/02        Corrected storing of QFE_OFF and QNH_OFF bug.

                Altered write_eeprom_16 and write_eeprom_24 routines to write
                individual bytes rather than use page write method.  Do not know if
                will be on an eeprom 32 byte boundary!

                External adc read was one bit out, not that it will help much!


09/04/02        Renamed scheduler1b and scheduler1c - think MPASM only sees first
                10 digits but MPSIM sees more.  Hence sim OK but only does mmi update
                every 250ms.  Well, good theory anyway ... didn't work.

                Subsequent look suggests that is just loading as a consequence of
                something I've done.  Try regressing out routines sometime (02/04/02 ok)


24/04/02        Altered calibration of external adc more like datasheet to try to
                get working.  Also poll for nADCREADY before commence read from
                register.  Added a NOP between read clocks in case was pipeline problem.

                Added retries to eeprom read/write.  Left 10ms delays in for now.


02/05/02        Changed from HS mode to XT mode for 1/10th current consumption!

                Changed ADC update rate from 20Hz to 100Hz (FS from 00 to 10 for ADC).
                Expect 1.7lsb noise for Vref=2.5V, Vdd=5V, gain=128


03/07/02        Removed datalink and nShutdown
                Moved nADCCS to RC5
                Moved ADCDATA to RA5
                Made RA2 an analogue input for VARIO; also making RA5 analogue
                in the process unfortunately.  Need 10kohm input resistor on RA2 as
                need to make output (so stable digital state) when select RA5/RA2
                in digital mode.
                Altered external adc gain from 128 to 4.
                Moved PRS_C and PRS_M to bank 1
                Renamed to ALT_C and ALT_M; added ASI_C and ASI_M and modified code
                accordingly.


04/07/02        Rebuilt and relinked.


11/08/02        Corrected input/output direction of VARIO_ADC in external adc
                write_byte and read_word routines.  Had the incorrect sense.


12/08/02        Moved vario to start of measure routine for increased settling time
                Corrected bug where was -128 and not -d'128' in measure.asm
                Corrected vario peak detect

                Changed alt/asi update rate from 100Hz to 20Hz


28/08/02        Added 16 word adc averaging buffers

                Changed adc update rate back to 100Hz, actual output rate is thirs of this
                as need to read both channels and have filter settle.

                Change adc to unbuffered mode for lower current consumption; don't need as
                high an impedance now working from op-amp / potential divider outputs.  Need
                to verify this with oscilloscope, may need buffer on potential dividers
                setting -ve inputs for alt and asi.  Cheap tl082 do the job?


29/08/02        Now call measure every time external adc has an update.  Planned schedule
                of measure activity based on this tick.

                Next job to implement this in measure routine and modify altitude to read
                into and use adc averaging buffers.


09/09/02        Changed to RC oscillator so can use OSC2 for 1/4clk output to AD7705
                to overcome its noisy oscillator problem.

                Switched off oscillator (ie. MCLK OUT) on AD7705 as now supplying it
                with clock derived from PIC on MCLK IN.

                Returned to buffered mode for now; need to switch to unbuffered after
                everything else working.


11/09/02        Further work on modifying measure.asm routine.


12/09/02        Concluded measure.asm mods ready for compiling and simulate.
                Remapped object codes in ROM so fitted in.


13/09/02        Minor twiddle and simulate.
                Added decimal place precision to calibration.


14/09/02        Added cmd6 comment in uart.asm
                Fixed bug in average buffer (fell for the incf carry trap again!)
                Added now necessary wait for nADCREADY for adc command.
                Extended DUMP into banks 2 and 3.


16/09/02        BIG CHANGE to sort adc problems.  Result will be correct alt readings,
                asi impact pressure directly, and accurate temperature:

                Fixed read_ext_adc by adding wait-for-nDrdy; hopefully works again now!
                Fixed uart adc command
                Created gpio.inc to avoid equate duplication in files
                Removed magic numbers from writes to AD7705, replacing with equates
                Swapped calibration order so channel 0 left selected when exit
                Changed temperature sensor to be on channel 1 of external ADC
                (but not display code yet)
                Changed asipressure to work from internal adc (formerly used for temperature)
                Removed reads of asipressure from scheduler (wouldn't have worked as
                only one conversion can happen at a time, hence need for this big
                change).
                Changed ASI_M use, and removed ASI_C


17/09/02        Made scheduler frame 33 ticks rather than 32 ticks long.
                Added in temperature frame
                Made external adc unbuffered
                Added gain setting code and use by uart.asm and measure.asm


18/09/02        Finished coding for temperature frame
                Modified temperature display for new format


23/09/02        Added couple of missing bank selects in measure.asm following simulation.


25/09/02        Test latest software and hardware:
                        Clock is 1.008MHz x 4
                        Temperature now calibrated (works well!)
                        Unbuffered drain into ADC is 3ua
                Need to change scheduler and rate as does occur at full rate, just
                misses two outputs when change channels.


26/09/02        Modified hardware in effort to reduce noise:
                        Moved R29 +ve connection from pin3 alt to pin9
                        Moved R30 -ve connection from pin1 alt to pin10
                        Capacitor (10nf and 1uF) across pins 9 and 10
                        Moved sensor ground connection join to pin 16 of ad7705 (dgnd)
                        Moved R27 +ve to IC2.4 supply directly
                        Moved R28 -ve to IC2.11 gnd directly
                        Shielded AD7705 on top (copper tape)
                        47uF between pins 9 (+ve side) and 10 of IC3 improves things
                Still noisy but 47uF has biggest effect on vario.  Waggly though,
                need to improve final stage amplification I think.


27/09/02 am     Re-jiggled scheduler to 25Hz, reading temperature every tenth frame
                on ticks 13 to 18.  Altered ADC reads so just wrap round a 16 word
                buffer irrespective.

                Found reason why altitude wasn't being updated - it wasn't being
                called from the scheduler!

                Now subtract 127 from ASI reading in readiness for my cunning
                re-working of the vario circuit (need to nab an op-amp from the
                asi circuit leaving it a single-ended reading from differential
                output).

                Fixed UART-not-working bug (forgot a bcf status,irp)

                Updated default value for ASI muliplier.


27/09/02 pm     Fixed bug introduced above, didn't set update screen on temperature
                scheduler tick 13 (minor bug!).  Fixed bug in that didn't read and
                store pressure adc also, result was temperature reading incorrect as
                taking FSYNC resulted in it waiting for a read.  I think.

                Changed ADC gain to unity, as moving back to differential scheme.
                About to rework hardware for this and improved (hopefully) vario.  Can't
                get any worse!

                Update coeffients in download.bas and default ones in main.asm.
                Reprogrammed in eeprom.

                Removed single ended fudge for asi introduced above, above hardware
                change will leave us an op-amp to do diff to single conversion.

                Testing:  Temperature works again now, and pressure alters as
                          expected when muck about with coefficients.  Hardware next
                          then!  Still funny on power-on now which didn't used to
                          get.  OK if type RESET though.


29/09/02        Got modified hardware (from yesterday) working.  Altimeter works anyway!
                In theory vario should but isn't and need to look at with scope.

                Took reading for 1026mbar and (after altering some scaling in hardware)
                coded into software for default value of m.  Altered back to BUFFERED
                mode and made altimeter a gain of two (hence the hardware twiddle).

                Move to 19200 baud rate, noticed had completely wrong number for baud
                rate generator previously!



01/10/02        Vario seems to work!  Swapped round R and C of differentiator (so
                can also use as integrator for altitude now as well!) in attempt
                to reduce noise.

                Then noticed an incorrect connection hanging off pin 1 of IC2 (ie
                altitude output).  Noise disappeared but ADC now over-range as not
                so loaded any more!  Also unsnipped very long resistor leg which
                could have been causing problems.  Forgot to snip when soldering
                it in a while back now ;)

                Need to twiddle scaling again, fix watchdog-ing out on startup, and
                start investigating barograph.

                Yipee!


02/10/02        Ermm, was only working because had disconnected feedback resistor from
                pin 1.  Shows is amplifying genuine signal rather than noise though.

                Consequently I've altered the gains again.

                Moved clrwdt for measure routine in scheduler to before check.  Think
                is watchdog-ing out when changing adc channels (ie. when reading
                temperature for first time on startup after doing other stuff).

                Fixed display of QNE, had the endian of the word bytes wrong in lcd.asm.


03/10/02        Found bug in scheduler on startup (lacking a setpage)

                Merged in new barograph code.

                Returned to unbuffered

                Remapped where code is to allow for growth!


06/10/02        Tidied up scheduler

                Added and implemented use of separate update flags for QFE and QNH to
                allow for fast or rapid-fire setting of indicated height using keys.

                Changed timer 1 use of prescaler 1:1, slightly more accurate now as well.


08/10/02        Finished work on SEND.  Altered end of barograph enumeration to
                a 5-byte boundary; when reach here have "gone too far".


09/10/02        Debugged SEND.
                Now cease barograph storing when reach end of buffer.
                No longer write ffffffffff if at end of buffer and user ends timer.
                Added end of barograph variable to make life easier!


10/10/02        Added barograph entries remaining to screen 3 display.


18/10/02        Now initialise end of barograph variable!
                Recalculated ALT_M based on previous reading.
                Fixed bug in new SEND (did not copy to R0 before send_char).
                Changed send_char so takes wreg and not R0, thus saving many bytes
                of program space.


30/10/02        Corrected last digit of barograph remaining (had addwf instead of addlw)
                Added missing ,f to decfsz BARO_LEN in ee.asm
                Added missing ", " to SEND command output
                Fixed initialisation of barograph end pointer variable
                Added initialisation of BARO_P to download.bas
                Corrected mmi screen 3 so now stops barograph, resets pointer, and
                immediately writes to eeprom when change barograph in use.


2/11/02         Updated circuit diagram with latest vario circuit!

                Changed back to buffered mode as noise on sampling reads (2x1MHz/64)
                wreaking havoc with the differentiator.

                To get in buffer limit (Vdd-1.5V) altered gains ao 1050mbar is
                now 3.5V; and set Vref to be 3.5V instead of 5.00V.

                Rescaled temperature adc processing as now 5V/3.5V greater.  Don't
                have to alter pressure adc as 1050mbar is still maximum adc reading.

                Fixed bug noticed in measure.asm - hasn't been calibrating temperature
                adc for correct gain as forgot to use new equate instead of fixed GAIN_x.


3/11/02         Altered op-amp gains, yet again!  Forgot that although within ad7705
                buffered in headroom spec was outside of op-amp output capability!
                Can't go within 1.2V of rail so therefore altered back so 1050mbar is
                2.5V.  Vario circuit adjusted back accordingly.

                Kept yesterday's modifications otherwise the same except now reduce
                Vref from 3.5V to 2.5V.  Also take Ain2- (temperature) to this instead
                of ground to subtract 2.5V from the temperature output and bring
                within range of adc again.

                Modified temperature calculation in software accordingly.

                Fixed vario reading, was putting into 1s complement rather than 2s
                which display and everything else was expecting.  Hence eratic
                reading, not noise (completely) after all!

                Found bug - had missed off ,f from barograph pointer compare in ee.asm;
                so was altering it instead of doing its job.

                Found a bug in barograph, got rid of that and had bit of a tidy as
                well.

                Found *real* reason barograph wasn't storing.  It actually was,
                just lots of TAS for the first five frames!  Forgot that the
                default case was return and didn't bother checking if it was the
                tick for storing TAS.

                Altered CAL command to use most pressure adc buffer average.


6/11/02         Fixed temperature output in SEND bug (forgot to load it into R1R0!)

Back to top ...