Programming Examples For Epa Channels; Epa Compare Event Program - Intel 8XC196K Series User Manual

Table of Contents

Advertisement

10.9 PROGRAMMING EXAMPLES FOR EPA CHANNELS

The three programming examples provided in this section demonstrate the use of the EPA channel
for a compare event, for a capture event, and for generation of a PWM signal. The programs dem-
onstrate the detection of events by a polling scheme, by interrupts, and by the PTS. All three ex-
amples were created using ApBUILDER, an interactive application program available through
Intel Literature Fulfillment or the Intel Applications Bulletin Board system (BBS). See Chapter
1, "Guide to This Manual," for information about ordering information from Intel Literature and
downloading files from the BBS. These sample program were written in the C programming lan-
guage. ASM versions are also available from ApBUILDER.
The initialization file (80c196kr.h) used in these examples is available from
the Intel Applications BBS.

10.9.1 EPA Compare Event Program

This example C program demonstrates an EPA compare event. It sets up EPA channel 0 to toggle
its output pin whenever timer 1 is zero. This program uses no interrupts; a polling scheme detects
the EPA event. The program initializes EPA channel 0 for a compare event.
#pragma model(KR)
#include <80c196kr.h>
#define
COMPARE
#define
RE_ENABLE
#define
TOGGLE_PIN
#define
USE_TIMER1
#define
EPA0_INT_BIT
void init_epa0()
{
epa0_con = COMPARE |
TOGGLE_PIN|
RE_ENABLE |
USE_TIMER1;
epa0_time = 0;
setbit(p1_reg, 0); /*
clrbit(p1_dir, 0); /*
setbit(p1_mode, 0);/*
}
void init_timer1()
{
t1control = COUNT_ENABLE |
COUNT_UP |
CLOCK_INTERNAL |
DIVIDE_BY_1;
}
NOTE
0x40
0x08
0x30
0x00
47
int reg
*/
make output pin
*/
select EPA mode
*/
EVENT PROCESSOR ARRAY (EPA)
10-33

Advertisement

Table of Contents
loading

Table of Contents