Intel 8XC196MC, 8XC196MD, 8XC196MH Programming the Capture/Compare Channels, Mode WGR ROT ON/RT

Models: 8XC196MD 8XC196MH 8XC196MC

1 579
Download 579 pages 24.12 Kb
Page 257
Image 257

8XC196MC, MD, MH USER’S MANUAL

11.5.3 Programming the Capture/Compare Channels

The EPAx_CON register controls the function of its assigned capture/compare channel. The reg- isters are identical with the exception of bit 2. For EPA channels 0, 2, and 4, setting this bit enables an EPA event to cause a waveform generator reload. For EPA channels 1, 3, and 5, setting this bit enables an EPA event to cause an A/D conversion. To program a compare event, always write to EPAx_CON (Figure 11-10) first to configure the EPA capture/compare channel, and then load the event time into EPAx_TIME. To program a capture event, you need only write to EPAx_CON. Table 11-6 shows the effects of various combinations of EPAx_CON bit settings for channels 1, 3, or 5.

Table 11-6. Example EPA Control Register Settings for Channels 1, 3, or 5

Capture Mode

TB

CE

MODE

RE

WGR

ROT

ON/RT

 

 

/AD

 

Operation

 

 

 

 

 

 

 

 

7

6

5

4

3

2

1

0

 

 

X

0

0

0

0

 

None

X

0

0

1

X

X

X

 

Capture on falling edges

X

0

1

0

X

X

X

 

Capture on rising edges

X

0

1

1

X

X

X

 

Capture on both edges

X

0

X

1

X

1

X

 

Capture on falling edge and reset opposite timer

X

0

1

X

X

1

X

 

Capture on rising edge and reset opposite timer

X

0

0

1

1

X

X

 

Start A/D conversion (EPA1, 3, 5) or reload

 

 

 

 

 

 

 

 

 

waveform generator (EPA0, 2, 4) on falling edge

X

0

1

0

1

X

X

 

Start A/D conversion (EPA1, 3, 5) or reload

 

 

 

 

 

 

 

 

 

waveform generator (EPA0, 2, 4) on rising edge

 

 

 

 

 

 

 

Compare Mode

 

 

 

 

 

 

 

 

 

 

TB

CE

MODE

RE

WGR

ROT

ON/RT

 

 

/AD

 

Operation

 

 

 

 

 

 

 

 

7

6

5

4

3

2

1

0

 

 

X

1

0

0

X

0

 

None

X

1

0

0

X

0

X

0

 

Generate interrupt only (software timer)

X

1

0

1

X

X

X

X

 

Clear output pin

X

1

1

0

X

X

X

X

 

Set output pin

X

1

1

1

X

X

X

X

 

Toggle output pin

X

1

X

X

X

X

0

1

 

Reset reference timer

X

1

X

X

X

X

1

1

 

Reset opposite timer

X

1

X

X

X

1

X

X

 

Start A/D conversion (EPA1, 3, 5) or reload

 

 

 

 

 

 

 

 

 

waveform generator (EPA0, 2, 4)

NOTES:

1.— = bit is not used

2.X = bit may be used, but has no effect on the described operation. These bits cause other operations to occur.

11-18

Page 257
Image 257
Intel 8XC196MC manual Programming the Capture/Compare Channels, Example EPA Control Register Settings for Channels 1, 3, or