changeset 434:1f1af9482d00

merge with 431
author heinrichsweikamp
date Thu, 04 Aug 2011 22:33:13 +0200
parents f36b93f2fbed
children 9597829f1e0c
files code_part1/OSTC_code_asm_part1/menu_logbook.asm
diffstat 1 files changed, 45 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Thu Aug 04 18:54:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Thu Aug 04 22:33:13 2011 +0200
@@ -390,6 +390,24 @@
 	incf		last_temperature+1,F		; Yes, make last_temperature+1>1 to make "display_profile2e" working
 
 display_profile_offset4:
+; Offset to Salinity
+	incf_eeprom_address	d'33'				; Macro, that adds 8Bit to eeprom_address:2
+	call		I2CREAD						; Read Salinity
+	movff		SSPBUF,wait_temp			; Copy Salinity
+	decf_eeprom_address	d'33'				; Macro, that subtracts 8Bit from eeprom_address:2
+
+	movff	lo,xA+0
+	movff	hi,xA+1
+	movlw	d'102'					; 0,98bar/10m
+	movwf	xB+0
+	clrf	xB+1
+	call	mult16x16				;xA*xB=xC (lo:hi * 100)
+	movff	wait_temp,xB+0			; Salinity
+	clrf	xB+1
+	call	div32x16  				; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi					; restore lo and hi with updated value
+
 	bsf			leftbind
 	output_16dp	d'3'					; max. depth
 	STRCAT      "m "
@@ -1012,19 +1030,20 @@
 
 	movff		SSPBUF,lo
 	movlw		d'3'
-	cpfsgt		lo
-	bra			logbook_show_sat
+	cpfsgt	lo						; GF model used for this dive?
+	bra		logbook_show_sat				; No
+
 	
 ; Show GF settings
 	call		I2CREAD2					; Read GF_lo
-	movff		SSPBUF,hi
+	movff		SSPBUF,lo
 	call		I2CREAD2					; Read GF_hi
-	movff		SSPBUF,lo
+	movff		SSPBUF,hi
 	STRCPY      "GF:"
-	output_8								; GF_hi
+	output_8								; GF_lo
 	PUTC		'/'
-	movff		hi,lo						; copy GF_lo
-	output_8								; GF_lo
+	movff		hi,lo						; copy GF_hi
+	output_8								; GF_hi
 	call		word_processor
 	bra			logbook_deco_model			; Skip Sat
 
@@ -1376,11 +1395,29 @@
 	movff		SSPBUF,lo
 	call		I2CREAD4					; Block read
 	movff		SSPBUF,hi
+
+; Offset to Salinity
+	incf_eeprom_address	d'33'				; Macro, that adds 8Bit to eeprom_address:2
+	call		I2CREAD						; Read Salinity
+	movff		SSPBUF,wait_temp			; Copy Salinity
+	decf_eeprom_address	d'33'				; Macro, that subtracts 8Bit from eeprom_address:2
+	movff	lo,xA+0
+	movff	hi,xA+1
+	movlw	d'102'					; 0,98bar/10m
+	movwf	xB+0
+	clrf	xB+1
+	call	mult16x16				;xA*xB=xC (lo:hi * 100)
+	movff	wait_temp,xB+0			; Salinity
+	clrf	xB+1
+	call	div32x16  				; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
+	movff	xC+0,lo
+	movff	xC+1,hi					; restore lo and hi with updated value
+
 	bsf			leftbind
 	bsf			ignore_digit5				; Do not display 1cm figure
 	output_16dp	d'3'						; max. depth
 	STRCAT      "m "
-	call		I2CREAD4					; Block read
+	call		I2CREAD3					; Block read start
 	movff		SSPBUF,lo					; read divetime in minutes
 	call		I2CREAD4					; Block read
 	movff		SSPBUF,hi					; read divetime in minutes