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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/28/05 11:54
Modified:
  07/28/05 12:09

Read: times


 
#98339 - the point
Responding to: ???'s previous message
That being said...how would one go about calculating exactly how many machine cycles
The point is that if you use defensive coding practices (in this case auto-reload) you do not need to calculate cycles.
If, indeed, you want to know a timing, set a bit at entry and reset it at exit, then use a scope. This method has the advantage over "cycle counting" that you can see the jitter caused by the decisions taken inside the ISR. If you do not have a scope, but use a chip with an unused timer or PCA, you can use that to count and read it in the ICE. Using e.g. Keils sim has one disadvantage which is that you do not have the real environment for taking the various routes the decisions inside the ISR will cause.

Counting cycles can be dangerous if you depend on the cycle count being small enough for something else to fumnction. A small change or upgrading the compiler can make the whole house of cards fall. I recall a case where I did something somewhere and something else fell apart. It turned out to be something "cycle count critical". There is no way you can avoid being cycle count sensitive, the point is to reduce that sensitivity.

Erik

If you want to see an example of a dramatically decision bound ISR have a look at the ISR for a hardware IIC

List of 53 messages in thread
TopicAuthorDate
Pulse Width Modulation Code..giving back            01/01/70 00:00      
   Something else weird            01/01/70 00:00      
      Not Weird            01/01/70 00:00      
         Thanks, good to know.            01/01/70 00:00      
            hexmap, AT89C4051            01/01/70 00:00      
         To be more precise...            01/01/70 00:00      
   Delay ?            01/01/70 00:00      
      Other suggestions?            01/01/70 00:00      
         maybe            01/01/70 00:00      
            Timer ISR Pretty Long            01/01/70 00:00      
               Or simpler ...            01/01/70 00:00      
               not really            01/01/70 00:00      
   Ridicule            01/01/70 00:00      
   this may work!! try out...            01/01/70 00:00      
      Wrong !            01/01/70 00:00      
         my loop for >256 itterations            01/01/70 00:00      
            That's nice, but still ...            01/01/70 00:00      
               no            01/01/70 00:00      
   Using port read backs            01/01/70 00:00      
   Thanks... and some basic timer concepts            01/01/70 00:00      
      some answers            01/01/70 00:00      
         timekeeping            01/01/70 00:00      
            plerase quote everything            01/01/70 00:00      
               bloated ISR?            01/01/70 00:00      
                  This is a nice little bug that show up            01/01/70 00:00      
                     Yes but            01/01/70 00:00      
                        experience... or ....            01/01/70 00:00      
                           What is Erik's 8052 University?            01/01/70 00:00      
                              http://www.8052.com/forum/read.phtml?id=            01/01/70 00:00      
                     well            01/01/70 00:00      
                        Ah but...            01/01/70 00:00      
                        Is that a valid design criteria. Should            01/01/70 00:00      
                     use it later            01/01/70 00:00      
                        based on your post above that includes y            01/01/70 00:00      
                           Try it! (Curious myself) :-)            01/01/70 00:00      
         Still a bit confused            01/01/70 00:00      
            not quite complete            01/01/70 00:00      
               256 cycles            01/01/70 00:00      
                  youn are absolutotally missing the point            01/01/70 00:00      
                     Not a bug at all!            01/01/70 00:00      
                        which will not happen            01/01/70 00:00      
                           who's afraid of the wolf...            01/01/70 00:00      
                              crying wolf once bitten            01/01/70 00:00      
                                 you restriction...            01/01/70 00:00      
                                    Cynicism            01/01/70 00:00      
                                    more widespread among Pascal and C users            01/01/70 00:00      
                              Calculating machine cycles            01/01/70 00:00      
                                 Counting machine cycles            01/01/70 00:00      
                                 Use Keil or JSIM tools            01/01/70 00:00      
                                 the point            01/01/70 00:00      
   PWM with 8051            01/01/70 00:00      
      Some debugging is required            01/01/70 00:00      
NOTICE: Message(s) moved            01/01/70 00:00      

Back to Subject List