comparison code_part1/OSTC_code_asm_part1/menu_logbook.asm @ 438:ec28f64bfeff

max depth in logbook had salinity applied already...
author heinrichsweikamp
date Tue, 09 Aug 2011 14:46:55 +0200
parents c54d32ec2133
children 6e57b5bb98ce
comparison
equal deleted inserted replaced
437:c54d32ec2133 438:ec28f64bfeff
388 iorwf last_temperature+1,W ; last_temperature:2 = Null? 388 iorwf last_temperature+1,W ; last_temperature:2 = Null?
389 bnz display_profile_offset4 ; No, continue 389 bnz display_profile_offset4 ; No, continue
390 incf last_temperature+1,F ; Yes, make last_temperature+1>1 to make "display_profile2e" working 390 incf last_temperature+1,F ; Yes, make last_temperature+1>1 to make "display_profile2e" working
391 391
392 display_profile_offset4: 392 display_profile_offset4:
393 ; Offset to Salinity
394 incf_eeprom_address d'33' ; Macro, that adds 8Bit to eeprom_address:2
395 call I2CREAD ; Read Salinity
396 movff SSPBUF,wait_temp ; Copy Salinity
397 decf_eeprom_address d'33' ; Macro, that subtracts 8Bit from eeprom_address:2
398
399 movff lo,xA+0
400 movff hi,xA+1
401 movlw d'102' ; 0,98bar/10m
402 movwf xB+0
403 clrf xB+1
404 call mult16x16 ;xA*xB=xC (lo:hi * 100)
405 movff wait_temp,xB+0 ; Salinity
406 clrf xB+1
407 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
408 movff xC+0,lo
409 movff xC+1,hi ; restore lo and hi with updated value
410
411 bsf leftbind 393 bsf leftbind
412 output_16dp d'3' ; max. depth 394 output_16dp d'3' ; max. depth
413 STRCAT "m " 395 STRCAT "m "
414 call I2CREAD2 ; divetime in minutes 396 call I2CREAD2 ; divetime in minutes
415 movff SSPBUF,lo 397 movff SSPBUF,lo
1402 call I2CREAD3 ; Depth (Block read start) 1384 call I2CREAD3 ; Depth (Block read start)
1403 movff SSPBUF,lo 1385 movff SSPBUF,lo
1404 call I2CREAD4 ; Block read 1386 call I2CREAD4 ; Block read
1405 movff SSPBUF,hi 1387 movff SSPBUF,hi
1406 1388
1407 ; Offset to Salinity
1408 incf_eeprom_address d'33' ; Macro, that adds 8Bit to eeprom_address:2
1409 call I2CREAD ; Read Salinity
1410 movff SSPBUF,wait_temp ; Copy Salinity
1411 decf_eeprom_address d'33' ; Macro, that subtracts 8Bit from eeprom_address:2
1412 movff lo,xA+0
1413 movff hi,xA+1
1414 movlw d'102' ; 0,98bar/10m
1415 movwf xB+0
1416 clrf xB+1
1417 call mult16x16 ;xA*xB=xC (lo:hi * 100)
1418 movff wait_temp,xB+0 ; Salinity
1419 clrf xB+1
1420 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
1421 movff xC+0,lo
1422 movff xC+1,hi ; restore lo and hi with updated value
1423
1424 bsf leftbind 1389 bsf leftbind
1425 bsf ignore_digit5 ; Do not display 1cm figure 1390 bsf ignore_digit5 ; Do not display 1cm figure
1426 output_16dp d'3' ; max. depth 1391 output_16dp d'3' ; max. depth
1427 STRCAT "m " 1392 STRCAT "m "
1428 call I2CREAD3 ; Block read start 1393 call I2CREAD4 ; Block read
1429 movff SSPBUF,lo ; read divetime in minutes 1394 movff SSPBUF,lo ; read divetime in minutes
1430 call I2CREAD4 ; Block read 1395 call I2CREAD4 ; Block read
1431 movff SSPBUF,hi ; read divetime in minutes 1396 movff SSPBUF,hi ; read divetime in minutes
1432 bsf leftbind 1397 bsf leftbind
1433 output_16 ; Divetime minutes 1398 output_16 ; Divetime minutes