Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8xC196EA microcontroller user's manual.1998.pdf
Скачиваний:
52
Добавлен:
23.08.2013
Размер:
8.29 Mб
Скачать

EVENT PROCESSOR ARRAY (EPA)

(T2CONTROL.7 = 1)

Enable Overflow

Timer2

Timer1

(EPA1_CON.0 = 1)

Enable

EPA0

EPA1

A4341-01

Figure 11-7. Generating a 32-bit Time Value

To set up the configuration shown in Figure 11-7, you must program six registers: T1CONTROL, T2CONTROL, TIMER1, TIMER2, EPA0_CON, and EPA1_CON. Bit 0 of EPA1_CON concatenates the EPA channels, and bit 7 of T2CONTROL concatenates the timers. (See “Programming the EPA and Timer/Counters” on page 11-14 for details.)

Once you enable timer 1 by programming the TIMER1 register, timer 1 begins counting and continues until it overflows or underflows. The overflow or underflow triggers timer 2 to count once. Figure 11-8 illustrates how timers 1 and 2 respond to a timer 1 overflow.

t (time)

 

TIMER2

 

 

TIMER1

 

 

 

 

 

 

 

 

 

t0

00

 

03

 

FF

 

FE

t0+1

 

 

 

 

 

 

 

00

 

03

 

FF

 

FF

Overflow

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

t0+2

00

 

04

 

00

 

00

 

 

 

 

 

 

 

 

 

t0+3

00

 

04

 

00

 

01

 

A4361-01

Figure 11-8. Timer 1 Overflow Occurrence

As timer 1 rolls over from FFFFH to 0000H, the overflow causes timer 2 to increment from 0003H to 0004H. Timer 2 retains the 0004H value until the next timer 1 overflow.

11.4.5 Controlling a Pair of Adjacent Pins

The EPA module enables you to configure two capture/compare or output/simulcapture channels to control both their own assigned pin and the adjacent pin. This configuration is called crosscoupling. Figure 11-9 illustrates this configuration using a single pair of capture/compare chan-

11-13

Соседние файлы в предмете Электротехника