changeset 703:39e02673db4c

some cleanup
author heinrichsweikamp
date Sun, 17 Mar 2013 13:33:17 +0100
parents e6ff73e88e45
children 422b9eeace4f
files code_part1/OSTC_code_asm_part1/adc_rtc.asm code_part1/OSTC_code_asm_part1/eeprom_rs232.asm code_part1/OSTC_code_asm_part1/interface.asm code_part1/OSTC_code_asm_part1/sleepmode.asm code_part1/OSTC_code_asm_part1/surfmode.asm code_part1/OSTC_code_asm_part1/temp_extrema.asm
diffstat 6 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -92,7 +92,7 @@
 get_battery_voltage4:
 	; check if the battery control memory needs to be initialised!
 	bcf		initialize_battery1		; clear check-flag
-	
+	clrf    EEADRH
 	read_int_eeprom d'40'			; get lowest battery voltage seen in mV
 	movff	EEDATA,sub_b+0
 	read_int_eeprom d'41'
@@ -103,7 +103,7 @@
 	movlw	HIGH	d'2000'
 	movwf	sub_a+1
 	call	subU16					;  sub_c = sub_a - sub_b
-	btfss	neg_flag				; neg_flag=1 if eeprom40:41 < 2000
+	btfsc	neg_flag				; neg_flag=1 if eeprom40:41 < 2000
 	bsf		initialize_battery1		; battery need to be initialised
 
 	movlw	LOW		d'4500'			; must be lower then 4500mV...
@@ -111,7 +111,7 @@
 	movlw	HIGH	d'4500'
 	movwf	sub_a+1
 	call	subU16					;  sub_c = sub_a - sub_b
-	btfsc	neg_flag				; neg_flag=1 if eeprom40:41 < 4500
+	btfss	neg_flag				; neg_flag=1 if eeprom40:41 < 4500
 	bsf		initialize_battery1		; battery need to be initialised
 	
 	btfss	initialize_battery1		; battery need to be initialised?
@@ -247,6 +247,7 @@
 
 reset_battery_stats:
 	bcf		uart_reset_battery_stats	; Clear flag
+    clrf    EEADRH
 	bcf		PIE1,RCIE					; no interrupt for UART
 	call	rs232_get_byte				; Get Byte
 	bcf		PIR1,RCIF					; clear flag
--- a/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/eeprom_rs232.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -43,7 +43,7 @@
 internal_eeprom_access_b2:				; accesses internal EEPROM BANK 2 via the UART
 	bcf		internal_eeprom_write3		; clear flag!
 	movlw	d'2'
-	movwf	EEADRH						;BANK1
+	movwf	EEADRH						;BANK2
 	movlw	"n"
 	bra		internal_eeprom_access1		; Continue with common routines
 
--- a/code_part1/OSTC_code_asm_part1/interface.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/interface.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -79,7 +79,7 @@
 send_int_eeprom_b2:
 	bcf			uart_send_int_eeprom3	; clear flag
 	movlw		d'2'
-	movwf		EEADRH					; Point to Bank1
+	movwf		EEADRH					; Point to Bank2
 	rcall		send_internal_eeprom1	; sends complete 2nd page of internal EEPROM
 	goto		surfloop_loop			; return to surface loop
 
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -186,6 +186,8 @@
 	nop
 	sleep								; Wait at least 35ms (every 16.5ms Timer1 wakeup)
 	call		get_pressure_value		; State2: Get pressure (51us)
+	clrf		temperature_avg+0
+	clrf		temperature_avg+1
 	clrf		amb_pressure_avg+0
 	clrf		amb_pressure_avg+1			; clear for sleep routine
 	call		calculate_compensation		; calculate temperature compensated pressure (233us)
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -310,6 +310,7 @@
 	btfsc	RCSTA,7						; RS232 already disabled
 	call	disable_rs232				; No, disable UART module
 
+    clrf    EEADRH
 	btfss	charge_done					; charge done?
 	bra		test_charger2				; No, add incomplete cycle!
 	
@@ -408,9 +409,9 @@
 	movff	EEDATA,temp2				; high byte
 	bcf		STATUS,C
 	movlw	d'1'
-	addwf	temp1
+	addwf	temp1,F
 	movlw	d'0'
-	addwfc	temp2				
+	addwfc	temp2,F
 	movff	temp1,EEDATA
 	write_int_eeprom	d'50'			; write byte stored in EEDATA
 	movff	temp2,EEDATA
@@ -427,6 +428,7 @@
 	WAITMS	d'100'
 	bsf		LED_red
 	bsf		charge_done					; Charge cycle finished
+    bsf		charge_started				; Charger started in CV mode
 	return
 
 show_cc_active:							; CC mode
--- a/code_part1/OSTC_code_asm_part1/temp_extrema.asm	Sat Mar 16 13:56:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/temp_extrema.asm	Sun Mar 17 13:33:17 2013 +0100
@@ -24,6 +24,7 @@
 ; ToDo:
 
 check_temp_extrema:			; called once every minute from Sleeploop, Surfloop and Diveloop
+    clrf    EEADRH
 	read_int_eeprom d'54'			; get lowest temperature so far
 	movff	EEDATA,sub_b+0
 	read_int_eeprom d'55'