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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/03/01 14:00
Read: times


 
#12151 - RE: Interrupt service routine
Hello Jacek,

first thing I ask myself looking at your code is: do you reset the hardwaretimer before starting it? I don't find it back in your program. If you stop the counter and restart it without resetting, it will count from were it was stopped....so your results are worthless.

So you can extend your code like this to be sure the timer starts at zero:

IRQEX1:
CLR TH0
CLR TL0
SETB TR0 ;starts timer 0
SET after_ex1
RETI

Although it is better to clear the timer just after using its countvalue by the displayroutine, so you don't lose time in the interruptroutine and your measuring will be more accurate.

A second possebility: your pulseduration is to long for the resolution of the counter by your specific crystal fryquency, so the timer overflows.... Solution: use other Crystal frequency.


You asked:
can I clear EX1 bit during interrupt service routine?

Yes you can, and it is often done.

Henk


List of 3 messages in thread
TopicAuthorDate
Interrupt service routine            01/01/70 00:00      
RE: Interrupt service routine            01/01/70 00:00      
RE: Interrupt service routine            01/01/70 00:00      

Back to Subject List