chethankp
Member level 4
Hi,
I am using 89V51RD2 for some application .. I need to write delay code which can take create micro second delay ..
I wrote the below code
void delayMicroseconds(unsigned int i)
{
for(j=0;j<=i;j++)
{
for(k=0;k<256;k++);
}
}
But I do not think this is giving correct micro second delay .
Someone suggested to use the micro time for delay ..
I did not understand how exactly I can use the timer for it .
becoz I need to use the delayMicroseconds() from many places with different values .
like
delayMicroseconds(1);
delayMicroseconds(10)
delayMicroseconds(25)
Can somebody suggest a method to get exact micro second delay ..
?
I am using 89V51RD2 for some application .. I need to write delay code which can take create micro second delay ..
I wrote the below code
void delayMicroseconds(unsigned int i)
{
for(j=0;j<=i;j++)
{
for(k=0;k<256;k++);
}
}
But I do not think this is giving correct micro second delay .
Someone suggested to use the micro time for delay ..
I did not understand how exactly I can use the timer for it .
becoz I need to use the delayMicroseconds() from many places with different values .
like
delayMicroseconds(1);
delayMicroseconds(10)
delayMicroseconds(25)
Can somebody suggest a method to get exact micro second delay ..
?