Mikroelektronika MIKROE-350 Data Sheet

Page of 526
PWM LIBRARY
CMO module is available with a number of AVR MCUs. mikroBasic PRO for AVR provides
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 mikroBasic PRO for AVR compiler. When you select a MCU, mikroBasic
PRO for AVR automaticaly loads the correct PWM library (or libraries), which can be verified by look-
ing 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. mikroBasic 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
308
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic 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 second PWM
library (if it exists in Library Manager.
_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.
_PWM_PRESCALER_32
Sets prescaler value to 32 (this value is not available on
every MCU. Please use Code Assistant to see if this
value is available for the given MCU.
_PWM_PRESCALER_64
Sets prescaler value to 64.
_PWM_PRESCALER_128
Sets prescaler value to 128 (this value is not available
on every MCU. Please use Code Assistant to see if this
value is available for the given MCU.