- This topic has 10 replies, 10 voices, and was last updated 8 years, 2 months ago by .
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › 1 ms delay calculation
why we put 1275 in for loop for 1 ms …. crystal frequency is 11.0592 Mhz?
i need clear answer….
because this value give almost 1ms delay ..
let if we use 11.0592MHz crystal ..
u know 8051 takes 12 pulses for 1 machine cycle
then period of one machine cycle would be
11.0592MHz/12 = 921.6KHz
t = 1/f
so time period of one machine cycle = 1/ 921.6KHz = 1.085us
now when u run loop of 1275..
delay would be 1275×1.085us = 1.3ms
practically this value gives delay of almost 1ms…
correct me ……..
regards
i am trying to develop a 40 khz 10 volt pek to peak square pulse. during this process is that 1.3 ms to 1 ms approximation will not create a problem.????
my english is not good enough. so plz ignore the grammatical mistakes in the problem statement.
@ saptarshi mukherjee you can use timer for generation of delay. for 40 khz time=1/40000 so 25 micro second. you can find 8051 timer calculator by googling.
i have solved that problem. thanks.
how to convert a received voltage at port 0 to a digital data. i need the c code for adc converter.
max=val; (variable with 8 bit data type)
for two digit , three digit use the i value for example,
three digit
for(i=0;i<=2;i++)
{
temp=max/10;
max=max%10;
}
but we can get exact 1ms by using msdelay(921)……..
Hi,
Timer is the best way, any inbuilt function can’t give proper delay always.
Why is that value 1275 is considered specifically?
Please clarify this.
any how it is very hard to get exact delay upto few micro seconds (10us to 20us) in micro controllers
in C language it will be even more worst. getting exact delay is not an easy task with timers also in C language
u hv to allow some provision
agreed with Ajish