hello Vikas,
the problem is due to optimization. the simple way to avoid optimization is to add "asm nop;"
while (1)
{
PTAD_PTAD0 = 1;
asm nop;
delay();
PTAD_PTAD0 = 0;
asm nop;
delay();
PTAD_PTAD0 = 1;
asm nop;
delay();
PTAD_PTAD0 = 0;
asm nop;
delay();
__Reset_Watchdog;
}
==============================================
this answer is for you. if it helps, please click on "correct answer" button. thanks!
Best Regards,
Zhang Jun