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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/16/03 12:24
Read: times


 
#56747 - RE: TIMER HELP
Responding to: ???'s previous message
Dobrica:
It appears that you have been given some good suggestions by the others above. I would certainly learn about the use of ring buffers for the serial I/O interrupt such as Andy recommended. Another link to see both a timer and serial interrupt coded in assembly language is to look at my Loader Code.

The use of the ring buffered serial I/O allows a degree of decoupling between the actual serial transmission process, the timer interrupt "RTC" function, and the main activity of your program that accumulates the serial input, tags it with the timestamp from the RTC and writes to the eeprom.

Do keep in mind that the RTC is multi-byte data and there will need to be care used in how you access the multiple bytes for a creating the time stamp. If there is any chance that the timer interrupt can occur between the multi-accesses to the RTC data then that data can change. Thus you must look at disabling interrupts for a short space of time while you access the Hour, Minute, and Second (for example) so that the values of all the variables are valid with respect to one another. Here is an example of what could happen if this was not done:

Say that HH:MM:SS.ms was equal to 08:59:59.99 and your time stamp routine would have just fetched the hours value of 08 when a surprise timer interrupt comes along. The interrupt changes the variables to 09:00:00.00 and after leaving the ISR the timestamp code continues reading the minutes and seconds as the updated values. The time stamp would be put together as 08:00:00 which of course is wrong. This is prevented by disabling interrupts for a short period whilest the HH, MM, and SS values are quickly moved into say three registers such as R3, R4 and R5. After interrupts are re-enabled the timestamp is then composed from the values of the register bytes and the timer interrupt is free to come along and do its thing with the RTC hours, minutes....msec values.

Michael Karas


List of 41 messages in thread
TopicAuthorDate
TIMER HELP            01/01/70 00:00      
   RE: TIMER HELP            01/01/70 00:00      
   RE: TIMER HELP            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
         RE: TIMER HELP            01/01/70 00:00      
            RE: TIMER HELP            01/01/70 00:00      
               RE: TIMER HELP            01/01/70 00:00      
                  RE: TIMER HELP            01/01/70 00:00      
               RE: TIMER HELP            01/01/70 00:00      
   RE: TIMER HELP            01/01/70 00:00      
      Timer interrupt response (LONG)            01/01/70 00:00      
         RE: Timer interrupt response (LONG)            01/01/70 00:00      
            RE: Timer interrupt response (LONG)            01/01/70 00:00      
            RE: Timer interrupt response (PS)            01/01/70 00:00      
         RE: Timer interrupt response (LONG)            01/01/70 00:00      
            RE: Timer interrupt response (LONG)            01/01/70 00:00      
               RE: Timer interrupt response (LONG)            01/01/70 00:00      
            RE: Timer interrupt response (LONG)            01/01/70 00:00      
               RE: Timer interrupt response (LONG)            01/01/70 00:00      
                  RE: Timer interrupt response (LONG)            01/01/70 00:00      
                     RE: Timer interrupt response (LONG)            01/01/70 00:00      
                        RE: Timer interrupt response (LONG)            01/01/70 00:00      
                           RE: Timer interrupt response (LONG)            01/01/70 00:00      
                  RE: Timer interrupt response (LONG)            01/01/70 00:00      
               RE: Timer interrupt response (LONG)            01/01/70 00:00      
            RE: Timer interrupt response (LONG)            01/01/70 00:00      
   RE: TIMER HELP            01/01/70 00:00      
   RE: TIMER HELP            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
         RE: TIMER HELP            01/01/70 00:00      
            RE: TIMER HELP            01/01/70 00:00      
               RE: TIMER HELP            01/01/70 00:00      
                  RE: TIMER HELP            01/01/70 00:00      
                     RE: Acrobat....            01/01/70 00:00      
                        RE: Acrobat....            01/01/70 00:00      
                           RE: Acrobat....            01/01/70 00:00      
      RE: TIMER HELP            01/01/70 00:00      
         INTERRUPT HELP            01/01/70 00:00      

Back to Subject List