piyush manavar
Member level 4

hi
i am working with 8051 core uc p89v51rx2 from NXP.
for this i developed a code for delay in ms is
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<53;j++);
}
in which unsigned int ms is the no. that much ms delay generated by this loop.
but problem is that is not gives proper delay.
it is approx half of my actual calculated value.
i don't know where is the problem.
i am using 11.0592 MHz crystal and 12 clock cycle/Machine cycle mode.
as per my calculation the second for loop int is 53 but i think it is wrong.
please help me to figure out it...
thanks.
-Piyush
i am working with 8051 core uc p89v51rx2 from NXP.
for this i developed a code for delay in ms is
void delay_ms(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<53;j++);
}
in which unsigned int ms is the no. that much ms delay generated by this loop.
but problem is that is not gives proper delay.
it is approx half of my actual calculated value.
i don't know where is the problem.
i am using 11.0592 MHz crystal and 12 clock cycle/Machine cycle mode.
as per my calculation the second for loop int is 53 but i think it is wrong.
please help me to figure out it...
thanks.
-Piyush