comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 398:ab962c4b19d6

Fixing issue 50, correct "Bar" to "bar" in texts and comments
author heinrichsweikamp
date Sun, 26 Jun 2011 12:24:54 +0200
parents deced1cacff7
children cd48cdb6e1ae
comparison
equal deleted inserted replaced
396:0386c7e1374a 398:ab962c4b19d6
88 call divemode_apnoe_tasks ; 1 sec. Apnoe tasks 88 call divemode_apnoe_tasks ; 1 sec. Apnoe tasks
89 bra diveloop_loop1x ; Common Tasks 89 bra diveloop_loop1x ; Common Tasks
90 90
91 ; Tasks only for ppO2 mode 91 ; Tasks only for ppO2 mode
92 diveloop_loop1c: 92 diveloop_loop1c:
93 call PLED_const_ppO2_value ; display const ppO2 setting in [Bar] 93 call PLED_const_ppO2_value ; display const ppO2 setting in [bar]
94 call calc_deko_divemode ; calculate decompression and display result (any two seconds) 94 call calc_deko_divemode ; calculate decompression and display result (any two seconds)
95 btfsc is_bailout ; Are we in Bailout mode? 95 btfsc is_bailout ; Are we in Bailout mode?
96 call check_ppO2_bail ; Yes, display ppO2 (If required) 96 call check_ppO2_bail ; Yes, display ppO2 (If required)
97 97
98 bra diveloop_loop1x ; Common Tasks 98 bra diveloop_loop1x ; Common Tasks
116 116
117 diveloop_loop1z 117 diveloop_loop1z
118 bcf update_divetime ; clear flag 118 bcf update_divetime ; clear flag
119 119
120 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode 120 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode
121 call PLED_const_ppO2_value ; display const ppO2 setting in [Bar] 121 call PLED_const_ppO2_value ; display const ppO2 setting in [bar]
122 btfsc ppO2_show_value ; show ppO2? 122 btfsc ppO2_show_value ; show ppO2?
123 call check_ppO2 ; check ppO2 and displays warning if required 123 call check_ppO2 ; check ppO2 and displays warning if required
124 124
125 call timeout_divemode ; dive finished? This routine sets the required flags 125 call timeout_divemode ; dive finished? This routine sets the required flags
126 btfsc low_battery_state ; If battery is low, then... 126 btfsc low_battery_state ; If battery is low, then...
413 ; call rs232_wait_tx ; wait for UART 413 ; call rs232_wait_tx ; wait for UART
414 414
415 return 415 return
416 416
417 ;----------------------------------------------------------------------------- 417 ;-----------------------------------------------------------------------------
418 ; calculate ppO2 in 0.01Bar (e.g. 150 = 1.50 Bar ppO2) 418 ; calculate ppO2 in 0.01bar (e.g. 150 = 1.50 bar ppO2)
419 set_actual_ppo2: 419 set_actual_ppo2:
420 SAFE_2BYTE_COPY amb_pressure, xA ; P_amb in milibar (1000 = 1.000 bar). 420 SAFE_2BYTE_COPY amb_pressure, xA ; P_amb in milibar (1000 = 1.000 bar).
421 movlw d'10' 421 movlw d'10'
422 movwf xB+0 422 movwf xB+0
423 clrf xB+1 423 clrf xB+1
741 ostc_debug 'D' ; Sends debug-information to screen if debugmode active 741 ostc_debug 'D' ; Sends debug-information to screen if debugmode active
742 742
743 ; SetPoint change appended to information due to compatibility reasons 743 ; SetPoint change appended to information due to compatibility reasons
744 btfss setpoint_changed ; Check flag 744 btfss setpoint_changed ; Check flag
745 bra store_dive_data5 745 bra store_dive_data5
746 movff char_I_const_ppO2,WREG ; SetPoint in cBar 746 movff char_I_const_ppO2,WREG ; SetPoint in cbar
747 call write_external_eeprom 747 call write_external_eeprom
748 bcf setpoint_changed ; Clear this event 748 bcf setpoint_changed ; Clear this event
749 749
750 store_dive_data5: 750 store_dive_data5:
751 bcf event_occured ; Clear the global event flag 751 bcf event_occured ; Clear the global event flag
836 movff sub_c+0,xA+0 836 movff sub_c+0,xA+0
837 movff sub_c+1,xA+1 837 movff sub_c+1,xA+1
838 movlw d'39' ;77 when called every second.... 838 movlw d'39' ;77 when called every second....
839 movwf xB+0 839 movwf xB+0
840 clrf xB+1 840 clrf xB+1
841 call mult16x16 ; differential pressure in mBar*77... 841 call mult16x16 ; differential pressure in mbar*77...
842 movff xC+0,divA+0 842 movff xC+0,divA+0
843 movff xC+1,divA+1 843 movff xC+1,divA+1
844 movlw d'7' 844 movlw d'7'
845 movwf divB 845 movwf divB
846 call div16 ; devided by 2^7 equals velocity in m/min 846 call div16 ; devided by 2^7 equals velocity in m/min
886 movff char_I_O2_ratio,xB+0 886 movff char_I_O2_ratio,xB+0
887 clrf xB+1 887 clrf xB+1
888 call mult16x16 ; char_I_O2_ratio * p_amb/10 888 call mult16x16 ; char_I_O2_ratio * p_amb/10
889 889
890 ; Check very high ppO2 manually 890 ; Check very high ppO2 manually
891 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar? 891 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
892 bra check_ppO2_bail2 ; Yes, display Value! 892 bra check_ppO2_bail2 ; Yes, display Value!
893 893
894 ; Check if ppO2 should be displayed 894 ; Check if ppO2 should be displayed
895 movff xC+0,sub_b+0 895 movff xC+0,sub_b+0
896 movff xC+1,sub_b+1 896 movff xC+1,sub_b+1
1179 btfss FLAG_apnoe_mode ; Store apnoe max or normal max (Which is only max from the last descent) 1179 btfss FLAG_apnoe_mode ; Store apnoe max or normal max (Which is only max from the last descent)
1180 bra end_dive1 ; Store normal depth 1180 bra end_dive1 ; Store normal depth
1181 1181
1182 movff apnoe_max_pressure+0,lo 1182 movff apnoe_max_pressure+0,lo
1183 movff apnoe_max_pressure+1,hi 1183 movff apnoe_max_pressure+1,hi
1184 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1184 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1185 movff lo,apnoe_max_pressure+0 1185 movff lo,apnoe_max_pressure+0
1186 movff hi,apnoe_max_pressure+1 1186 movff hi,apnoe_max_pressure+1
1187 1187
1188 movf apnoe_max_pressure+0,W ; Max. depth 1188 movf apnoe_max_pressure+0,W ; Max. depth
1189 call write_external_eeprom 1189 call write_external_eeprom
1192 bra end_dive2 ; skip 1192 bra end_dive2 ; skip
1193 1193
1194 end_dive1: 1194 end_dive1:
1195 movff max_pressure+0,lo 1195 movff max_pressure+0,lo
1196 movff max_pressure+1,hi 1196 movff max_pressure+1,hi
1197 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] 1197 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1198 movff lo,max_pressure+0 1198 movff lo,max_pressure+0
1199 movff hi,max_pressure+1 1199 movff hi,max_pressure+1
1200 1200
1201 movf max_pressure+0,W ; Max. depth 1201 movf max_pressure+0,W ; Max. depth
1202 call write_external_eeprom 1202 call write_external_eeprom
1572 btfss realdive ; dive longer then one minute? 1572 btfss realdive ; dive longer then one minute?
1573 bcf divemode ; no -> this was no real dive 1573 bcf divemode ; no -> this was no real dive
1574 return 1574 return
1575 1575
1576 set_dive_modes3: 1576 set_dive_modes3:
1577 movlw HIGH d'1075' ; hard-wired 1075mBar threshold 1577 movlw HIGH d'1075' ; hard-wired 1075mbar threshold
1578 movwf sub_a+1 1578 movwf sub_a+1
1579 movlw LOW d'1075' ; hard-wired 1075mBar threshold 1579 movlw LOW d'1075' ; hard-wired 1075mbar threshold
1580 movwf sub_a+0 1580 movwf sub_a+0
1581 SAFE_2BYTE_COPY rel_pressure, sub_b 1581 SAFE_2BYTE_COPY rel_pressure, sub_b
1582 call sub16 ; sub_c = sub_a - sub_b 1582 call sub16 ; sub_c = sub_a - sub_b
1583 1583
1584 btfss neg_flag 1584 btfss neg_flag
1622 addwf average_depth_hold+0,F 1622 addwf average_depth_hold+0,F
1623 movf b0_hi,w 1623 movf b0_hi,w
1624 addwfc average_depth_hold+1,F 1624 addwfc average_depth_hold+1,F
1625 movlw d'0' 1625 movlw d'0'
1626 addwfc average_depth_hold+2,F 1626 addwfc average_depth_hold+2,F
1627 addwfc average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar 1627 addwfc average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1628 1628
1629 movf b0_lo,w 1629 movf b0_lo,w
1630 addwf average_depth_hold+0,F 1630 addwf average_depth_hold+0,F
1631 movf b0_hi,w 1631 movf b0_hi,w
1632 addwfc average_depth_hold+1,F 1632 addwfc average_depth_hold+1,F
1633 movlw d'0' 1633 movlw d'0'
1634 addwfc average_depth_hold+2,F 1634 addwfc average_depth_hold+2,F
1635 addwfc average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar 1635 addwfc average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1636 1636
1637 ; Do the same for the _total registers (Non-Resettable) 1637 ; Do the same for the _total registers (Non-Resettable)
1638 movf b0_lo,w 1638 movf b0_lo,w
1639 addwf average_depth_hold_total+0,F 1639 addwf average_depth_hold_total+0,F
1640 movf b0_hi,w 1640 movf b0_hi,w
1641 addwfc average_depth_hold_total+1,F 1641 addwfc average_depth_hold_total+1,F
1642 movlw d'0' 1642 movlw d'0'
1643 addwfc average_depth_hold_total+2,F 1643 addwfc average_depth_hold_total+2,F
1644 addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar 1644 addwfc average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1645 1645
1646 movf b0_lo,w 1646 movf b0_lo,w
1647 addwf average_depth_hold_total+0,F 1647 addwf average_depth_hold_total+0,F
1648 movf b0_hi,w 1648 movf b0_hi,w
1649 addwfc average_depth_hold_total+1,F 1649 addwfc average_depth_hold_total+1,F
1650 movlw d'0' 1650 movlw d'0'
1651 addwfc average_depth_hold_total+2,F 1651 addwfc average_depth_hold_total+2,F
1652 addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar 1652 addwfc average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
1653 1653
1654 ; 2. Compute Average Depth on base of average_divesecs:2 1654 ; 2. Compute Average Depth on base of average_divesecs:2
1655 movff average_divesecs+0,xB+0 1655 movff average_divesecs+0,xB+0
1656 movff average_divesecs+1,xB+1 ; Copy 1656 movff average_divesecs+1,xB+1 ; Copy
1657 movff average_depth_hold+0,xC+0 1657 movff average_depth_hold+0,xC+0