Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
320
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
PWM LIBRARY
CMO module is available with a number of AVR MCUs. mikroPascal 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 exam-
ple provided in Examples folder of our mikroPascal PRO for AVR compiler. When you
select a MCU, mikroPascal PRO for AVR automatically 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. mikroPascal
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
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.