I see lot of chip from Atmel company like AT89C2051,AT89S52,Atmega32,P89V51RD2.

Suppose I write a code for Atmega32 which blink one LED after 10 milliseconds.
Can I use the same code for AT89C2051, AT89S52, P89V51RD2 if I change the port?

So if I buy one USB ISP programmer for Atmega32 MCU can I use it to program AT89C2051, AT89S52 also? Or does anybody compare the chip in terms of compiler, programmer, coding language, development board etc.?