pwm_hardware
Hardware PWM control
|
Author
|
Sebastien Lelong, Copyright © 2008..2024, all rights reserved.
|
|
Adapted-by
|
Albert Faber, Rob Hamerling, Rob Jansen
|
|
Compiler
|
2.5r8
|
Description
Include this library if you want to use the PWM feature of the CCP module(s).
This library uses conditional compile to selectively include underlying PWM
libraries and number of PWM channels, according to the target PIC configuration.
Ex: - 16f88 has 1 PWM channel: including pwm_hardware will prepare PWM
for 1 channel (using pwm_ccp1.jal)
- 16f877 has 2 PWM channels: including pwm_hardware will prepare PWM
for 2 channels (using pwm_ccp1.jal and pwm_ccp2.jal)
- etc. for PICs with more CCP or PWM modules
Note: pin_CCPx_directions or pin_PWMx_directions must be set to output
by the application.
.
With using the PWM hardware a design choice must be made between desired
PWM frequency and desired PWM resolution (number of possible PWM steps).
Choosing maximum PWM resolution implies a relative low PWM frequency and
vice versa: a high frequency limits the number of available PWM steps.
The figures are dependent on the target clock speed.
Refer to pwm_common, pwm_ccp1, pwm_ccp2 ... etc. documentation to
understand how to use these PWM libraries.
Notes
1. Because the PWM libraries use conditional compilation and the 'alias'
keyword, at least JalV2 compiler version 2.4l is required.
2. These libraries use the pin alias names as declared in Jallib device
files since revision 1171, so Jallib release 0.4 is a minimum requirement.
3. Some PICs have extended CCP modules. These will be handled by these
PWM libraries as 'classic' CCP modules.
4. Some of the newer PICs have PWM module(s) but no CCP module(s) and
the naming convention of registers and pins differs from the older
PICs. These PICS are supported as well, with same procedure names as
PICs with CCP modules.
5. RJ: 10-bit and 16-bit PWM1-PWM12 are supported from 2024 onwards.
Dependencies
Here are the list of samples which use this library: