Ali250
Newbie level 1
- Joined
- May 17, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 11
Hello all.
Concisely put, I need to measure the width of a pulse using the timer on AT89C52. The maximum width of the pulse will be 25ms so I figured I could easily use the 16-bit mode and measure the entire pulse at once without the timer overflowing. The thing is I'd like to start and stop the timer externally since I'm doing a couple of other tasks as well.
From what I learned, I thought all I needed to do was set TR0 in TCON and the gate bit for timer 0 in TMOD and that would cause the timer would start as soon as the INT0 pin turned low (since its INT0-bar in 8052). But it isn't working like that in my Proteus simulation. Later on I tried enabling IE.7 as well thinking I might need to enable the interrupts for this to work but that didn't work either.
NOTE: I DO NOT want to check for overflow. I just want to to know how to start and stop the timer based on an external input without constantly polling it.
Thanks in advance.
Concisely put, I need to measure the width of a pulse using the timer on AT89C52. The maximum width of the pulse will be 25ms so I figured I could easily use the 16-bit mode and measure the entire pulse at once without the timer overflowing. The thing is I'd like to start and stop the timer externally since I'm doing a couple of other tasks as well.
From what I learned, I thought all I needed to do was set TR0 in TCON and the gate bit for timer 0 in TMOD and that would cause the timer would start as soon as the INT0 pin turned low (since its INT0-bar in 8052). But it isn't working like that in my Proteus simulation. Later on I tried enabling IE.7 as well thinking I might need to enable the interrupts for this to work but that didn't work either.
NOTE: I DO NOT want to check for overflow. I just want to to know how to start and stop the timer based on an external input without constantly polling it.
Thanks in advance.