Mikroelektronika MIKROE-350 データシート

ページ / 526
320
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Description
The N variable represents the 
prescaler
factor (1, 8, 64, 256, or 1024). 
PWM16bit_Init must be called before using other functions from PWM Library.
Requires
You need a CMO on the given MCU (that supports PWM-16bit). 
Before calling this routine you must set the output pin for the PWM (according
to the datasheet):
DDRB.B1 = 1; // set PORTB pin 1 as output for the PWM-16bit 
This code example is for ATmega168, for different MCU please consult
datasheet for the correct pinout of the PWM module or modules.
Example
Initialize PWM-16bit module:
PWM16bit_Init( _PWM16_PHASE_CORRECT_MODE_8BIT,
_PWM16_PRESCALER_16bit_8, _PWM16_NON_INVERTED, 255, _TIMER1)