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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/06 13:39
Read: times


 
#122659 - check timer 2
Responding to: ???'s previous message
You want to measure how long is some pulse.
What resolution You need and what is max lenght?
Read Timer2 (89c52) description.
Timer 1 or 0 can be used too in combination with interrupts.
For example :
- connect int1' and int0' to signal.
- At start interrupts and timers are disabled.
- int1' will be used as gate control for timer1
- whait while signal goes low(incative)
- set timer1 to count internal freqwency ,when
pin INT1' is high, enable ET1 and EX0.
Now - when signal goes high timer1 will count up,
if signal is longer than 65535 cycles -then there will be some interrupts (ET1 is enabled) - count number of these in
variable OVER1.
When signal goes inactive(low) -
timer will stop counting automaticaly, enabled INT0'
will generate interrupt - in service routine read contents
of TH1,TL1 (16 bits word).
You are ready - length of impulse is OVER1*65536+TH1TL1 ,
expressed in timer1 cycles (check datasheet for relation
with XTAL).

regards



This can help.
regards

List of 3 messages in thread
TopicAuthorDate
interrupts and counters            01/01/70 00:00      
   check timer 2            01/01/70 00:00      
   use the PCA            01/01/70 00:00      

Back to Subject List