arduino-libs-manchester icon indicating copy to clipboard operation
arduino-libs-manchester copied to clipboard

Can't run with atmega8

Open KKuKK opened this issue 11 years ago • 4 comments

Hi! First I think one line for the atmega8 is missing here ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

if defined( AVR_ATtiny45 )

ISR(TIMER1_COMPA_vect)

elif defined( AVR_ATtiny84 )

ISR(TIM1_COMPA_vect)

elif defined(AVR_ATmega32U4)

ISR(TIMER3_COMPA_vect)

// this line is a must, otherwise the chip stops at once

elif defined(AVR_ATmega8)


ISR(TIMER1_COMPA_vect)

else

ISR(TIMER2_COMPA_vect)

endif

+++++++++++++++++++++++++++++++++++++++++++++++++++++++ After inserting the line, the code in the function TIMER1_COMPA_vect is used. But the atmega8 and the Attiny84 is not working. I use it with an Attiny45 and an Arduino with an Atmega328, which works. I have tried to find an error, but I am quite new, and not good enough. May be some one made it. Would be great. Greatings KK

KKuKK avatar Feb 01 '14 14:02 KKuKK

I can confirm your issue. I tried an Atmega8 on both 8MHz and 16MHz and in both cases the examples compiled fine, but did not work. With the Attiny85 and the Atmega328 this library works just fine for me. Br,, Hans

hmeijdam avatar Nov 06 '14 18:11 hmeijdam

manchester.h 81 //setup timing for transmitter 82 #define HALF_BIT_INTERVAL 6144 //(=48 * 1024 * 1000000 / 8000000Hz) microseconds for speed factor 0 manchester.cpp 365 TCCR1B = _BV(WGM12); // reset counter on match 366 TCCR1B |= _BV(CS11); // 1/8 prescaler

478 #elif defined(AVR_ATmega8) 479 ISR(TIMER1_COMPA_vect)

vahadg avatar Apr 03 '15 16:04 vahadg

Cool thanks Vahadg I will hook up some stuff this weekend and give your suggestions a try.

Declaring TCCR1B twice is not a typo? You did not mean one of them is TCCR1A ? I am just not sure how to exactly interpret this: 365 TCCR1B = _BV(WGM12); // reset counter on match 366 TCCR1B |= _BV(CS11); // 1/8 prescaler

hmeijdam avatar Apr 03 '15 17:04 hmeijdam

http://www.atmel.com/Images/Atmel-8159-8-bit-AVR-microcontroller-ATmega8A_datasheet.pdf

17.11 Register Description TCCR1A [COM1A1:COM1A0:COM1B1:COM1B0:FOC1A:FOC1B:WGM11:WGM10]; TCCR1B [ICNC1:ICES1: –– :WGM13:WGM12:CS12:CS11:CS10];

TCCR1B = _BV(WGM12) | _BV(CS11); // same TCCR1B = (1<<WGM12) | (1<<CS11);

vahadg avatar Apr 04 '15 07:04 vahadg