Unable to upload a code to arduino duemilanove with Atmega8....

I have two arduino duemilanove board one with Atmega328 another with Atmega8..

I have written a code which is only 5442 bytes..
When I upload it to the Atmega 328 board it uploads and runs fine,
But if I try to upload it to the board with Atmega 8 I get errors, I guess its not the size problem as the maximum size of the Atmega8 is 7168 bytes.

the errors I am writing below..

C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::mark(int)':
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:172: error: 'TCCR2A' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:172: error: 'COM2B1' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::space(int)':
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:180: error: 'TCCR2A' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:180: error: 'COM2B1' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp: In member function 'void IRsend::enableIROut(int)':
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:198: error: 'TIMSK2' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:207: error: 'TCCR2A' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:208: error: 'TCCR2B' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:208: error: 'WGM22' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:211: error: 'OCR2A' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:212: error: 'OCR2B' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp: In member function 'void IRrecv::enableIRIn()':
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:224: error: 'TCCR2A' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:229: error: 'TCCR2B' was not declared in this scope
C:\Documents and Settings\Joy\Desktop\Quad\arduino-0022\libraries\IRremote\IRremote.cpp:234: error: 'TIMSK2' was not declared in this scope

In case if someone needs to look onto the IRremote library, you can get it here
http://arcfn.com/files/IRremote.zip

And my code is attached below

remote.zip (874 Bytes)

I may have not started with arduino early enough but I thought duemilanove comes with 168 and 328 but not 8. Have you got it working in the past and what bootloader do you have on the 8?

liudr:
I may have not started with arduino early enough but I thought duemilanove comes with 168 and 328 but not 8. Have you got it working in the past and what bootloader do you have on the 8?

I have uploaded the arduino bootloader with the Arduino 0022 to the Atmega 8 and put that on the other board, don't know what is the version of the bootloader...

I suppose you are using PWM in your sketch. Atmega 8 has only 3 PWM channels but Atmega 328 has 6 PWM channels. You may trying to use a PWM which not exits in Atmega 8.

When I try upload the BLINK code to the Atmega8, it runs fine…

So just to check, I only tried to upload this to the board…

#include <IRremote.h>
void setup(){
}

void loop(){
}

I got the same errors…
So that means that my code has no problem…

Its that IRremote.h file is not matching the Atmega8…

How do I solve this problem…??

IRremote library uses the pin 3 (PWM). It is TIMER2B which is not exist in Atmega8. IRremote lib needs a lots of modification to work on Atmega8.

Can someone plese help me out how do I edit the IRremote.h file…??

Joy,

There is avr ir library for atmega8 in this link
http://extremeelectronics.co.in/code-libraries/using-ir-remote-with-avr-mcus-part-ii/
Have a look it.