ABL electronic PIC12 Benutzerhandbuch

Seite von 312
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.
Pwm_Init
Pwm_Change_Duty
Pwm_Start
Pwm_Stop
mikroC - C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
240
MikroElektronika:  Development  tools  -  Books  -  Compilers
page
PWM Library
Library Routines
Prototype
void
Pwm_Init(long freq);
Description
Initializes the PWM module with duty ratio 0. Parameter 
freq
is a desired PWM fre-
quency in Hz (refer to device data sheet for correct values in respect with Fosc).
Pwm_Init
needs to be called before using other functions from PWM Library.
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);  
// Initialize PWM module at 5KHz
Pwm_Init