comparison code_part1/OSTC_code_asm_part1/altimeter.asm @ 162:fdebc43c8372

Fix altimeter auto-reset
author JeanDo
date Fri, 21 Jan 2011 01:48:40 +0100
parents 48f12271eb18
children 80de93d72a17
comparison
equal deleted inserted replaced
161:8d6aca08f66b 162:fdebc43c8372
27 ; Known bug: Simulator reset altitude and reference... 27 ; Known bug: Simulator reset altitude and reference...
28 28
29 altimeter_calc: 29 altimeter_calc:
30 movlb HIGH(pressureAvg) 30 movlb HIGH(pressureAvg)
31 31
32 movf pressureRef+0,W ; Already initialized ? 32 movlw HIGH(4*.1100) ; Is presure ref lower than 900mbar
33 iorwf pressureRef+1,W 33 cpfslt pressureRef+1
34 bnz altimeter_1 ; Yes... 34 bra altimeter_1 ; No: ok it is valid...
35 35
36 movlw HIGH(4*.1100) ; Is ref pressure bigger than 1100mbar ?
37 cpfsgt pressureRef+1
38 bra altimeter_1 ; No: ok it is valid...
39
40 altimeter_0:
36 movlw LOW(4*.1013+1) ; Init see level at 1013,25 mbar. 41 movlw LOW(4*.1013+1) ; Init see level at 1013,25 mbar.
37 movwf pressureRef+0 42 movwf pressureRef+0
38 movlw HIGH(4*.1013+1) 43 movlw HIGH(4*.1013+1)
39 movwf pressureRef+1 44 movwf pressureRef+1
40 45