![Rabbit Rabbit 4000 User Manual Download Page 253](http://html1.mh-extra.com/html/rabbit/rabbit-4000/rabbit-4000_user-manual_3116714253.webp)
Chapter 23 Pulse Width Modulator
243
23.3 Operation
The following steps explain how to set up a PWM channel.
1. Configure Timer A9 via TAT9R to provide the desired PWM clock frequency.
2. Configure PWLxR to select whether to spread the PWM output throughout the cycle.
3. Configure PWLxR to select whether to suppress the PWM output.
4. Configure the duty cycle by writing to PWLxR and PWMxR.
23.3.1 Handling Interrupts
The following steps explain how an interrupt is set up and used.
1. Write the vector to the interrupt service routine to the internal interrupt table.
2. Configure PWL0R to select the PWM interrupt priority and PWL1R to select PWM
interrupt suppression (if an interrupt is desired).
The following actions occur within the interrupt service routine.
•
Any PWM values may be updated.
•
The interrupt request should be cleared by writing to any PWM register.
23.3.2 Example ISR
A sample interrupt handler is shown below.
pwm_isr::
push af ; save used registers
ld a, 0x55
ioi ld (PWM0R), a ; update a PWM value
; note that interrupt request is also cleared by register write above
pop af ; restore used registers
ipres
ret
Summary of Contents for Rabbit 4000
Page 1: ...Rabbit 4000 Microprocessor User s Manual 019 0152 070720 H...
Page 18: ...8 Rabbit 4000 Microprocessor User s Manual...
Page 40: ...30 Rabbit 4000 Microprocessor User s Manual...
Page 74: ...64 Rabbit 4000 Microprocessor User s Manual...
Page 82: ...72 Rabbit 4000 Microprocessor User s Manual...
Page 86: ...76 Rabbit 4000 Microprocessor User s Manual...
Page 96: ...86 Rabbit 4000 Microprocessor User s Manual...
Page 182: ...172 Rabbit 4000 Microprocessor User s Manual...
Page 240: ...230 Rabbit 4000 Microprocessor User s Manual...
Page 248: ...238 Rabbit 4000 Microprocessor User s Manual...
Page 256: ...246 Rabbit 4000 Microprocessor User s Manual...
Page 310: ...300 Rabbit 4000 Microprocessor User s Manual...
Page 330: ...320 Rabbit 4000 Microprocessor User s Manual...
Page 348: ...338 Rabbit 4000 Microprocessor User s Manual...