Mercurial > public > mk2
changeset 486:c7b663939737
making waitms speed-independent, desat-time fix
author | heinrichsweikamp |
---|---|
date | Sat, 15 Oct 2011 15:03:53 +0200 |
parents | e83f883c96b2 |
children | 4c93c2154f18 |
files | code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/surfmode.asm code_part1/OSTC_code_asm_part1/wait.asm |
diffstat | 3 files changed, 27 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Sat Oct 15 13:45:15 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Sat Oct 15 15:03:53 2011 +0200 @@ -1121,6 +1121,8 @@ movlb b'00000001' ; select ram bank 1 call calc_deko_surfmode2 ; work-around for nofly bug rcall calculate_noflytime ; Calc NoFly time + movff int_O_desaturation_time+0,desaturation_time_buffer+0 + movff int_O_desaturation_time+1,desaturation_time_buffer+1 ostc_debug 'H' ; Sends debug-information to screen if debugmode active ; store header and ... movlw 0xFD ; .... End-of-Profile Bytes
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm Sat Oct 15 13:45:15 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/surfmode.asm Sat Oct 15 15:03:53 2011 +0200 @@ -237,6 +237,10 @@ return nofly_timeout60: + movf desaturation_time_buffer+0,W; Is Desat null ? + iorwf desaturation_time_buffer+1,W + rcall nofly_timeout60_0 ; No... + movf nofly_time+0,W ; Is nofly null ? iorwf nofly_time+1,W bnz nofly_timeout60_1 ; No... @@ -245,6 +249,13 @@ bcf LED_blue ; Clear led. return +nofly_timeout60_0: + movlw d'1' + subwf desaturation_time_buffer+0,F + movlw d'0' + subwfb desaturation_time_buffer+1,F ; reduce by one + return + nofly_timeout60_1: bsf nofly_active ; Set flag movlw d'1' @@ -298,10 +309,6 @@ call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode movlb b'00000001' ; select ram bank 1 ostc_debug 'J' ; Sends debug-information to screen if debugmode active - - movff int_O_desaturation_time+0,desaturation_time_buffer+0 - movff int_O_desaturation_time+1,desaturation_time_buffer+1 - return ;============================================================================= @@ -406,7 +413,7 @@ return show_cv_active: ; CV mode - ; Enable only when USB power attached + ; Enable RS232 only when USB power attached btfss RCSTA,7 ; RS232 already enabled? call enable_rs232 ; No, start UART module bsf LED_red
--- a/code_part1/OSTC_code_asm_part1/wait.asm Sat Oct 15 13:45:15 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/wait.asm Sat Oct 15 15:03:53 2011 +0200 @@ -81,66 +81,22 @@ goto WAIT10USX2 return ; ========================================================== -; WAIT 1 MILLISECOND - 16 MHZ +; WAIT 1 MILLISECOND - Working with TMR1 ; ========================================================== - IFDEF SPEED_16MHz -WAITMS macro waitms_temp - movlw waitms_temp - call WAITMSX - endm - ENDIF - - IFDEF SPEED_32MHz WAITMS macro waitms_temp movlw waitms_temp - call WAITMSX - movlw waitms_temp - call WAITMSX + call WAITMSX endm - ENDIF + +WAITMSX movwf waitms_temp ; Holds number of ms to wait -WAITMSX movwf waitms_temp - goto JumpInMSX -WAITMSX2 nop - nop - nop - nop - nop - nop - nop - nop -JumpInMSX: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - WAIT10US d'99' - decfsz waitms_temp,1 - goto WAITMSX2 +WAITMSX1: + movf TMR1L,W + addlw d'66' ; 66*15,26µs ~ 1ms + +WAITMSX2 cpfseq TMR1L + bra WAITMSX2 ; loop here... + + decfsz waitms_temp,F + bra WAITMSX1 return \ No newline at end of file