diff code_part1/OSTC_code_asm_part1/adc_rtc.asm @ 297:ceedf078b2d8

Gas Setup page 2 reworked, Texts 107, 108, 109,150, 149, 168, 42, 43, 53,54,55, 165 need update in french, spanish and german
author Heinrichsweikamp
date Fri, 29 Apr 2011 20:17:32 +0200
parents 1efd59d689f8
children 2144f19fa1eb
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Thu Apr 28 18:51:48 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Fri Apr 29 20:17:32 2011 +0200
@@ -120,7 +120,8 @@
 
 	btfss	initialize_battery2		; battery need to be initialised?
 	bra		get_battery_no_init		; No, we have already valid values, just check for new extremas
-	
+
+get_battery_voltage_reset:	
 	; Init EEPROM for battery control
 	; Reset lowest battery seen
 	movlw	LOW			d'4200'		; reset to 4.2V
@@ -232,11 +233,40 @@
 	movwf	mins
 	movlw	.12
 	movwf	hours
-	movlw	.10
+	movlw	.5
 	movwf	day
-	movlw	.4
+	movlw	.5
 	movwf	month
 	movlw	.11
 	movwf	year
 	bsf		PIE1, TMR1IE
-	return
\ No newline at end of file
+	return
+
+reset_battery_stats:
+	bcf		uart_reset_battery_stats	; Clear flag
+	bcf		PIE1,RCIE					; no interrupt for UART
+	call	rs232_get_byte				; Get Byte
+	bcf		PIR1,RCIF					; clear flag
+
+	btfsc	rs232_recieve_overflow		; Byte received?
+	bra		reset_battery_stats_exit	; No, exit
+	movlw	'f'	
+	cpfseq	RCREG						; Really reset statistics?
+	bra		reset_battery_stats_exit	; No, exit
+	call	rs232_get_byte					; Get byte
+	bcf		PIR1,RCIF					; clear flag
+
+	btfsc	rs232_recieve_overflow		; Byte received?
+	bra		reset_battery_stats_exit	; No, exit
+	movlw	'f'
+	cpfseq	RCREG						; Really reset statistics?
+	bra		reset_battery_stats_exit	; No, exit
+; Yes, Reset now.
+	rcall	get_battery_voltage_reset	; Reset Statistics
+	movlw	'f'
+	movwf	TXREG
+	call	rs232_wait_tx				; Wait for uart
+
+reset_battery_stats_exit:
+	bsf		PIE1,RCIE					; re-enable interrupt for UART
+	goto	surfloop_loop				; return to surface loop
\ No newline at end of file