# 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

- pwm_common

## Summary

### Global variables/contants

### Procedures

### Functions

## API details

### Global variables/contants

### Procedures

### Functions

## Related samples

Here are the list of samples which use this library:

12f683 | 12f683_pwm_led_highres.jal
12f683 | 12f683_pwm_adc.jal
12f683 | 12f683_pwm_sound.jal
12f683 | 12f683_pwm_led.jal
12hv615 | 12hv615_temperature_fan.jal
16f1455 | 16f1455_pwm1_led.jal
16f1455 | 16f1455_pwm2_led.jal
16f15324 | 16f15324_pwm3_pwm4_led.jal
16f1579 | 16f1579_pwm1_16_bit_led.jal
16f1579 | 16f1579_pwm2_16_bit_led.jal
16f1579 | 16f1579_pwm3_16_bit_led.jal
16f1579 | 16f1579_pwm4_16_bit_led.jal
16f1777 | 16f1777_pwm10_led.jal
16f1778 | 16f1778_pwm11_16_bit_led.jal
16f1778 | 16f1778_pwm9_led.jal
16f1778 | 16f1778_pwm3_led.jal
16f1778 | 16f1778_pwm6_16_bit_led.jal
16f1778 | 16f1778_pwm4_led.jal
16f1778 | 16f1778_pwm5_16_bit_led.jal
16f1779 | 16f1779_pwm12_16_bit_led.jal
16f18323 | 16f18323_pwm5_led.jal
16f18323 | 16f18323_pwm6_led.jal
16f648a | 16f648a_ir_ranger_gp2d02.jal
16f648a | 16f648a_pwm_led.jal
16f648a | 16f648a_pwm_led_highres.jal
16f648a | 16f648a_pwm_sound.jal
16f723 | 16f723_pwm_led_highres.jal
16f723 | 16f723_pwm_led.jal
16f723 | 16f723_pwm_sound.jal
16f723 | 16f723_ir_ranger_gp2d02.jal
16f73 | 16f73_pwm_led.jal
16f73 | 16f73_pwm_led_highres.jal
16f73 | 16f73_pwm2.jal
16f73 | 16f73_pwm_sound.jal
16f767 | 16f767_pwm_adc.jal
16f877 | 16f877_pwm2.jal
16f877 | 16f877_pwm_sound.jal
16f877 | 16f877_servo_rc_slave.jal
16f877 | 16f877_pwm_led_highres.jal
16f877 | 16f877_pwm_led.jal
16f877a | 16f877a_pwm2.jal
16f877a | 16f877a_pwm_sound.jal
16f877a | 16f877a_pwm_led_highres.jal
16f877a | 16f877a_servo_rc_slave.jal
16f877a | 16f877a_pwm_led.jal
16f88 | 16f88_pwm_sound.jal
16f88 | 16f88_pwm_led.jal
16f88 | 16f88_pwm_led_highres.jal
16f882 | 16f882_pwm_led.jal
16f886 | 16f886_pwm_adc_freq.jal
16f886 | 16f886_pwm_adc_res.jal
18f14k50 | 18f14k50_pwm_led.jal
18f14k50 | 18f14k50_pwm_sound.jal
18f14k50 | 18f14k50_pwm_led_highres.jal
18f2450 | 18f2450_pwm_led.jal
18f2450 | 18f2450_ir_ranger_gp2d02.jal
18f2450 | 18f2450_pwm_sound.jal
18f2450 | 18f2450_pwm_led_highres.jal
18f2520 | 18f2520_ir_ranger_gp2d02.jal
18f2520 | 18f2520_pwm_led.jal
18f2520 | 18f2520_pwm_sound.jal
18f2520 | 18f2520_pwm_led_highres.jal
18f2550 | 18f2550_pwm_led.jal
18f2550 | 18f2550_ir_ranger_gp2d02.jal
18f2550 | 18f2550_pwm_led_highres.jal
18f2550 | 18f2550_pwm_sound.jal
18f2620 | 18f2620_pwm_sound.jal
18f2620 | 18f2620_pwm_led_highres.jal
18f2620 | 18f2620_pwm_led.jal
18f2620 | 18f2620_ir_ranger_gp2d02.jal
18f26k42 | 18f26k42_pwm7_led.jal
18f26k42 | 18f26k42_pwm5_led.jal
18f26k42 | 18f26k42_pwm8_led.jal
18f26k42 | 18f26k42_pwm6_led.jal
18f452 | 18f452_ir_ranger_gp2d02.jal
18f452 | 18f452_pwm_sound.jal
18f452 | 18f452_servo_rc_slave.jal
18f452 | 18f452_pwm_led_highres.jal
18f452 | 18f452_pwm_led.jal
18f4525 | 18f4525_servo_rc_slave.jal
18f4550 | 18f4550_pwm_led.jal
18f4550 | 18f4550_pwm_led_highres.jal
18f4550 | 18f4550_ir_ranger_gp2d02.jal
18f4550 | 18f4550_servo_rc_slave.jal
18f4550 | 18f4550_pwm_sound.jal
18f4620 | 18f4620_servo_rc_slave.jal
18f4620 | 18f4620_pwm_led_highres.jal
18f4620 | 18f4620_ir_ranger_gp2d02.jal
18f4620 | 18f4620_pwm_sound.jal
18f4620 | 18f4620_pwm_led.jal