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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/10/03 17:30
Read: times


 
#38722 - RE: is Timer2 unreliable ?
Responding to: ???'s previous message
In order to utilize the TIMER 2 as a counter it must be configured properly. It seems to me that you have it configured as a timer.

Here is a picture of the operational setup you need for operation as a counter. (I stole this out of a Phillips data sheet so I hope they don't mind.) :)



You will use T2EX (P1.1) to control count direction. High level = UP, low level = DOWN.

Your signal upon which you want to count edges will be applied to the T2 (P1.0).

Here is the configuration of the registers to use....

RCAP2L <- 0
RCAP2H <- 0

T2CON <- 086H
------------------------
TF2 = 1 when timer 2 overflows will make a timer 2 interrupt.

EXF2 = 0 do not need capture interrupt

RCLK = 0 not used as serial RX baud rate

TCLK = 0 not used as serial TX baud rate

EXEN2 = 0 disable capture interrupt function

TR2 = 1 allow timer 2 to count input transitions

C/T2 = 1 allow T2 pin to be an input that drives the timer 2 counter.

CP/RL2 = 0 set timer 2 for auto reload mode. make sure to set RCAP2 registers to zero so you get full 16 bit up and down counting.

T2MOD <- 00H
-------------------
DCEN = 0 to permit the T2EX pin to control mode for up & down counting

T2OE = 0 to make sure T2 pin is an input.

This should get it working for you....yout mistake was probably having the C/T2 bit at a zero level.

Michael Karas


List of 19 messages in thread
TopicAuthorDate
is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
      RE: is Timer2 unreliable ?            01/01/70 00:00      
         RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
      RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
      RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?yes!            01/01/70 00:00      
      RE: is Timer2 unreliable ?yes!            01/01/70 00:00      
      RE: is Timer2 unreliable ?yes!            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
   RE: is Timer2 unreliable ?            01/01/70 00:00      
      RE: is Timer2 unreliable - Anders            01/01/70 00:00      

Back to Subject List