Epa Pwm Output Program - Intel 8XC196K Series User Manual

Table of Contents

Advertisement

time_value = epa0_time; /* must read to prevent overrun */
}
/* To generate have code for the epax interrupt,select the ICU design screen.*/
void init_timer1()
{
t1control = COUNT_ENABLE |
COUNT_UP |
CLOCK_INTERNAL |
DIVIDE_BY_1;
}
void main(void)
{
unsigned int time_value;
/* Initialize the timers and interrupts before using the EPA */
init_timer1();
init_epa0();
enable();
while(1);
}

10.9.3 EPA PWM Output Program

This example C program demonstrates the generation of a PWM signal using the EPA's PWM
toggle mode (see "PWM Modes" on page 5-31) and shows how to service the interrupts with the
PTS. The PWM signal in this example has a 50% duty cycle.
#pragma model(KR)
#include <80c196kr.h>
#define
PTS_BLOCK_BASE
/* Create typedef template for the PWM_TOGGLE mode control block.*/
typedef struct PWM_toggle_ptscb_t {
unsigned char
unsigned char
void
*pts_ptr;
unsigned int constant1;
unsigned int constant2;
} PWM_toggle_ptscb;
/* This locates the PTS block mode control block in register ram. This */
/* control block may be located at any quad-word boundary. */
register PWM_toggle_ptscb PWM_toggle_CB_3;
#pragma locate(PWM_toggle_CB_3=PTS_BLOCK_BASE)
/* The PTS vector must contain the address of the PTS control block.*/
#pragma pts(PWM_toggle_CB_3=0x3)
/*
Globally enable interrupts
/*
loop forever, wait for interrupts to occur */
0x98
unused;
ptscon;
EVENT PROCESSOR ARRAY (EPA)
*/
10-35

Advertisement

Table of Contents
loading

Table of Contents