mchr3k / arduino-libs-manchester

173 stars 113 forks source link

Can't run with atmega8 #15

Open KKuKK opened 10 years ago

KKuKK commented 10 years ago

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

hmeijdam commented 10 years ago

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

vahadg commented 9 years ago

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)

hmeijdam commented 9 years ago

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

vahadg commented 9 years ago

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);