comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 256:d8dfbc7041b0

added CPU time debugger
author heinrichsweikamp
date Sun, 10 Apr 2011 09:54:44 +0200
parents 8f20e8948b97
children f8f869bafd92
comparison
equal deleted inserted replaced
255:1efd59d689f8 256:d8dfbc7041b0
23 ; known bugs: 23 ; known bugs:
24 ; ToDo: 24 ; ToDo:
25 25
26 diveloop: 26 diveloop:
27 call diveloop_boot ; Boot tasks for all modes 27 call diveloop_boot ; Boot tasks for all modes
28
29 ; start timer3 for deco routine CPU usesage monitor
30 movlw b'00000011'
31 movwf T3CON ; Timer3 with 32768Hz clock running
28 32
29 ; Startup Tasks for all modes 33 ; Startup Tasks for all modes
30 ostc_debug 'R' ; Sends debug-information to screen if debugmode active 34 ostc_debug 'R' ; Sends debug-information to screen if debugmode active
31 call PLED_ClearScreen ; clean up OLED 35 call PLED_ClearScreen ; clean up OLED
32 call PLED_divemode_mask ; Display mask 36 call PLED_divemode_mask ; Display mask
438 btfsc FLAG_apnoe_mode ; ignore decompression calculation in apnoe mode 442 btfsc FLAG_apnoe_mode ; ignore decompression calculation in apnoe mode
439 return 443 return
440 444
441 ostc_debug 'B' ; Sends debug-information to screen if debugmode active 445 ostc_debug 'B' ; Sends debug-information to screen if debugmode active
442 call divemode_prepare_flags_for_deco 446 call divemode_prepare_flags_for_deco
443
444 movlw d'0' 447 movlw d'0'
445 movff WREG,char_I_step_is_1min ; 2 second deco mode 448 movff WREG,char_I_step_is_1min ; 2 second deco mode
449
450 clrf TMR3L
451 clrf TMR3H ; Reset Timer3
446 452
447 call deco_calc_hauptroutine ; calc_tissue 453 call deco_calc_hauptroutine ; calc_tissue
448 movlb b'00000001' ; rambank 1 selected 454 movlb b'00000001' ; rambank 1 selected
449 ostc_debug 'C' ; Sends debug-information to screen if debugmode active 455 ostc_debug 'C' ; Sends debug-information to screen if debugmode active
456
457 btfss debug_mode ; Are we in debugmode?
458 bra calc_deko_divemode4 ; No...
459
460 ; Show timer3 reading converted into ms (Error: +2,3%) in custom area
461 movff TMR3L,lo
462 movff TMR3H,hi
463 bcf STATUS,C
464 rrcf hi
465 rrcf lo ;/2
466 bcf STATUS,C
467 rrcf hi
468 rrcf lo ;/4
469 bcf STATUS,C
470 rrcf hi
471 rrcf lo ;/8
472 bcf STATUS,C
473 rrcf hi
474 rrcf lo ;/16
475 bcf STATUS,C
476 rrcf hi
477 rrcf lo ;/32
478
479 WIN_TOP .216
480 WIN_LEFT .100
481 WIN_FONT FT_SMALL
482 STRCPY "ms:"
483 output_16
484 call word_processor
485
486 calc_deko_divemode4:
450 487
451 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register 488 movff char_O_first_deco_depth,wait_temp ; copy ceiling to temp register
452 tstfsz wait_temp ; Ceiling<0m? 489 tstfsz wait_temp ; Ceiling<0m?
453 bra calc_deko_divemode3 ; Yes! 490 bra calc_deko_divemode3 ; Yes!
454 491