Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
© 2010 Microchip Technology Inc. Preliminary DS39735A-page 47-23
Section 47. Motor Control PWM
Motor Control
PWM
47
Equation 47-1 and Equation 47-2 show the formulas to determine the PWM period.
Equation 47-1: PWM Period Calculation for Free-Running Count Mode
(PTMOD = 00 or 01)
Figure 47-4: PWM Period Buffer Updates in Up/Down Counting Modes
Equation 47-2: PWM Period Calculation in Up/Down Counting Modes
(PTMOD = 10 or 11)
P1TPER =
F
PWM × (P1TMR Prescaler)
FCY
1
F
CY = 16 MHz
F
PWM = 20,000 Hz
P1TMR Prescaler = 1:1
P1TPER =
20,000 × 1
16,000,000
1
= 800 -1
= 799
Example:
New PxTPER Value
New Value Written to PxTPER Buffer
PxTMR Value
Period Value Loaded from PxTPER Buffer Register
Old PxTPER Value
P1TPER =
F
PWM × (P1TMR Prescaler) × 2
F
CY
1
F
CY = 16 MHz
FPWM = 20,000 Hz
P1TMR Prescaler = 1:1
P1TPER =
20,000
× 1 × 2
16,000,000
1
= 400 -1
= 399
Example:
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ32MC10X-Reference_Manual-Section47-Motor_Control_PWM.pdf