Datasheet

PWM16bit_Change_Duty
386
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
void PWM16bit_Change_Duty(unsigned duty, unsigned short channel);
Returns Nothing.
Description
Changes PWM duty ratio. Parameter duty takes values shown on the table
below. Where 0 is 0%, and TOP value is 100% duty ratio. Other specific values
for duty ratio can be calculated as
(Percent*TOP)/100.
Requires
PWM module must to be initialised (PWM16bit_Init) before using
PWM_Set_Duty function.
Example
Example lets set duty ratio to :
PWM16bit_Change_Duty( 300, _TIMER1_CH_A );
Timer/Counter Mode
of Operation :
TOP :
Update of
OCRnX at :
TOVn Flag Set
on :
PWM, Phase Correct,
8 bit
0x00FF TOP BOTTOM
PWM, Phase Correct,
9 bit
0x01FF TOP BOTTOM
PWM, Phase Correct,
10 bit
0x03FF TOP BOTTOM
Fast PWM, 8 bit 0x00FF TOP TOP
Fast PWM, 9 bit 0x01FF TOP TOP
Fast PWM, 10 bit 0x03FF TOP TOP