The code is below, it run perfectly when i run it step by step during debugging. But when i run it continuously it stuck somewhere after executing the ISR.
Is there any mistake i done?
please give suggestion if i done any.
Thank you.
#include <REGX51.H> sbit motof = P2^0; sbit motob = P2^1; void timer2() { TH0 = 0xff; TL0 = 0xfd; TR0 = 1; while(TF0 == 0); TR0 = 0; TF0 = 0; } void msdelay(unsigned char ms) { int i; for(i=0;i<=ms;i++) timer2(); } void ser() interrupt 4 { char j; while(RI == 0); j = SBUF; RI = 0; if(j=='f') { motof = 0; motob = 0; msdelay(10); motob = 1; msdelay(10); } if(j=='r') { motob = 0; motof = 1; msdelay(10); motof = 0; msdelay(10); } } void main() { SCON = 0x50; TMOD = 0x21; TH1 = 0xFD; TR1 = 1; IE = 0x90; while(1) { motob = 0; motof = 0; msdelay(10); motof = 1; msdelay(10); } }