2002 Microchip Technology Inc.
Preliminary
DS30485A-page 123
PIC18FXX39
15.0 PULSE WIDTH MODULATION
(PWM) MODULES
PIC18FXX39 devices are equipped with two 10-bit
PWM modules. Each contains a register pair
(CCPxH:CCPxL), which operates as a Master/Slave
Duty Cycle register, and a control register (CCPxCON).
The modules use Timer2 (Section 12.0) as their time-
base reference. Figure 15-1 shows a simplified block
diagram of the module’s operation.
This section gives a brief overview of PWM operation
as
controlled
by
the
Motor
Control
module
(Section 14.0). Operation is described with respect to
PWM1, but is equally applicable to PWM2.
15.1
PWM Mode
In Pulse Width Modulation, each PWM pin produces a
PWM output with a resolution of up to 10 bits.
A PWM output (Figure 15-2) has a time-base (period)
and a time that the output stays high (duty cycle). The
frequency of the PWM is the inverse of the period
(1/period).
FIGURE 15-1:
SIMPLIFIED PWM BLOCK
DIAGRAM
FIGURE 15-2:
PWM OUTPUT
15.1.1
PWM PERIOD
The PWM period is specified when the Motor Control
module is initialized. The PWM period can be
calculated using the formula:
PWM period = [(PR2) + 1] 4 TOSC
(TMR2 prescale value)
PWM frequency is defined as 1 / [PWM period].
The API method void ProMPT_Init (page 118)
sets the required PWM frequency in the application.
The parameter PWMfrequency determines the operat-
ing frequency of the module. When it is ‘0’, the PWM
frequency set in the Motor Control module is 9.75 kHz;
when it is ‘1’, the set PWM frequency is 19.53 kHz.
When TMR2 is equal to PR2, the following three events
occur on the next increment cycle:
TMR2 is cleared
The PWM1 pin is set (exception: if PWM duty
cycle = 0%, the PWM1 pin will not be set)
The PWM duty cycle is latched from CCPR1L into
CCPR1H
Note:
The PWM modules are used exclusively
by the Motor Control module. As such, they
are not available to users as a separate
resource. Although their locations are
shown on the device data memory maps,
users should not modify the values of
these registers.
CCPR1L
CCPR1H (Slave)
Comparator
TMR2
Comparator
PR2
(1)
RQ
S
Duty Cycle Registers
CCP1CON<5:4>
Clear Timer,
PWM1 pin and
latch Duty Cycle
PWM1
Note 1: 8-bit timer is concatenated with 2-bit internal Q
clock, or 2 bits of the prescaler to create a
10-bit time-base.
Note:
The Timer2 postscaler (see Section 12.0)
is not used in the determination of the
PWM frequency. The postscaler could be
used to have a servo update rate at a
different frequency than the PWM output.
Period
Duty Cycle
TMR2 = PR2
TMR2 = Duty Cycle
TMR2 = PR2
相关PDF资料
PIC18F4439-I/ML IC MCU FLASH 6KX16 EE A/D 44QFN
PIC18F2439-I/SO IC MCU FLASH 6KX16 EE A/D 28SOIC
PIC16F687-I/SO IC PIC MCU FLASH 2KX14 20SOIC
PIC16F877AT-I/PTG IC MCU FLASH 8KX14 W/AD 44 TQFP
PIC16F877A-I/LG IC MCU FLASH 8KX14 W/AD 44PLCC
PIC12LC509AT-04I/MF IC MCU OTP 1KX12 LV 8-DFN
PIC12C509AT-04I/MF IC MCU OTP 1KX12 8-DFN
PIC24F08KL301-I/SS IC MCU 16BIT 8KB FLASH 20-SSOP
相关代理商/技术参数
PIC18F4539-I/P 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC18F4539-I/P 制造商:Microchip Technology Inc 功能描述:IC 8BIT FLASH MCU 18F4539 DIP40
PIC18F4539-I/PT 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC18F4539IPT 制造商:MICRO CHIP 功能描述:NEW
PIC18F4539T-E/ML 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC18F4539T-E/PT 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC18F4539T-I/ML 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT
PIC18F4539T-I/PT 功能描述:8位微控制器 -MCU 24KB 1408 RAM 32 I/O RoHS:否 制造商:Silicon Labs 核心:8051 处理器系列:C8051F39x 数据总线宽度:8 bit 最大时钟频率:50 MHz 程序存储器大小:16 KB 数据 RAM 大小:1 KB 片上 ADC:Yes 工作电源电压:1.8 V to 3.6 V 工作温度范围:- 40 C to + 105 C 封装 / 箱体:QFN-20 安装风格:SMD/SMT