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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/28/05 23:27
Read: times


 
#86075 - It must be XCH !
Responding to: ???'s previous message
@Erik,

please look carefully on the code, it is secure under all circumstances.

Assuming long delay on interrupts of higher priority is irrelevant, since then never a stable reading can be reached. It place no role, if you stop the timer delayed or read the timer delayed.
The higest priority must always be reserved for this software capture routine, otherwise only a hardware capture unit (PCA) can be used.


"...the TL will always be at some low value"

No !
Any value is possible, because I measure an external event.


And the trick with the XCH is very important.
If you read the low byte with MOV and get 0xFF, then you can be sure, that the high byte was advanced and thus the high byte was wrong. On reading FE, FD or so, the high byte can be wrong or maybe not.

But on using XCH the high byte contain always the correct value !

Since an overflow occur only on counting FF->00, but never on loading 00 into the low byte regardless the state prior loading.

Thus only loading and reading at the same cycle (XCH) catch the cow.


I tested it verbose, without XCH you get flickering results.


Peter


List of 30 messages in thread
TopicAuthorDate
help with duty cycle measurement            01/01/70 00:00      
   woefully incomplete            01/01/70 00:00      
      Definitions            01/01/70 00:00      
         gobbelygook            01/01/70 00:00      
   Routines            01/01/70 00:00      
   sorry for the gobbelygook            01/01/70 00:00      
      A job for the PCA?            01/01/70 00:00      
      now that is clear            01/01/70 00:00      
      4 errors found in your smt_1.asm pgm            01/01/70 00:00      
         maybe only 3            01/01/70 00:00      
   cannot change            01/01/70 00:00      
   SMT160 example code in C            01/01/70 00:00      
      why            01/01/70 00:00      
         It is absolute necessary !            01/01/70 00:00      
            on the fly            01/01/70 00:00      
               Thus I use assembler !            01/01/70 00:00      
                  not assembler but int            01/01/70 00:00      
                     It must be XCH !            01/01/70 00:00      
                        still wrong to read with running            01/01/70 00:00      
                           not wrong, since it is tested !            01/01/70 00:00      
                              OK            01/01/70 00:00      
            Thanks to all            01/01/70 00:00      
   Thanks Peter            01/01/70 00:00      
      Do some simple tests first            01/01/70 00:00      
         Problem solved But            01/01/70 00:00      
   Modified code and mistakes            01/01/70 00:00      
   smt160.asm example            01/01/70 00:00      
      Thanks for example            01/01/70 00:00      
   Please explain            01/01/70 00:00      
      Yes            01/01/70 00:00      

Back to Subject List