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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/23/04 12:06
Read: times


 
#76279 - RE: Handling the timer
Responding to: ???'s previous message
Further to what the others have said,

You have two techniques of measuring rpm - the way you have described (by counting pulses in a time frame) and the reciprocal method of measuring the timer between two pulses. Both methods generally require the use of a timer.

The problem your code had was that it stuck in a loop within the interrupt routine - not good. What you probably want to do is use an external interrupt input and a timer interrupt.

main:
load timer with 60mS
tick count with 100 (100 * 60mS = 6 secs)
pulse count = 0
loop:
if tick count = 0 then read the pulse count
do calculation
finish.

ext_interrupt:
inc pulse count
reti

timer_interrupt:
reload timer 60mS
if tick count not 0 then dec tick count
reti

It shouldn't be too difficult to convert my psuedo code to assembler (or C for that matter).

As Raghu mentioned - be sure to save A and PSW at a minumum in a interrupt routine.




















List of 9 messages in thread
TopicAuthorDate
Handling the timer            01/01/70 00:00      
   RE: Handling the timer            01/01/70 00:00      
   RE: Handling the timer            01/01/70 00:00      
      RE: Handling the timer            01/01/70 00:00      
         RE: Handling the timer            01/01/70 00:00      
   RE: Handling the timer            01/01/70 00:00      
      RE: Handling the timer            01/01/70 00:00      
   Interrupt discipline...            01/01/70 00:00      
   RE: Handling the timer            01/01/70 00:00      

Back to Subject List