![Intel 8XC196NT Скачать руководство пользователя страница 247](http://html1.mh-extra.com/html/intel/8xc196nt/8xc196nt_user-manual_2072210247.webp)
8XC196NT USER’S MANUAL
10-14
10.4.2.1
Generating a Low-speed PWM Output
You can generate a low-speed, pulse-width modulated output with a single EPA channel and a
standard interrupt service routine. Configure the EPA channel as follows: compare mode, toggle
output, and the compare function re-enabled. Select standard interrupt service, enable the EPA
interrupt, and globally enable interrupts with the EI instruction. When the assigned timer/counter
value matches the value in the event-time register, the EPA toggles the output pin and generates
an interrupt. The interrupt service routine loads a new value into EPAx_TIME.
The maximum output frequency depends upon the total interrupt latency and the interrupt-service
execution times used by your system. As additional EPA channels and the other functions of the
microcontroller are used, the maximum PWM frequency decreases because the total interrupt la-
tency and interrupt-service execution time increases. To determine the maximum, low-speed
PWM frequency in your system, calculate your system's worst-case interrupt latency and worst-
case interrupt-service execution time, and then add them together. The worst-case interrupt la-
tency is the total latency of all the interrupts (both normal and PTS) used in your system. The
worst-case interrupt-service execution time is the total execution time of all interrupt service rou-
tines and PTS routines.
The following example shows the calculations for a system that uses a single EPA channel, a sin-
gle enabled interrupt, and the following interrupt service routine.
;If EPA0-3 interrupt is generated
EPA0-3_ISR:
PUSHA
LD EPA
x
_CON, #toggle_command
ADD EPA
x
_TIME, TIMER
x
, [next_duty_ptr]; Load next event time
POPA
RET
;If EPA
x
interrupt is generated from EPA4-9 interrupts
EPA
x
_ISR:
PUSHA
LD jtbase_ptr, #LSW jtbase1
LD epaipv_ptr, EPAIPV
; Load contents of EPAIPV reg into ptr
TIJMP jtbase_ptr,[epaipv_ptr],7FH ; Jump to appropriate EPA ISR
;EPA4-9 service routines
EPA4-9_ISR:
PUSHA
LD EPA
x
_CON, #toggle_command
ADD EPA
x
_TIME,TIMER
x
,[next_duty_ptr]
LJMP EPA
x
_DONE
EPA
x
_DONE:
POPA
RET
Содержание 8XC196NT
Страница 1: ...8XC196NT Microcontroller User s Manual...
Страница 2: ...8XC196NT Microcontroller User s Manual June 1995 Order Number 272317 003...
Страница 22: ...1 Guide to This Manual...
Страница 23: ......
Страница 35: ......
Страница 36: ...2 Architectural Overview...
Страница 37: ......
Страница 49: ......
Страница 50: ...3 Programming Considerations...
Страница 51: ......
Страница 66: ...4 Memory Partitions...
Страница 67: ......
Страница 104: ...5 Standard and PTS Interrupts...
Страница 105: ......
Страница 147: ......
Страница 148: ...6 I O Ports...
Страница 149: ......
Страница 176: ...7 Serial I O SIO Port...
Страница 177: ......
Страница 194: ...8 Synchronous Serial I O SSIO Port...
Страница 195: ......
Страница 211: ......
Страница 212: ...9 Slave Port...
Страница 213: ......
Страница 231: ......
Страница 232: ...10 Event Processor Array EPA...
Страница 233: ......
Страница 270: ...11 Analog to digital Converter...
Страница 271: ......
Страница 291: ......
Страница 292: ...12 Minimum Hardware Considerations...
Страница 293: ......
Страница 306: ...13 Special Operating Modes...
Страница 307: ......
Страница 317: ......
Страница 318: ...14 Interfacing with External Memory...
Страница 319: ......
Страница 362: ...15 Programming the Nonvolatile Memory...
Страница 363: ......
Страница 408: ...A Instruction Set Reference...
Страница 409: ......
Страница 476: ...B Signal Descriptions...
Страница 477: ......
Страница 493: ......
Страница 494: ...C Registers...
Страница 495: ......
Страница 565: ......
Страница 566: ...Glossary...
Страница 567: ......
Страница 580: ...Index...
Страница 581: ......
Страница 597: ......