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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/04/08 16:54
Modified:
  01/04/08 16:55

Read: times


 
#149050 - fixed delay
Responding to: ???'s previous message
In 99.9% of programs a delay function is called with a constant parameter; and in 99% of those there are no more than a couple of constants used, and in 99% of those only one or two of them need to be that precise.

In other words, the flexibility of that routine is very rarely justified, it's usually just the laziness of the programmer who wants such delay pre-chewed and easy to use, rather than write one ad-hoc for each case.

Erik Malund said:
However I can think of a few cases where the solution proposed by Russ will apply, for instance in cached processors you will not have to take (possible) cache misses into account.

I don't see the point. I believe the jump-caching processor such as the fast silabs-s and upsd3xxx-s cache the "jmp @a+dptr"-s, too, so you have the same degree of uncertainty in using this method as in a djnz loop.

Only a "linear" set of NOPs inline with the rest of code (no call/ret either) will ensure you deterministic results in a jump-caching processor (or cache exclusions and/or locks, AFAIK the latter is the option for the silabs).

In a "general-caching" processor, there is no hope for precise timing, of course, (except again for cache exclusions or locks).

JW


List of 27 messages in thread
TopicAuthorDate
Number of CPU cycle for 8051 function call            01/01/70 00:00      
   Do it in assembler            01/01/70 00:00      
   Delay functions            01/01/70 00:00      
   A related trick            01/01/70 00:00      
      Offset            01/01/70 00:00      
         Offset            01/01/70 00:00      
            Sure            01/01/70 00:00      
               Over Drive?            01/01/70 00:00      
      a refinement            01/01/70 00:00      
      NOPs are so bad waste of space...            01/01/70 00:00      
         waste of space... waste of time            01/01/70 00:00      
            fixed delay            01/01/70 00:00      
               Variable delay            01/01/70 00:00      
                  determinism of the cache            01/01/70 00:00      
               there are no cache misses in 'linear code'            01/01/70 00:00      
                  I got only ONE cache miss...            01/01/70 00:00      
      Old Keil Thread            01/01/70 00:00      
   What about a Delay like this.            01/01/70 00:00      
      No, it won't.            01/01/70 00:00      
         Ok.            01/01/70 00:00      
         also            01/01/70 00:00      
      Also ...            01/01/70 00:00      
         Actually...            01/01/70 00:00      
            will.            01/01/70 00:00      
               ANSI C            01/01/70 00:00      
                  Keil option: Disable ANSI casts            01/01/70 00:00      
         typo.            01/01/70 00:00      

Back to Subject List