mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
This code demonstrates use of PWM library procedures and functions. If pin RC2
is connected to LED diode, light emitted will depend of PWM duty ratio and this
change can be noticed.
program PWMtest
dim j as byte
main:
j = 0
PORTC = $FF
PWM_init(5000)
' initializes PWM module, freq = 5kHz
PWM_start
' starts PWM
while true
delay_ms(100)
j = j + 1
PWM_change_duty(j)
' changes duty ratio
wend
end.
Figure: PWM demonstration
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
149
page
Kommentare zu diesen Handbüchern