| ??? 04/27/00 19:42 Read: times |
#2375 - RE: T0 Count Frequency |
Allen,
Fine, but I wasn't going to set the timer2 into usual mode. I'd better set it into Clock-Out mode. The following a bit of text is taken out of the very Atmel Data Sheet you quoted. "Baud Rate Generator ...Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode, as shown in Figure 4.The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate according to the following equation. The Timer can be configured for either timer or counter operation. In most applications, it is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). AS A BAUD RATE GENERATOR, HOWEVER, IT INCREMENTS EVERY STATE TIME (AT 1/2 THE OSCILLATOR FREQUENCY). Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode, TH2 or TL2 should not be read from or written to. Under these conditions, the Timer is incremented every state time, and the results of a read or write may not be accurate. The RCAP2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers." And some more text: "Programmable Clock Out A 50% duty cycle clock can be programmed to come out on P1.0, as shown in Figure 5. This pin, besides being a regular I/O pin, has two alternate functions. IT CAN BE PROGRAMMED TO INPUT THE EXTERNAL CLOCK FOR TIMER/COUNTER 2 or to output a 50% duty cycle clock ranging FROM 61 HZ TO 4 MHZ AT A 16 MHZ OPERATING FREQUENCY." So I can use pin P1.0 (T2) to input external clock i.e. frequency for measuring (in our case) and running and stopping the timer2 by bit TR2. Please explain me this situation. George |
| Topic | Author | Date |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
| RE: T0 Count Frequency | 01/01/70 00:00 | |
RE: T0 Count Frequency | 01/01/70 00:00 |



