Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/03/03 12:42
Read: times


 
#42841 - RE: delay
Responding to: ???'s previous message
unsigned int i;
while(1){
   P2=0xff; //if led is in P2
   for(i=0;i<0xffff;i++);
   P2=0;
}
In 'C', you should always use volatile in dummy delay loops like this!

"this will give an approx. of i sec. delay for an 11.059MHz X-tal"

depending also on the compiler, options (particularly memory model), and probably also the particular 8051 derivative (how many clocks/instruction)

List of 13 messages in thread
TopicAuthorDate
delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
      RE: delay            01/01/70 00:00      
         RE: delay - Saji            01/01/70 00:00      
            RE: delay - Raghu            01/01/70 00:00      
         RE: delay            01/01/70 00:00      
            RE: delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
   RE: delay            01/01/70 00:00      
      RE: Running lights            01/01/70 00:00      

Back to Subject List