code not following the procedure
Whenever you change from one processor to another, EVERY reference to a peripheral needs to be re-examined. Your code is a perfect example - it is full of Watchdog-specific code, and any change could cause the new processor to behave strangely.

Do you know what a Watchdog timer is? It is inside the controller, and its sole purpose is to reset the microcontroller back to the beginning of main(). That is all it does, and the only thing that can stop it is if the code "pats" the Watchdog before it times out. The idea is that you carefully structure your program so that it "pats" the Watchdog every so often - if it doesn't, then the code is bad and the microcontroller resets.

The code given even has a bug inside it:

    WDTCSR|= 1&lt;&lt;WDE;
    WDTCSR= 0x00;


This code carefully sets up bits inside the "WatchDog Timer Control/Status Register (WDTCSR)" - then zeroes it. Ummm... what?

In short, it is difficult to take existing code for one processor and simply execute it on a different one and expect it to work. Until you do, I would recommend that you comment out ALL code that references the Watchdog, until you get the rest of your code working.