X-Git-Url: http://git.smho.de/gw/?p=owSlave2.git;a=blobdiff_plain;f=common%2FOWTimerInterrupt.s;fp=common%2FOWTimerInterrupt.s;h=349be8a434b9303ff53877c9663e959bb83e2082;hp=1ad0afcda48c6b4410a1541affa84a10606732cf;hb=22b81b6c288ca56f58d064627c310e437f9453a4;hpb=b57c0ca6b523661b0d4e4a0bfb3626df890dfb99 diff --git a/common/OWTimerInterrupt.s b/common/OWTimerInterrupt.s index 1ad0afc..349be8a 100644 --- a/common/OWTimerInterrupt.s +++ b/common/OWTimerInterrupt.s @@ -1,4 +1,4 @@ -// Copyright (c) 2015, Tobias Mueller tm(at)tm3d.de +// Copyright (c) 2017, Tobias Mueller tm(at)tm3d.de // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -37,17 +37,23 @@ TIMER_INTERRUPT: push r_temp in r_temp,_SFR_IO_ADDR(SREG) push r_temp + push r_temp2 cdb sbic OW_PIN,OW_PINN ; abkuerzung wenn Leitung schon h rjmp tint_end ; Leitung 1 kein Reset ldi r_temp,0 out TCNT_REG,r_temp CLEAR_TOV_FLAG + ldi r_temp2,3 ;3x overrun for timeout tint_loop_rend: + JMP_NO_TOV ;ueberspringe wenn kein ueberlauf + rjmp tint_handle_timeout sbis OW_PIN,OW_PINN ;warten bis leitung wieder h rjmp tint_loop_rend - JMP_NO_TOV ;ueberspringe wenn kein ueberlauf - rjmp tint_overrun + ;JMP_NO_TOV ;ueberspringe wenn kein ueberlauf + cpi r_temp2,3 + ;rjmp tint_overrun + brne tint_overrun in r_temp,TCNT_REG ;schauen ob es lange genug gedauert hat fuer reset cpi r_temp,OWT_RESET2 brlo tint_end @@ -79,8 +85,15 @@ tint_loop_pres: tint_end: ;CLEAR_INTERRUPT_FLAG DIS_TIM_INT + pop r_temp2 pop r_temp out _SFR_IO_ADDR(SREG),r_temp pop r_temp reti ;;; + +tint_handle_timeout: + dec r_temp2 + breq tint_end + CLEAR_TOV_FLAG + rjmp tint_loop_rend \ No newline at end of file