pwm_common

hardware PWM control, generic procedures

Author Stef Mientki, Copyright (C) 2002-2006, all rights reserved.
Adapted-by Sebastien Lelong
Compiler >=2.4g

Description

this lib handles generic operation on PWM, 
whatever the channel number, etc...
It's aimed to be used with pwm_{register} lib (eg. pwm_ccp1.jal, ...)


Notes

this is a heavy refactoring of the original pwm_hardware.jal
Stef's lib


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Functions


API details

Global variables/contants

Procedures

  • pwm_max_resolution(byte in prescaler)

    initializes the PWM for high resolution (10 bits) and starts the PWM 
    While setting high resolution, prescaler can be used to adjust frequency. 
    The parameter corresponds to the prescaler value, and can be either:
      * 1 : high frequency
      * 4 : medium frequency
      * 16: low frequency
    
    Not all frequencies are available, you'll need the datasheet to actually
    compute the computed frequency according to the clock speed.
    
    FYI, here's a table showing frequency for common clock speed:
    
    ||*prescaler/clock* ||   *4MHz*   ||   *8MHz*   ||  *10MHz*   ||  *20MHz*   ||
    ||    1             ||    3.90kHz ||    7.81kHz ||   9.77kHz  ||   19.43kHz ||
    ||    4             ||     976Hz  ||    1.95kHz ||   2.44kHz  ||    4.88kHz ||
    ||    16            ||     244Hz  ||     488Hz  ||    610Hz   ||    1.22kHz ||
    
    

  • pwm_set_frequency(dword in freq)

    Initializes the PWM for accurate frequency and starts the PWM
    

Functions


Related samples

No sample found