pwm_ccp7

hardware PWM control, dedicated to module CCP7

Author Stef Mientki, Copyright (C) 2002-2006, all rights reserved.
Adapted-by Sebastien Lelong, Rob Hamerling.
Compiler 2.4l

Description

Performs PWM operations on the CCP7 module.
This file is automatically included by pwm_hardware.jal
when the target PIC has a CCP7 module.


Notes

1. This is a heavy refactoring of the original pwm_hardware.jal
          (Stef's lib)
       2. Partly rewritten for JalV2 version 2.4l and Jallib revision 1171.
          Reduced memory occupation. Added procedure for lowres PWM.


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Functions


API details

Global variables/contants

Procedures

  • pwm7_on()

    PWM mode on
    Restore duty cycle from shadow registers
    Note: pin_CCP7_direction should be set to output!
    

  • pwm7_set_dutycycle_lowres(byte in duty)

    Set dutycycle with 8-bits resolution allowing 255 PWM steps.
    The 'duty' argument is the 8-bits absolute value for the duty cycle:
     * duty<1:0> are the 2 LSbits
     * duty<7:2> are the 6 MSbits
    Allowed range: 0..255
    Beware that steps 256..1023 are not available. In other words
    the available PWM range is 25% of the highres procedure.
    This procedure is particularly suitable with higher frequencies
    whereby the PWM resolution is limited to 256 steps or less!
    

  • pwm7_set_percent_dutycycle(byte in percent)

    Set a percentage duty cycle, allowing max 100 PWM steps.
    Allowed range: 0..100
    The duty cycle will be set to the specified percentage of the maximum
    for the current PWM frequency.
    Note: The number of available PWM steps can be lower than 100 with
    (very) high PWM frequencies.
    Note: pin_CCP7_direction should be set to output!
    

  • pwm7_off()

    PWM mode off
    retain duty cycle setting in shadow registers
    

  • pwm7_set_dutycycle_highres(word in duty)

    Set dutycycle with 10-bits resolution, allowing 1024 PWM steps.
    The 'duty' argument is a (max) 10-bits absolute value for the duty cycle:
     * duty<1:0> are the 2 LSbits
     * duty<9:2> are the 8 MSbits
    Allowed range: 0..1023
    Note: pin_CCP7_direction should be set to output!
    

  • pwm7_set_dutycycle(byte in duty)

    Set dutycycle for 10-bits resolution but allowing only 255 PWM steps.
    This procedure is equivalent to pwm7_set_dutycycle_highres(), but
    the low order 2 bits of the 10-bits duty cycle are set to 0.
    This means that only every 4th of the available 1023 steps can be selected
    and consequently max 255 PWM steps are available.
    This procedure is for user convenience, allowing to specify an 8 bits
    value for the duty cycle is for many applications satisfactory.
    Calling this procedure will also activate PWM.
    Note: pin_CCP7_direction should be set to output!
    

Functions


Related samples

No sample found