This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

serial port data/constant delay

Hi

I m recieving the serial port data by using the scanf command and then running a loop for inserting the delay

the character got from serial port will determeine the delay

But the problem i m facing is that though the data recieved from serial port changes but the delay remains constant...... to change the delay i have to reburn the prog...

My program is

#include<reg51.h>
#include<stdio.h>
#include<ctype.h>

sbit P10=P1^0;
int k;

/* Inser delay*/

void delay()
int i,j;
P2=k;

for(i=0;i<1;i++)
{
for(j=o;j<k;j++)
{
i=i;
}
}
}

void main (void)

int j;
char ch, i;
P1=0;
#ifndef MONITOR51
SCON=0x50;
TCON=0X40;
TMOD |=0X20;
TH1=253;
TR1=1;
TI=1;
#endif

while (1)

{
scanf("%c",ch);
i=SBUF;
K=toint(i)
P10=0;
delay();
P10=1;
delay();
}
}

Any one who can help me in debigguging the problem