her is the code :
Code: Select all
program LINApwm
dim j as byte
dim i as byte
main:
TRISD=%11111111
PORTD=%00000000
j = 0
PORTC = $FF ' Initialize PORTC
Pwm_Init(8000) ' Initialize PWM module, freq = 5kHz.
while true
Pwm_Start ' Start PWM
Pwm_Change_Duty(255) ' Change duty ratio
if portd.3=1 then
Pwm_Stop
end if
wend
end.