mikroC - C Compiler for Microchip PIC microcontrollers
PWM Library
CCP module is available with a number of PICmicros. mikroC provides library
which simplifies using PWM HW Module.
Note: These routines support module on RC2, and won't work with modules on
other ports. You can find examples for PICmicros with module on other ports in
mikroC installation folder, subfolder "Examples". Also, mikroC does not support
enhanced PWM modules.
Library Routines
Pwm_Init
Pwm_Change_Duty
Pwm_Start
Pwm_Stop
Pwm_Init
Prototype
void Pwm_Init(long freq);
Description
Initializes the PWM module with duty ratio 0. Parameter
quency in Hz (refer to device data sheet for correct values in respect with Fosc).
Pwm_Init
Requires
You need a CCP module on PORTC to use this library. Check mikroC installation fold-
er, subfolder "Examples", for alternate solutions.
Example
Pwm_Init(5000);
page
240
needs to be called before using other functions from PWM Library.
// Initialize PWM module at 5KHz
MikroElektronika: Development tools - Books - Compilers
making it simple...
is a desired PWM fre-
freq
mikroC
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?