Download 8XC196NT Microcontroller User`s Manual
Transcript
STANDARD AND PTS INTERRUPTS 5.6.6.1 PWM Toggle Mode Example Figure 5-16 shows the PTS control block for PWM toggle mode. To generate a PWM waveform using PWM toggle mode and EPA0, complete the following procedure. This example uses the values stored in CSTORE1 and CSTORE2 to control the frequency and duty cycle of a PWM. 1. Disable the interrupts and the PTS. The DI instruction disables all standard interrupts; the DPTS instruction disables the PTS. 2. Store the on-time (T1) in CSTORE1. 3. Store the off-time (T2 – T1) in CSTORE2. 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. 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 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 FOSC/4, and enables the divide-by-four prescaler) 5-33
Related documents
8XC196Kx, 8XC196Jx, 87C196CA Microcontroller Family
8XC196NP, 80C196NU Microcontroller User`s Manual
8XC196EA Microcontroller User`s Manual
8XC196MC, 8XC196MD, 8XC196MH Microcontroller User`s Manual
8XC196Lx Supplement to 8XC196Kx, 8XC196Jx, 87C196CA User`s
ZapCode II Handbook
87C196JV 20 MHz ADVANCED 16
Introduction to YS1000 Series - YS1000 Series Single Loop Controller
87C196LA SPECIFICATION UPDATE
Intel 8XC196NT Computer Hardware User Manual
8XC196KC SPECIFICATION UPDATE
Cypress CY7C63413C User's Manual