Mikroelektronika MIKROE-350 Hoja De Datos
PWM16bit_Start
PWM16bit_Stop
Library Example
The example changes PWM duty ratio continually by pressing buttons on PORTC (0-3). If LED is
connected to PORTB.B1 or PORTB.B2 ,you can observe the gradual change of emitted light. This
example is written for ATmega168. This AVR MCU has only Timer/Counter1 split over two chan-
nels A and B. In this example we are changing the duty ratio on both of these channels.
connected to PORTB.B1 or PORTB.B2 ,you can observe the gradual change of emitted light. This
example is written for ATmega168. This AVR MCU has only Timer/Counter1 split over two chan-
nels A and B. In this example we are changing the duty ratio on both of these channels.
322
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure PWM16bit_Start(dim timer as byte)
Returns
Nothing.
Description
Starts PWM-16bit module with alredy preset values (wave mode, prescaler,
inverted and duty) given in the PWM16bit_Init.
inverted and duty) given in the PWM16bit_Init.
Requires
MCU must have CMO module to use this library. PWM16bit_Init must be called
before
using this routine, otherwise it will have no effect as the PWM module is not ini-
tialised.
before
using this routine, otherwise it will have no effect as the PWM module is not ini-
tialised.
Example
PWM16bit_Start( _TIMER1 )
// Starts the PWM-16bit module
on Timer/Counter1
or
PWM16bit_Start( _TIMER3 )
// Starts the PWM-16bit module
on Timer/Counter3
Prototype
sub procedure PWM16_Stop(dim timer as byte)
Returns
Nothing.
Description
Stops the PWM-16bit module, connected to Timer/Counter set in this stop function.
Requires
MCU must have CMO module to use this library. Like in PWM16bit_Start
before, PWM16bit_Init must be called before
using this routine , otherwise it will have no effect as the PWM module is not
running.
before, PWM16bit_Init must be called before
using this routine , otherwise it will have no effect as the PWM module is not
running.
Example
PWM16bit_Stop( _TIMER1 )
// Stops the PWM-16bit module on
Timer/Counter1
or
PWM16bit_Stop( _TIMER3 )
// Stops the PWM-16bit module on
Timer/Counter3