| Electronic Components Datasheet Search |
|
PIC16F18323-E/RF Datasheet(PDF) 168 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F18323-E/RF Datasheet(HTML) 168 Page - Microchip Technology |
|
168 / 442 page ![]() PIC16(L)F18313/18323 DS40001799A-page 168 Preliminary 2015 Microchip Technology Inc. 18.1.1 PWM PERIOD Referring to Figure 18-1, the PWM output has a period and a pulse width. The frequency of the PWM is the inverse of the period (1/period). The PWM period is specified by writing to the PR2 register. The PWM period can be calculated using the following formula: EQUATION 18-1: PWM PERIOD When TMR2 is equal to PR2, the following three events occur on the next increment cycle: • TMR2 is cleared • The PWMx pin is set (Exception: If the PWM duty cycle = 0%, the pin will not be set.) • The PWM pulse width is latched from PWMxDC. 18.1.2 PWM DUTY CYCLE The PWM duty cycle is specified by writing a 10-bit value to the PWMxDC register. The PWMxDCH contains the eight MSbs and the PWMxDCL<7:6> bits contain the two LSbs. The PWMDC register is double-buffered and can be updated at any time. This double buffering is essential for glitch-free PWM operation. New values take effect when TMR2 = PR2. Note that PWMDC is left-justified. The 8-bit timer TMR2 register is concatenated with either the 2-bit internal system clock (FOSC), or two bits of the prescaler, to create the 10-bit time base. The system clock is used if the Timer2 prescaler is set to 1:1. Equation 18-2 is used to calculate the PWM pulse width. Equation 18-3 is used to calculate the PWM duty cycle ratio. EQUATION 18-2: PULSE WIDTH EQUATION 18-3: DUTY CYCLE RATIO 18.1.3 PWM RESOLUTION The resolution determines the number of available duty cycles for a given period. For example, a 10-bit resolution will result in 1024 discrete duty cycles, whereas an 8-bit resolution will result in 256 discrete duty cycles. The maximum PWM resolution is ten bits when PR2 is 255. The resolution is a function of the PR2 register value as shown by Equation 18-4. EQUATION 18-4: PWM RESOLUTION 18.1.4 OPERATION IN SLEEP MODE In Sleep mode, the TMR2 register will not increment and the state of the module will not change. If the PWMx pin is driving a value, it will continue to drive that value. When the device wakes up, TMR2 will continue from its previous state. 18.1.5 CHANGES IN SYSTEM CLOCK FREQUENCY The PWM frequency is derived from the system clock frequency. Any changes in the system clock frequency will result in changes to the PWM frequency. See Section 6.0, Oscillator Module (with Fail-Safe Clock Monitor) for additional details. Note: If the pulse width value is greater than the period the assigned PWM pin(s) will remain unchanged. Note 1: TOSC = 1/FOSC Pulse Width Note: If the pulse-width value is greater than the period the assigned PWM pin(s) will remain unchanged. Res olutio n 4 PR21 + log 2 log ------------------------------------------ bits = |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |