comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 45:985607cfb813

1.65beta
author heinrichsweikamp
date Sun, 11 Jul 2010 20:26:43 +0200
parents 475a9e536d77
children 56aea9fcdd8f
comparison
equal deleted inserted replaced
44:475a9e536d77 45:985607cfb813
330 rcall copy_decogas_info 330 rcall copy_decogas_info
331 movlw d'3' 331 movlw d'3'
332 cpfseq hi ; Gases 0-3 copied? 332 cpfseq hi ; Gases 0-3 copied?
333 bra divemode_check_decogases2 ; No, Continue 333 bra divemode_check_decogases2 ; No, Continue
334 334
335 read_int_eeprom d'23' ; Read He ratio 335 read_int_eeprom d'113' ; Read He ratio
336 movff EEDATA,char_I_deco_He_ratio ; And copy into hold register 336 movff EEDATA,char_I_deco_He_ratio ; And copy into hold register
337 337
338 read_int_eeprom d'22' ; Read O2 ratio 338 read_int_eeprom d'112' ; Read O2 ratio
339 movff char_I_deco_He_ratio, wait_temp ; copy into bank1 register 339 movff char_I_deco_He_ratio, wait_temp ; copy into bank1 register
340 bsf STATUS,C ; 340 bsf STATUS,C ;
341 movlw d'100' ; 100% 341 movlw d'100' ; 100%
342 subfwb wait_temp,W ; minus He 342 subfwb wait_temp,W ; minus He
343 subfwb EEDATA,F ; minus O2 343 subfwb EEDATA,F ; minus O2
344 movff EEDATA, char_I_deco_N2_ratio; = N2! 344 movff EEDATA, char_I_deco_N2_ratio; = N2!
345 345
346 ; Now, set change depth. Inactive gases get depth=0! 346 ; Now, set change depth. Inactive gases have depth=0!
347 347
348 read_int_eeprom d'27' ; read flag register 348 read_int_eeprom d'118' ; read gas_change_depth Gas1
349 movff EEDATA,hi ; temp 349 movff EEDATA,char_I_deco_gas_change5
350 350
351 read_int_eeprom d'28' ; read gas_change_depth Gas1 351 read_int_eeprom d'119' ; read gas_change_depth Gas1
352 movlw d'0' 352 movff EEDATA,char_I_deco_gas_change4
353 btfsc hi,0 ; Skip if clear -> Skip if inactive 353
354 movf EEDATA,W 354 read_int_eeprom d'120' ; read gas_change_depth Gas1
355 movff WREG,char_I_deco_gas_change5 355 movff EEDATA,char_I_deco_gas_change3
356 356
357 read_int_eeprom d'29' ; read gas_change_depth Gas2 357 read_int_eeprom d'121' ; read gas_change_depth Gas1
358 movlw d'0' 358 movff EEDATA,char_I_deco_gas_change2
359 btfsc hi,1 ; Skip if clear -> Skip if inactive 359
360 movf EEDATA,W 360 read_int_eeprom d'122' ; read gas_change_depth Gas1
361 movff WREG,char_I_deco_gas_change4 361 movff EEDATA,char_I_deco_gas_change
362 362
363 read_int_eeprom d'30' ; read gas_change_depth Gas3
364 movlw d'0'
365 btfsc hi,2 ; Skip if clear -> Skip if inactive
366 movf EEDATA,W
367 movff WREG,char_I_deco_gas_change3
368
369 read_int_eeprom d'31' ; read gas_change_depth Gas4
370 movlw d'0'
371 btfsc hi,3 ; Skip if clear -> Skip if inactive
372 movf EEDATA,W
373 movff WREG,char_I_deco_gas_change2
374
375 read_int_eeprom d'32' ; read gas_change_depth Gas5
376 movlw d'0'
377 btfsc hi,4 ; Skip if clear -> Skip if inactive
378 movf EEDATA,W
379 movff WREG,char_I_deco_gas_change
380 363
381 ; Debugger 364 ; Debugger
382 ;call enable_rs232 365 ; call enable_rs232
383 ; movff char_I_deco_He_ratio5,TXREG 366 ; movff char_I_deco_He_ratio5,TXREG
384 ; call rs232_wait_tx ; wait for UART 367 ; call rs232_wait_tx ; wait for UART
385 ; movff char_I_deco_N2_ratio5,TXREG 368 ; movff char_I_deco_N2_ratio5,TXREG
386 ; call rs232_wait_tx ; wait for UART 369 ; call rs232_wait_tx ; wait for UART
387 ; movff char_I_deco_He_ratio4,TXREG 370 ; movff char_I_deco_He_ratio4,TXREG
413 return 396 return
414 397
415 copy_decogas_info: 398 copy_decogas_info:
416 movf hi,W ; Gas 1-4 399 movf hi,W ; Gas 1-4
417 mullw d'4' ; times 4... 400 mullw d'4' ; times 4...
401 movlw d'90' ; +90 Offset to new...
402 addwf PRODL,F ; ..sorted list!
403
418 movf PRODL,W ; 404 movf PRODL,W ;
419 addlw d'7' ; +7 = address for He ratio 405 addlw d'7' ; +7 = address for He ratio
420 movwf EEADR 406 movwf EEADR
421 call read_eeprom ; Read He ratio 407 call read_eeprom ; Read He ratio
422 movff EEDATA,INDF1 ; And copy into hold register 408 movff EEDATA,INDF1 ; And copy into hold register
423 409
424 movf hi,W ; Gas 1-4 410 movf hi,W ; Gas 1-4
425 mullw d'4' ; times 4... 411 mullw d'4' ; times 4...
412 movlw d'90' ; +90 Offset to new...
413 addwf PRODL,F ; ..sorted list!
414
426 movf PRODL,W ; 415 movf PRODL,W ;
427 addlw d'6' ; +6 = address for O2 ratio 416 addlw d'6' ; +6 = address for O2 ratio
428 movwf EEADR 417 movwf EEADR
429 call read_eeprom ; Read O2 ratio 418 call read_eeprom ; Read O2 ratio
430 ; movff EEDATA, char_I_O2_ratio ; O2 ratio 419 ; movff EEDATA, char_I_O2_ratio ; O2 ratio
442 movff lo,char_I_deco_gas_change5 431 movff lo,char_I_deco_gas_change5
443 movff lo,char_I_deco_gas_change4 432 movff lo,char_I_deco_gas_change4
444 movff lo,char_I_deco_gas_change3 433 movff lo,char_I_deco_gas_change3
445 movff lo,char_I_deco_gas_change2 434 movff lo,char_I_deco_gas_change2
446 movff lo, char_I_deco_gas_change ; clear 435 movff lo, char_I_deco_gas_change ; clear
447 ; movff lo, char_I_deco_N2_ratio ; clear
448 ; movff lo, char_I_deco_He_ratio ; clear
449 ;call PLED_gaschange_DEBUG
450 return 436 return
451 437
452 calc_deko_divemode2: 438 calc_deko_divemode2:
453 bcf twosecupdate 439 bcf twosecupdate
454 440
1594 bra set_no_forced_stops 1580 bra set_no_forced_stops
1595 lfsr FSR0,0x290 ; clear int_O_calc_tissue_call_counter (DEBUG) 1581 lfsr FSR0,0x290 ; clear int_O_calc_tissue_call_counter (DEBUG)
1596 clrf POSTINC0 1582 clrf POSTINC0
1597 clrf POSTINC0 1583 clrf POSTINC0
1598 1584
1599 ; Load GF values into RAM 1585 ;; Load GF values into RAM - now done in start.asm!
1600 GETCUSTOM8 d'32' ; GF low 1586 ; GETCUSTOM8 d'32' ; GF low
1601 movff EEDATA,char_I_GF_Lo_percentage 1587 ; movff EEDATA,char_I_GF_Lo_percentage
1602 GETCUSTOM8 d'33' ; GF high 1588 ; GETCUSTOM8 d'33' ; GF high
1603 movff EEDATA,char_I_GF_Hi_percentage 1589 ; movff EEDATA,char_I_GF_Hi_percentage
1604 1590 ;
1605 ; Start with active Stopwatch? 1591 ; Start with active Stopwatch?
1606 bsf stopwatch_active 1592 bsf stopwatch_active
1607 GETCUSTOM8 d'41' ; =1: Start with active Stopwatch 1593 GETCUSTOM8 d'41' ; =1: Start with active Stopwatch
1608 movwf lo 1594 movwf lo
1609 movlw d'1' 1595 movlw d'1'