Mikroelektronika MIKROE-350 データシート

ページ / 526
PWM1_Set_Duty
PWM1_Start
PWM1_Stop
314
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure PWM1_Set_Duty(dim duty as byte)
Returns
Nothing.
Description
Changes PWM duty ratio. Parameter 
duty
takes values from 0 to 255, where 0
is 0%, 127 is 50%, and 255 is 100% duty ratio. Other specific values for duty
ratio can be calculated as 
(Percent*255)/100
.
Requires
PWM module must to be initialised (PWM1_Init) before using PWM_Set_Duty
function.
Example
For example lets set duty ratio to 75%:
PWM1_Set_Duty(192)
Prototype
sub procedure PWM1_Start()
Returns
Nothing.
Description
Starts PWM. 
Requires
MCU must have CMO module to use this library. PWM1_Init must be called
before 
using this routine.
Example
PWM1_Start()
Prototype
sub procedure PWM1_Stop()
Returns
Nothing.
Description
Stops the PWM.
Requires
MCU must have CMO module to use this library. PWM1_Init and PWM1_Start
must be called before 
using this routine using this routine, otherwise it will have no effect as the PWM
module is not running. 
Example
PWM1_Stop();