Datasheet
PWM LIBRARY
CMO module is available with a number of AVR MCUs. mikroC PRO for AVR pro-
vides library which simplifies using PWM HW Module.
Note: For better understanding of PWM module it would be best to start with the
example provided in Examples folder of our mikroC PRO for AVR compiler. When
you select a MCU, mikroC PRO for AVR automaticaly loads the correct PWM library
(or libraries), which can be verified by looking at the Library Manager. PWM library
handles and initializes the PWM module on the given AVR MCU, but it is up to user
to set the correct pins as PWM output, this topic will be covered later in this section.
mikroC PRO for AVR does not support enhanced PWM modules.
Library Routines
- PWM_Init
- PWM_Set_Duty
- PWM_Start
- PWM_Stop
- PWM1_Init
- PWM1_Set_Duty
- PWM1_Start
- PWM1_Stop
Predefined constants used in PWM library
372
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
The following variables are used
in PWM library functions:
Description:
_PWM_PHASE_CORRECT_MODE
Selects Phase Correct PWM mode on first
PWM library.
_PWM1_PHASE_CORRECT_MODE
Selects Phase Correct PWM mode on sec-
ond PWM library (if it exists in Library Man-
ager.
_PWM_FAST_MODE
Selects Fast PWM mode on first PWM
library.
_PWM1_FAST_MODE
Selects Fast PWM mode on second PWM
library (if it exists in Library Manager.
_PWM_PRESCALER_1
Sets prescaler value to 1 (No prescaling).
_PWM_PRESCALER_8
Sets prescaler value to 8.