DC Pwm motor controller

General discussion on mikroPascal for dsPIC30/33 and PIC24.
Post Reply
Author
Message
lina889
Posts: 4
Joined: 21 Jan 2011 09:17

DC Pwm motor controller

#1 Post by lina889 » 28 Jan 2011 10:18

am trinng to control dc motor but it's not rotate as it shout be it's slow although i but large duty cycle
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.

Post Reply

Return to “mikroPascal for dsPIC30/33 and PIC24 General”