We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I would like to know how can i use delays in my program as there is no inbuilt delay for 89c2051. i want to know how can i decide delay timing when I am using 12 MHZ external crystal
With the 89c2051 running at 12MHz, one instruction cycle is 1us.
So you can write a delay in assembler using a multiple of instructions to build the time you require.
Use a loop if you want it longer.
Hello Auther actually i am using C for programming .I am giving here smple code function for delay will it work?
void delay(unsigned int d_time) { unsigned int i,k=0; while(k<d_time) { for (i=0 ; i<=1000; i++); k++; } }
That depends on what you mean by "work"...?
In terms of giving a predictable delay, NO - it will not work!
The reason - and the solution - is given here: www.8052.com/.../162556
If you do continue to do this in 'C', you should declare the loop counter as volatile