Intel 8XC196K Series User Manual page 128

Table of Contents

Advertisement

4.
Set up the PTSCB as shown in Table 5-13:
— Load PTSCON with 43H (selects PWM toggle mode, initial TBIT value = 1)
— Set up PTSPTR1 to point to EPA0_TIME (the EPA0 event-time register)
— Load PTSCONST1 with the on-time (T1) from CSTORE1.
— Load PTSCONST2 with the off-time (T2 – T1) from CSTORE2.
5.
Configure P1.0 to serve as the EPA0 output:
— Clear P1_DIR.0 (selects output)
— Set P1_MODE.0 (selects the EPA0 special-function signal)
— Set P1_REG.0 (initializes the output to "1")
6.
Set up EPA0:
— Load EPA0_CON with 0078H (timer 1, compare, toggle output pin, re-enable)
— Load EPA0_TIME with the value in PTSCONST1 (selects T1 as first event time)
— Load T1CONTROL with C2H (enables timer 1, selects up counting at F
enables the divide-by-four prescaler)
7.
Enable the EPA0 interrupt and select PTS service for it:
— Set INT_MASK.4
— Set PTSSEL.4
8.
Enable the interrupts and the PTS. The EI instruction enables interrupts; the EPTS
instruction enables the PTS.
Table 5-13. PWM Toggle Mode PTSCB
PTSCONST2 (HI) = T2 – T1 (HI)
PTSCONST2 (LO) = T2 – T1 (LO)
PTSCONST1 (HI) = T1 (HI)
PTSCONST1 (LO) = T1 (LO)
PTSPTR1 (HI) = 1FH
PTSPTR1 (LO) = 62H
PTSCON = 43H (Mode = 010, TMOD = 1, TBIT = 1)
Unused
STANDARD AND PTS INTERRUPTS
/4, and
OSC
5-33

Advertisement

Table of Contents
loading

Table of Contents