mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

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 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

 

 

page

 

240

MikroElektronika: Development tools - Books - Compilers