Mikroelektronika MIKROE-350 データシート
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
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):
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.
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)
_PWM16_PRESCALER_16bit_8, _PWM16_NON_INVERTED, 255, _TIMER1)