Epa Capture Event Program - Intel 8XC196K Series User Manual

Table of Contents

Advertisement

8XC196K x , J x , CA USER'S MANUAL
void poll_epa0()
{
if(checkbit(int_pend, EPA0_INT_BIT))
{
/*
User code for event channel 0 would go here. */
/*
Since this event is absolute and re-enabled, no polling is neccessary.*/
clrbit(int_pend, EPA0_INT_BIT);
}
}
void main(void)
{
/* Initialize the timers before using the epa */
init_timer1();
init_epa0();
/*
EPA events can be serviced by polling int_pend
or epa_pend.
while(1)
{
poll_epa0();
}
}

10.9.2 EPA Capture Event Program

This example C program demonstrates an EPA capture event. It sets up EPA channel 0 to capture
edges (rising and falling) on the EPA0 pin. The program also shows how to set up the EPA inter-
rupts. You can add your own code for the interrupt service routine.
#pragma model(KR)
#include <80c196kr.h>
#define
COUNT_ENABLE
#define
COUNT_UP
#define
CLOCK_INTERNAL
#define
DIVIDE_BY_1
#define
CAPTURE
#define
BOTH_EDGE
#define
USE_TIMER1
#define
EPA0_INT_BIT
void init_epa0()
{
epa0_con = CAPTURE |
BOTH_EDGE |
USE_TIMER1;
setbit(p1_reg, 0);
setbit(p1_dir, 0);
setbit(p1_mode, 0);
setbit(int_mask, EPA0_INT_BIT);
}
#pragma interrupt(epa0_interrupt=EPA0_INT_BIT)
void epa0_interrupt()
{
unsigned int time_value;
10-34
*/
0x80
0x40
0x00
0x00
0x00
0x30
0x00
4
/*
int reg
*/
/*
make input pin
/*
select EPA mode
/*
*/
*/
unmask EPA interrupts
*/

Advertisement

Table of Contents
loading

Table of Contents