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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/12/05 22:46
Read: times


 
#87234 - Obtaining Delays
Responding to: ???'s previous message
Ronan Meere said:
I want to turn the pin high, clear the pin, and set the next pin high etc. Is the code as follows

SETB P2.2
CLR P2.2

SETB P2.3
etc

That is exactly right.

If I want to include a delay between the pins going high, how would I do it. is it like ?,

SETB P2.2
CLR P2.2
Call Delay1

SETB P2.3
CLR P2.3

Possibly

Finally If I want the subroutine [Delay1] to be 25 seconds, how would I code it?


The problem with coding a long delay in a subroutine is that the micro can do nothing else while it is in the delay code. If you allow interrupts then they could delay the delay code so your delays are inaccurate. A better way to create delays is to use a timer interrupt to make your own RTC.

Alternatively you could use a simple time triggered cooperative scheduler to implement a range of delays.

Ian


List of 15 messages in thread
TopicAuthorDate
delays            01/01/70 00:00      
   delay routine ideas            01/01/70 00:00      
      further ideas            01/01/70 00:00      
   change p2 outputs            01/01/70 00:00      
      Bad practice Peter            01/01/70 00:00      
         sorry            01/01/70 00:00      
   Obtaining Delays            01/01/70 00:00      
      Not RTC            01/01/70 00:00      
   it is good!            01/01/70 00:00      
      it is good.            01/01/70 00:00      
         Not so good            01/01/70 00:00      
   Stop wasting our time Meero            01/01/70 00:00      
      pot and kettle            01/01/70 00:00      
         Eric the great.            01/01/70 00:00      
            Erik the great            01/01/70 00:00      

Back to Subject List