From a28cbb81b2a151999f75dae825107aaecae427a2 Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 18 Sep 2015 20:14:28 +0200 Subject: [PATCH] Handle Overflow of Timer by Reset dedection (Problem was wenn Reset comes verry soon after or in communication. (DS18B20 and Onewireviewer sometimes)) --- common/OWPinInterrupt.s | 1 + common/OWSet_ATTINYX4.s | 13 +++++++++++-- common/OWTimerInterrupt.s | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/OWPinInterrupt.s b/common/OWPinInterrupt.s index 660c7f3..b5b7b87 100644 --- a/common/OWPinInterrupt.s +++ b/common/OWPinInterrupt.s @@ -143,6 +143,7 @@ no_zerromaker: sts sendflag,r_sendflag sts bcount,r_bcount sts rwbyte,r_rwbyte + //cdb pop r_sendflag pop r_rwbyte pop r_bcount diff --git a/common/OWSet_ATTINYX4.s b/common/OWSet_ATTINYX4.s index c0a074b..de42063 100644 --- a/common/OWSet_ATTINYX4.s +++ b/common/OWSet_ATTINYX4.s @@ -37,6 +37,7 @@ #define OW_DDR _SFR_IO_ADDR(DDRB) //pin direction register #define TCNT_REG _SFR_IO_ADDR(TCNT0) + #define DB_PORT _SFR_IO_ADDR(PORTB) //DEBUG #define DB_PIN _SFR_IO_ADDR(PINB) //DEBUG #define DB_DDR _SFR_IO_ADDR(DDRB) //DEBUG @@ -60,14 +61,22 @@ //#define OWT_WRITE 18 //#define OWT_READ 4 -#define OWT_MIN_RESET 80 -#define OWT_RESET2 100 +#define OWT_MIN_RESET 120 +#define OWT_RESET2 80 #define OWT_RESET_PRESENT 30 #define OWT_PRESENT 130 #define OWT_WRITE 35 #define OWT_READ 12 +.macro CLEAR_TOV_FLAG + ldi r_temp,1 + out _SFR_IO_ADDR(TIFR0),r_temp +.endm +.macro JMP_NO_TOV + in r_temp, _SFR_IO_ADDR(TIFR0) + sbrc r_temp,TOV0 ; wenn ueberlauf gleiich weiter +.endm .macro CLEAR_INTERRUPT_FLAG ldi r_temp,(1<