comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 433:b0f3ab805879

apply salinity and 0.98bar/10m in internal logbook, show gf_lo/gf_hi on page three (Instead of gf_hi/gf_lo)
author heinrichsweikamp
date Thu, 04 Aug 2011 22:26:24 +0200
parents 04535df08575
children 9597829f1e0c
comparison
equal deleted inserted replaced
429:1da600c4e139 433:b0f3ab805879
372 iorwf last_temperature+1,W ; last_temperature:2 = Null? 372 iorwf last_temperature+1,W ; last_temperature:2 = Null?
373 bnz display_profile_offset4 ; No, continue 373 bnz display_profile_offset4 ; No, continue
374 incf last_temperature+1,F ; Yes, make last_temperature+1>1 to make "display_profile2e" working 374 incf last_temperature+1,F ; Yes, make last_temperature+1>1 to make "display_profile2e" working
375 375
376 display_profile_offset4: 376 display_profile_offset4:
377 ; Offset to Salinity
378 incf_eeprom_address d'33' ; Macro, that adds 8Bit to eeprom_address:2
379 call I2CREAD ; Read Salinity
380 movff SSPBUF,wait_temp ; Copy Salinity
381 decf_eeprom_address d'33' ; Macro, that subtracts 8Bit from eeprom_address:2
382
383 movff lo,xA+0
384 movff hi,xA+1
385 movlw d'102' ; 0,98bar/10m
386 movwf xB+0
387 clrf xB+1
388 call mult16x16 ;xA*xB=xC (lo:hi * 100)
389 movff wait_temp,xB+0 ; Salinity
390 clrf xB+1
391 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
392 movff xC+0,lo
393 movff xC+1,hi ; restore lo and hi with updated value
394
377 bsf leftbind 395 bsf leftbind
378 output_16dp d'3' ; max. depth 396 output_16dp d'3' ; max. depth
379 STRCAT "m " 397 STRCAT "m "
380 call I2CREAD2 ; divetime in minutes 398 call I2CREAD2 ; divetime in minutes
381 movff SSPBUF,lo 399 movff SSPBUF,lo
994 WIN_TOP .0 1012 WIN_TOP .0
995 WIN_LEFT .75 1013 WIN_LEFT .75
996 1014
997 movff SSPBUF,lo 1015 movff SSPBUF,lo
998 movlw d'3' 1016 movlw d'3'
999 cpfsgt lo 1017 cpfsgt lo ; GF model used for this dive?
1000 bra logbook_show_sat 1018 bra logbook_show_sat ; No
1001 1019
1002 ; Show GF settings 1020 ; Show GF settings
1003 call I2CREAD2 ; Read GF_lo 1021 call I2CREAD2 ; Read GF_lo
1022 movff SSPBUF,lo
1023 call I2CREAD2 ; Read GF_hi
1004 movff SSPBUF,hi 1024 movff SSPBUF,hi
1005 call I2CREAD2 ; Read GF_hi
1006 movff SSPBUF,lo
1007 STRCPY "GF:" 1025 STRCPY "GF:"
1026 output_8 ; GF_lo
1027 PUTC '/'
1028 movff hi,lo ; copy GF_hi
1008 output_8 ; GF_hi 1029 output_8 ; GF_hi
1009 PUTC '/'
1010 movff hi,lo ; copy GF_lo
1011 output_8 ; GF_lo
1012 call word_processor 1030 call word_processor
1013 bra logbook_deco_model ; Skip Sat 1031 bra logbook_deco_model ; Skip Sat
1014 1032
1015 logbook_show_sat: 1033 logbook_show_sat:
1016 call I2CREAD2 ; Read Saturation x 1034 call I2CREAD2 ; Read Saturation x
1358 PUTC ' ' 1376 PUTC ' '
1359 call I2CREAD3 ; Depth (Block read start) 1377 call I2CREAD3 ; Depth (Block read start)
1360 movff SSPBUF,lo 1378 movff SSPBUF,lo
1361 call I2CREAD4 ; Block read 1379 call I2CREAD4 ; Block read
1362 movff SSPBUF,hi 1380 movff SSPBUF,hi
1381
1382 ; Offset to Salinity
1383 incf_eeprom_address d'33' ; Macro, that adds 8Bit to eeprom_address:2
1384 call I2CREAD ; Read Salinity
1385 movff SSPBUF,wait_temp ; Copy Salinity
1386 decf_eeprom_address d'33' ; Macro, that subtracts 8Bit from eeprom_address:2
1387 movff lo,xA+0
1388 movff hi,xA+1
1389 movlw d'102' ; 0,98bar/10m
1390 movwf xB+0
1391 clrf xB+1
1392 call mult16x16 ;xA*xB=xC (lo:hi * 100)
1393 movff wait_temp,xB+0 ; Salinity
1394 clrf xB+1
1395 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
1396 movff xC+0,lo
1397 movff xC+1,hi ; restore lo and hi with updated value
1398
1363 bsf leftbind 1399 bsf leftbind
1364 bsf ignore_digit5 ; Do not display 1cm figure 1400 bsf ignore_digit5 ; Do not display 1cm figure
1365 output_16dp d'3' ; max. depth 1401 output_16dp d'3' ; max. depth
1366 STRCAT "m " 1402 STRCAT "m "
1367 call I2CREAD4 ; Block read 1403 call I2CREAD3 ; Block read start
1404 ; call I2CREAD4 ; Block read
1368 movff SSPBUF,lo ; read divetime in minutes 1405 movff SSPBUF,lo ; read divetime in minutes
1369 call I2CREAD4 ; Block read 1406 call I2CREAD4 ; Block read
1370 movff SSPBUF,hi ; read divetime in minutes 1407 movff SSPBUF,hi ; read divetime in minutes
1371 bsf leftbind 1408 bsf leftbind
1372 output_16 ; Divetime minutes 1409 output_16 ; Divetime minutes