I am using AVR ATMEGA-16A. while testing the code, if I use internal 8MHz oscillator it works fine. but when I use 16MHz external oscillator then any electrical noise like rapidly switch ON and OFF other appliances(FAN, Tubelight) on same switchboard where the AVR power supply connected then AVR hangs or works undesirable like LCD character shifts or hangs.
I tested various times to find the problem and this problem only occurs when I use 16MHz external oscillator.
note: I have to use external 16MHz oscillator for the accuracy. I am using Timer Interrupt for accurate 1 sec overflow. External Osc. is connected as given in the datasheet using 22pf cap to both pins and grounded also very close to XTAL pins.
Please help me out.
Thanks for everyone for attention.