comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 222:638f8e17bd51

Prototyping deco_gas_volumes() to compute gas consumption per tank with decoplanning.
author JeanDo
date Tue, 01 Mar 2011 14:41:10 +0100
parents 448478ceccea
children 49c90c5d9603
comparison
equal deleted inserted replaced
221:448478ceccea 222:638f8e17bd51
262 bsf twosecupdate ; No, but next second! 262 bsf twosecupdate ; No, but next second!
263 ; Routines used in the "other second" 263 ; Routines used in the "other second"
264 call calc_average_depth ; calculate average depth 264 call calc_average_depth ; calculate average depth
265 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) 265 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds)
266 266
267 ; calculate ppO2 in 0.1Bar (e.g. 150 = 1.50Bar ppO2) 267 ; calculate ppO2 in 0.01Bar (e.g. 150 = 1.50 Bar ppO2)
268 movff amb_pressure+0,xA+0 268 movff amb_pressure+0,xA+0 ; P_amb in milibar (1000 = 1.000 bar).
269 movff amb_pressure+1,xA+1 269 movff amb_pressure+1,xA+1
270 movlw d'10' 270 movlw d'10'
271 movwf xB+0 271 movwf xB+0
272 clrf xB+1 272 clrf xB+1
273 call div16x16 ; xC=p_amb/10 273 call div16x16 ; xC=p_amb/10 (100 = 1.00 bar).
274 movff xC+0,xA+0 274 movff xC+0,xA+0
275 movff xC+1,xA+1 275 movff xC+1,xA+1
276 movff char_I_O2_ratio,xB+0 276 movff char_I_O2_ratio,xB+0
277 clrf xB+1 277 clrf xB+1
278 call mult16x16 ; char_I_O2_ratio * p_amb/10 278 call mult16x16 ; char_I_O2_ratio * (p_amb/10)
279 movff xC+0,xA+0 279 movff xC+0,xA+0
280 movff xC+1,xA+1 280 movff xC+1,xA+1
281 movlw d'100' 281 movlw d'100'
282 movwf xB+0 282 movwf xB+0
283 clrf xB+1 283 clrf xB+1
358 358
359 ; Now, set change depth. Inactive gases have depth=0! 359 ; Now, set change depth. Inactive gases have depth=0!
360 read_int_eeprom d'118' ; read gas_change_depth Gas1 360 read_int_eeprom d'118' ; read gas_change_depth Gas1
361 btfss sorted_gaslist_active,0 ; Apply depth? 361 btfss sorted_gaslist_active,0 ; Apply depth?
362 clrf EEDATA ; No, clear! 362 clrf EEDATA ; No, clear!
363 movff EEDATA,char_I_deco_gas_change5 ; Yes! 363 movff EEDATA,char_I_deco_gas_change+4 ; Yes!
364 364
365 read_int_eeprom d'119' ; read gas_change_depth Gas2 365 read_int_eeprom d'119' ; read gas_change_depth Gas2
366 btfss sorted_gaslist_active,1 ; Apply depth? 366 btfss sorted_gaslist_active,1 ; Apply depth?
367 clrf EEDATA ; No, clear! 367 clrf EEDATA ; No, clear!
368 movff EEDATA,char_I_deco_gas_change4 ; Yes! 368 movff EEDATA,char_I_deco_gas_change+3 ; Yes!
369 369
370 read_int_eeprom d'120' ; read gas_change_depth Gas3 370 read_int_eeprom d'120' ; read gas_change_depth Gas3
371 btfss sorted_gaslist_active,2 ; Apply depth? 371 btfss sorted_gaslist_active,2 ; Apply depth?
372 clrf EEDATA ; No, clear! 372 clrf EEDATA ; No, clear!
373 movff EEDATA,char_I_deco_gas_change3 ; Yes! 373 movff EEDATA,char_I_deco_gas_change+2 ; Yes!
374 374
375 read_int_eeprom d'121' ; read gas_change_depth Gas4 375 read_int_eeprom d'121' ; read gas_change_depth Gas4
376 btfss sorted_gaslist_active,3 ; Apply depth? 376 btfss sorted_gaslist_active,3 ; Apply depth?
377 clrf EEDATA ; No, clear! 377 clrf EEDATA ; No, clear!
378 movff EEDATA,char_I_deco_gas_change2 ; Yes! 378 movff EEDATA,char_I_deco_gas_change+1 ; Yes!
379 379
380 read_int_eeprom d'122' ; read gas_change_depth Gas5 380 read_int_eeprom d'122' ; read gas_change_depth Gas5
381 btfss sorted_gaslist_active,4 ; Apply depth? 381 btfss sorted_gaslist_active,4 ; Apply depth?
382 clrf EEDATA ; No, clear! 382 clrf EEDATA ; No, clear!
383 movff EEDATA,char_I_deco_gas_change1 ; Yes! 383 movff EEDATA,char_I_deco_gas_change+0 ; Yes!
384 384
385 ; Debugger 385 ; Debugger
386 ; call enable_rs232 386 ; call enable_rs232
387 ; movff char_I_deco_He_ratio5,TXREG 387 ; movff char_I_deco_He_ratio5,TXREG
388 ; call rs232_wait_tx ; wait for UART 388 ; call rs232_wait_tx ; wait for UART
418 return 418 return
419 419
420 reset_decompression_gases: ; reset the deco gas while in NDL 420 reset_decompression_gases: ; reset the deco gas while in NDL
421 ostc_debug 'F' ; Sends debug-information to screen if debugmode active 421 ostc_debug 'F' ; Sends debug-information to screen if debugmode active
422 clrf lo 422 clrf lo
423 movff lo,char_I_deco_gas_change5 423 movff lo,char_I_deco_gas_change+4
424 movff lo,char_I_deco_gas_change4 424 movff lo,char_I_deco_gas_change+3
425 movff lo,char_I_deco_gas_change3 425 movff lo,char_I_deco_gas_change+2
426 movff lo,char_I_deco_gas_change2 426 movff lo,char_I_deco_gas_change+1
427 movff lo,char_I_deco_gas_change1 ; clear 427 movff lo,char_I_deco_gas_change+0 ; clear
428 return 428 return
429 429
430 calc_deko_divemode2: 430 calc_deko_divemode2:
431 bcf twosecupdate 431 bcf twosecupdate
432 432