comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 287:5f2fe81fde9f

Don't force gas with depth>0 to be active.
author JeanDo
date Thu, 21 Apr 2011 04:16:00 +0200
parents 5351d47ee28a
children 4dbff2aa31ee
comparison
equal deleted inserted replaced
286:5351d47ee28a 287:5f2fe81fde9f
407 407
408 read_int_eeprom d'32' ; read gas_change_depth Gas5 408 read_int_eeprom d'32' ; read gas_change_depth Gas5
409 btfss sorted_gaslist_active,4 ; Apply depth? 409 btfss sorted_gaslist_active,4 ; Apply depth?
410 clrf EEDATA ; No, clear! 410 clrf EEDATA ; No, clear!
411 movff EEDATA,char_I_deco_gas_change+0 ; Yes! 411 movff EEDATA,char_I_deco_gas_change+0 ; Yes!
412
413
414 ; read_int_eeprom d'97' ; Read He ratio
415 ; movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register
416 ; read_int_eeprom d'96' ; Read O2 ratio
417 ; movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register
418 ; bsf STATUS,C ;
419 ; movlw d'100' ; 100%
420 ; subfwb wait_temp,W ; minus He
421 ; subfwb EEDATA,F ; minus O2
422 ; movff EEDATA, char_I_deco_N2_ratio+4; = N2!
423 ;
424 ; read_int_eeprom d'101' ; Read He ratio
425 ; movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register
426 ; read_int_eeprom d'100' ; Read O2 ratio
427 ; movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register
428 ; bsf STATUS,C ;
429 ; movlw d'100' ; 100%
430 ; subfwb wait_temp,W ; minus He
431 ; subfwb EEDATA,F ; minus O2
432 ; movff EEDATA, char_I_deco_N2_ratio+3; = N2!
433 ;
434 ; read_int_eeprom d'105' ; Read He ratio
435 ; movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register
436 ; read_int_eeprom d'104' ; Read O2 ratio
437 ; movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register
438 ; bsf STATUS,C ;
439 ; movlw d'100' ; 100%
440 ; subfwb wait_temp,W ; minus He
441 ; subfwb EEDATA,F ; minus O2
442 ; movff EEDATA, char_I_deco_N2_ratio+2; = N2!
443 ;
444 ; read_int_eeprom d'109' ; Read He ratio
445 ; movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register
446 ; read_int_eeprom d'108' ; Read O2 ratio
447 ; movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register
448 ; bsf STATUS,C ;
449 ; movlw d'100' ; 100%
450 ; subfwb wait_temp,W ; minus He
451 ; subfwb EEDATA,F ; minus O2
452 ; movff EEDATA, char_I_deco_N2_ratio+1; = N2!
453 ;
454 ; read_int_eeprom d'113' ; Read He ratio
455 ; movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register
456 ; read_int_eeprom d'112' ; Read O2 ratio
457 ; movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register
458 ; bsf STATUS,C ;
459 ; movlw d'100' ; 100%
460 ; subfwb wait_temp,W ; minus He
461 ; subfwb EEDATA,F ; minus O2
462 ; movff EEDATA, char_I_deco_N2_ratio+0; = N2!
463 ;
464 ; Now, set change depth. Inactive gases have depth=0!
465 ; read_int_eeprom d'118' ; read gas_change_depth Gas1
466 ; btfss sorted_gaslist_active,0 ; Apply depth?
467 ; clrf EEDATA ; No, clear!
468 ; movff EEDATA,char_I_deco_gas_change+4 ; Yes!
469 ;
470 ; read_int_eeprom d'119' ; read gas_change_depth Gas2
471 ; btfss sorted_gaslist_active,1 ; Apply depth?
472 ; clrf EEDATA ; No, clear!
473 ; movff EEDATA,char_I_deco_gas_change+3 ; Yes!
474 ;
475 ; read_int_eeprom d'120' ; read gas_change_depth Gas3
476 ; btfss sorted_gaslist_active,2 ; Apply depth?
477 ; clrf EEDATA ; No, clear!
478 ; movff EEDATA,char_I_deco_gas_change+2 ; Yes!
479 ;
480 ; read_int_eeprom d'121' ; read gas_change_depth Gas4
481 ; btfss sorted_gaslist_active,3 ; Apply depth?
482 ; clrf EEDATA ; No, clear!
483 ; movff EEDATA,char_I_deco_gas_change+1 ; Yes!
484 ;
485 ; read_int_eeprom d'122' ; read gas_change_depth Gas5
486 ; btfss sorted_gaslist_active,4 ; Apply depth?
487 ; clrf EEDATA ; No, clear!
488 ; movff EEDATA,char_I_deco_gas_change+0 ; Yes!
489 412
490 ; Debugger 413 ; Debugger
491 ; call enable_rs232 414 ; call enable_rs232
492 ; movff char_I_deco_He_ratio+4,TXREG 415 ; movff char_I_deco_He_ratio+4,TXREG
493 ; call rs232_wait_tx ; wait for UART 416 ; call rs232_wait_tx ; wait for UART
1020 movwf xB+0 943 movwf xB+0
1021 clrf xB+1 944 clrf xB+1
1022 call div16x16 ; compute depth in full m -> result in xC+0 945 call div16x16 ; compute depth in full m -> result in xC+0
1023 946
1024 check_gas_change1: ; check gas1 947 check_gas_change1: ; check gas1
1025 ; read_int_eeprom d'27' ; read flag register 948 btfss sorted_gaslist_active,0 ; check active flag
1026 movff sorted_gaslist_active,EEDATA ; Get flag register
1027 btfss EEDATA,0 ; check active flag
1028 bra check_gas_change2 ; skip inactive gases! 949 bra check_gas_change2 ; skip inactive gases!
1029 movlw d'1' 950 movlw d'1'
1030 cpfseq active_gas ; is this gas currently selected? 951 cpfseq active_gas ; is this gas currently selected?
1031 bra check_gas_change1x ; No... 952 bra check_gas_change1x ; No...
1032 bra check_gas_change2 ; Yes, skip depth check 953 bra check_gas_change2 ; Yes, skip depth check
1042 subwf EEDATA,W ; Change depth-3m 963 subwf EEDATA,W ; Change depth-3m
1043 cpfslt xC+0 ; current depth<Change depth-3m? 964 cpfslt xC+0 ; current depth<Change depth-3m?
1044 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 965 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1045 966
1046 check_gas_change2: ; check gas2 967 check_gas_change2: ; check gas2
1047 ; read_int_eeprom d'27' ; read flag register 968 btfss sorted_gaslist_active,1 ; check active flag
1048 movff sorted_gaslist_active,EEDATA ; Get flag register
1049 btfss EEDATA,1 ; check active flag
1050 bra check_gas_change3 ; skip inactive gases! 969 bra check_gas_change3 ; skip inactive gases!
1051 movlw d'2' 970 movlw d'2'
1052 cpfseq active_gas ; is this gas currently selected? 971 cpfseq active_gas ; is this gas currently selected?
1053 bra check_gas_change2x ; No... 972 bra check_gas_change2x ; No...
1054 bra check_gas_change3 ; Yes, skip depth check 973 bra check_gas_change3 ; Yes, skip depth check
1064 subwf EEDATA,W ; Change depth-3m 983 subwf EEDATA,W ; Change depth-3m
1065 cpfslt xC+0 ; current depth<Change depth-3m? 984 cpfslt xC+0 ; current depth<Change depth-3m?
1066 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 985 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1067 986
1068 check_gas_change3: ; check gas3 987 check_gas_change3: ; check gas3
1069 ; read_int_eeprom d'27' ; read flag register 988 btfss sorted_gaslist_active,2 ; check active flag
1070 movff sorted_gaslist_active,EEDATA ; Get flag register
1071 btfss EEDATA,2 ; check active flag
1072 bra check_gas_change4 ; skip inactive gases! 989 bra check_gas_change4 ; skip inactive gases!
1073 movlw d'3' 990 movlw d'3'
1074 cpfseq active_gas ; is this gas currently selected? 991 cpfseq active_gas ; is this gas currently selected?
1075 bra check_gas_change3x ; No... 992 bra check_gas_change3x ; No...
1076 bra check_gas_change4 ; Yes, skip depth check 993 bra check_gas_change4 ; Yes, skip depth check
1086 subwf EEDATA,W ; Change depth-3m 1003 subwf EEDATA,W ; Change depth-3m
1087 cpfslt xC+0 ; current depth<Change depth-3m? 1004 cpfslt xC+0 ; current depth<Change depth-3m?
1088 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 1005 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1089 1006
1090 check_gas_change4: ; check gas4 1007 check_gas_change4: ; check gas4
1091 ; read_int_eeprom d'27' ; read flag register 1008 btfss sorted_gaslist_active,3 ; check active flag
1092 movff sorted_gaslist_active,EEDATA ; Get flag register
1093 btfss EEDATA,3 ; check active flag
1094 bra check_gas_change5 ; skip inactive gases! 1009 bra check_gas_change5 ; skip inactive gases!
1095 movlw d'4' 1010 movlw d'4'
1096 cpfseq active_gas ; is this gas currently selected? 1011 cpfseq active_gas ; is this gas currently selected?
1097 bra check_gas_change4x ; No... 1012 bra check_gas_change4x ; No...
1098 bra check_gas_change5 ; Yes, skip depth check 1013 bra check_gas_change5 ; Yes, skip depth check
1108 subwf EEDATA,W ; Change depth-3m 1023 subwf EEDATA,W ; Change depth-3m
1109 cpfslt xC+0 ; current depth<Change depth-3m? 1024 cpfslt xC+0 ; current depth<Change depth-3m?
1110 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode 1025 bsf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
1111 1026
1112 check_gas_change5: ; check gas5 1027 check_gas_change5: ; check gas5
1113 ; read_int_eeprom d'27' ; read flag register 1028 btfss sorted_gaslist_active,4 ; check active flag
1114 movff sorted_gaslist_active,EEDATA ; Get flag register
1115 btfss EEDATA,4 ; check active flag
1116 bra check_gas_change6 ; skip inactive gases! 1029 bra check_gas_change6 ; skip inactive gases!
1117 movlw d'5' 1030 movlw d'5'
1118 cpfseq active_gas ; is this gas currently selected? 1031 cpfseq active_gas ; is this gas currently selected?
1119 bra check_gas_change5x ; No... 1032 bra check_gas_change5x ; No...
1120 bra check_gas_change6 ; Yes, skip depth check 1033 bra check_gas_change6 ; Yes, skip depth check
1857 1770
1858 ; Configure sorted_gaslist_active flag register 1771 ; Configure sorted_gaslist_active flag register
1859 read_int_eeprom d'27' 1772 read_int_eeprom d'27'
1860 movff EEDATA, sorted_gaslist_active 1773 movff EEDATA, sorted_gaslist_active
1861 return 1774 return
1862
1863
1864 ;
1865 ; clrf sorted_gaslist_active ; Clear all flags
1866 ; read_int_eeprom d'118' ; read gas_change_depth Gas1
1867 ; tstfsz EEDATA ; =0m?
1868 ; bsf sorted_gaslist_active,0 ; No, Set Flag for Gas1
1869 ;
1870 ; read_int_eeprom d'119' ; read gas_change_depth Gas2
1871 ; tstfsz EEDATA ; =0m?
1872 ; bsf sorted_gaslist_active,1 ; No, Set Flag for Gas2
1873 ;
1874 ; read_int_eeprom d'120' ; read gas_change_depth Gas3
1875 ; tstfsz EEDATA ; =0m?
1876 ; bsf sorted_gaslist_active,2 ; No, Set Flag for Gas3
1877 ;
1878 ; read_int_eeprom d'121' ; read gas_change_depth Gas4
1879 ; tstfsz EEDATA ; =0m?
1880 ; bsf sorted_gaslist_active,3 ; No, Set Flag for Gas4
1881 ;
1882 ; read_int_eeprom d'122' ; read gas_change_depth Gas5
1883 ; tstfsz EEDATA ; =0m?
1884 ; bsf sorted_gaslist_active,4 ; No, Set Flag for Gas5
1885 ; return
1886 ;