comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 224:49c90c5d9603

Gas usage + Show after last page of decoplan. + Units in 0.1 litters (or bars), hence 16bits. + Define CF#56 and CF#57, defaults to 20.0 l/min. + Go RED if volume > 6553.5 (saturated). + Calculate gas usage at bottom of ascent (safe bet). + Fix when first gas is not Gas1. + BUGFIX gas usage: first gas is not in the sorted gaslist (in general). KNOWN BUG: wrong result if the gaslist is not sorted, or first gas do have a depth > 0.
author JeanDo
date Thu, 03 Mar 2011 15:16:23 +0100
parents 638f8e17bd51
children 6d4e29d80ff3
comparison
equal deleted inserted replaced
223:2a0a446fa6c0 224:49c90c5d9603
305 bra reset_decompression_gases ; While in NDL, do not set deompression gas 305 bra reset_decompression_gases ; While in NDL, do not set deompression gas
306 306
307 divemode_check_decogases: ; CALLed from Simulator 307 divemode_check_decogases: ; CALLed from Simulator
308 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio 308 ; Copy active gases to char_I_deco_N2_ratio and char_I_deco_He_ratio
309 read_int_eeprom d'97' ; Read He ratio 309 read_int_eeprom d'97' ; Read He ratio
310 movff EEDATA,char_I_deco_He_ratio5 ; And copy into hold register 310 movff EEDATA,char_I_deco_He_ratio+4 ; And copy into hold register
311 read_int_eeprom d'96' ; Read O2 ratio 311 read_int_eeprom d'96' ; Read O2 ratio
312 movff char_I_deco_He_ratio5, wait_temp ; copy into bank1 register 312 movff char_I_deco_He_ratio+4, wait_temp ; copy into bank1 register
313 bsf STATUS,C ; 313 bsf STATUS,C ;
314 movlw d'100' ; 100% 314 movlw d'100' ; 100%
315 subfwb wait_temp,W ; minus He 315 subfwb wait_temp,W ; minus He
316 subfwb EEDATA,F ; minus O2 316 subfwb EEDATA,F ; minus O2
317 movff EEDATA, char_I_deco_N2_ratio5; = N2! 317 movff EEDATA, char_I_deco_N2_ratio+4; = N2!
318 318
319 read_int_eeprom d'101' ; Read He ratio 319 read_int_eeprom d'101' ; Read He ratio
320 movff EEDATA,char_I_deco_He_ratio4 ; And copy into hold register 320 movff EEDATA,char_I_deco_He_ratio+3 ; And copy into hold register
321 read_int_eeprom d'100' ; Read O2 ratio 321 read_int_eeprom d'100' ; Read O2 ratio
322 movff char_I_deco_He_ratio4, wait_temp ; copy into bank1 register 322 movff char_I_deco_He_ratio+3, wait_temp ; copy into bank1 register
323 bsf STATUS,C ; 323 bsf STATUS,C ;
324 movlw d'100' ; 100% 324 movlw d'100' ; 100%
325 subfwb wait_temp,W ; minus He 325 subfwb wait_temp,W ; minus He
326 subfwb EEDATA,F ; minus O2 326 subfwb EEDATA,F ; minus O2
327 movff EEDATA, char_I_deco_N2_ratio4; = N2! 327 movff EEDATA, char_I_deco_N2_ratio+3; = N2!
328 328
329 read_int_eeprom d'105' ; Read He ratio 329 read_int_eeprom d'105' ; Read He ratio
330 movff EEDATA,char_I_deco_He_ratio3 ; And copy into hold register 330 movff EEDATA,char_I_deco_He_ratio+2 ; And copy into hold register
331 read_int_eeprom d'104' ; Read O2 ratio 331 read_int_eeprom d'104' ; Read O2 ratio
332 movff char_I_deco_He_ratio3, wait_temp ; copy into bank1 register 332 movff char_I_deco_He_ratio+2, wait_temp ; copy into bank1 register
333 bsf STATUS,C ; 333 bsf STATUS,C ;
334 movlw d'100' ; 100% 334 movlw d'100' ; 100%
335 subfwb wait_temp,W ; minus He 335 subfwb wait_temp,W ; minus He
336 subfwb EEDATA,F ; minus O2 336 subfwb EEDATA,F ; minus O2
337 movff EEDATA, char_I_deco_N2_ratio3; = N2! 337 movff EEDATA, char_I_deco_N2_ratio+2; = N2!
338 338
339 read_int_eeprom d'109' ; Read He ratio 339 read_int_eeprom d'109' ; Read He ratio
340 movff EEDATA,char_I_deco_He_ratio2 ; And copy into hold register 340 movff EEDATA,char_I_deco_He_ratio+1 ; And copy into hold register
341 read_int_eeprom d'108' ; Read O2 ratio 341 read_int_eeprom d'108' ; Read O2 ratio
342 movff char_I_deco_He_ratio2, wait_temp ; copy into bank1 register 342 movff char_I_deco_He_ratio+1, wait_temp ; copy into bank1 register
343 bsf STATUS,C ; 343 bsf STATUS,C ;
344 movlw d'100' ; 100% 344 movlw d'100' ; 100%
345 subfwb wait_temp,W ; minus He 345 subfwb wait_temp,W ; minus He
346 subfwb EEDATA,F ; minus O2 346 subfwb EEDATA,F ; minus O2
347 movff EEDATA, char_I_deco_N2_ratio2; = N2! 347 movff EEDATA, char_I_deco_N2_ratio+1; = N2!
348 348
349 read_int_eeprom d'113' ; Read He ratio 349 read_int_eeprom d'113' ; Read He ratio
350 movff EEDATA,char_I_deco_He_ratio1; And copy into hold register 350 movff EEDATA,char_I_deco_He_ratio+0; And copy into hold register
351 read_int_eeprom d'112' ; Read O2 ratio 351 read_int_eeprom d'112' ; Read O2 ratio
352 movff char_I_deco_He_ratio1, wait_temp ; copy into bank1 register 352 movff char_I_deco_He_ratio+0, wait_temp ; copy into bank1 register
353 bsf STATUS,C ; 353 bsf STATUS,C ;
354 movlw d'100' ; 100% 354 movlw d'100' ; 100%
355 subfwb wait_temp,W ; minus He 355 subfwb wait_temp,W ; minus He
356 subfwb EEDATA,F ; minus O2 356 subfwb EEDATA,F ; minus O2
357 movff EEDATA, char_I_deco_N2_ratio1; = N2! 357 movff EEDATA, char_I_deco_N2_ratio+0; = N2!
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!
382 clrf EEDATA ; No, clear! 382 clrf EEDATA ; No, clear!
383 movff EEDATA,char_I_deco_gas_change+0 ; 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_ratio+4,TXREG
388 ; call rs232_wait_tx ; wait for UART 388 ; call rs232_wait_tx ; wait for UART
389 ; movff char_I_deco_N2_ratio5,TXREG 389 ; movff char_I_deco_N2_ratio+4,TXREG
390 ; call rs232_wait_tx ; wait for UART 390 ; call rs232_wait_tx ; wait for UART
391 ; movff char_I_deco_He_ratio4,TXREG 391 ; movff char_I_deco_He_ratio+3,TXREG
392 ; call rs232_wait_tx ; wait for UART 392 ; call rs232_wait_tx ; wait for UART
393 ; movff char_I_deco_N2_ratio4,TXREG 393 ; movff char_I_deco_N2_ratio+3,TXREG
394 ; call rs232_wait_tx ; wait for UART 394 ; call rs232_wait_tx ; wait for UART
395 ; movff char_I_deco_He_ratio3,TXREG 395 ; movff char_I_deco_He_ratio+2,TXREG
396 ; call rs232_wait_tx ; wait for UART 396 ; call rs232_wait_tx ; wait for UART
397 ; movff char_I_deco_N2_ratio3,TXREG 397 ; movff char_I_deco_N2_ratio+2,TXREG
398 ; call rs232_wait_tx ; wait for UART 398 ; call rs232_wait_tx ; wait for UART
399 ; movff char_I_deco_He_ratio2,TXREG 399 ; movff char_I_deco_He_ratio+1,TXREG
400 ; call rs232_wait_tx ; wait for UART 400 ; call rs232_wait_tx ; wait for UART
401 ; movff char_I_deco_N2_ratio2,TXREG 401 ; movff char_I_deco_N2_ratio+1,TXREG
402 ; call rs232_wait_tx ; wait for UART 402 ; call rs232_wait_tx ; wait for UART
403 ; movff char_I_deco_He_ratio,TXREG 403 ; movff char_I_deco_He_ratio,TXREG
404 ; call rs232_wait_tx ; wait for UART 404 ; call rs232_wait_tx ; wait for UART
405 ; movff char_I_deco_N2_ratio,TXREG 405 ; movff char_I_deco_N2_ratio,TXREG
406 ; call rs232_wait_tx ; wait for UART 406 ; call rs232_wait_tx ; wait for UART