diff code_part1/OSTC_code_asm_part1/sleepmode.asm @ 713:8c293e76a517

no flicker when powering on
author heinrichsweikamp
date Thu, 16 May 2013 13:57:32 +0200
parents 39e02673db4c
children b7f7184d800d
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Fri May 10 14:34:42 2013 +0200
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Thu May 16 13:57:32 2013 +0200
@@ -194,13 +194,24 @@
 	return
 
 fatal_error_sleep:
-	WAITMS	d'250'
-	WAITMS	d'250'
+	bsf		no_sensor_int               ; Disable sensor interrupt
+	call	get_calibration_data    	; Get calibration data from pressure sensor
+	bcf		no_sensor_int               ; Enable sensor interrupt
 	WAITMS	d'250'
 	WAITMS	d'250'
 	call	get_battery_voltage			; get battery voltage
 	btfss	enter_error_sleep			; REALLY enter Fatal Error Routine?
 	return								; No!
+    SAFE_2BYTE_COPY amb_pressure, sub_b
+	movlw	LOW		d'15001'			; must be lower then 15001mbar
+	movwf	sub_a+0
+	movlw	HIGH	d'15001'
+	movwf	sub_a+1
+	call	subU16					;  sub_c = sub_a - sub_b
+	bcf		enter_error_sleep		; Clear flag
+	btfss	neg_flag				;
+	return                          ; No!
+    bsf		enter_error_sleep		; Set flag
 	clrf	INTCON
 	clrf	INTCON2
 	clrf	INTCON3