Greetings,
i've found a program to move a servo ( left and right ).
Did some minor modifications ( lcd pinouts ) and programmed my pic 16f84A.
However the servo does not move !
The LCD displays the position OK and the buttons work OK but there is no movement from the servo.
With an ohmeter i cannot sense any voltage also.
Is there something wrong with the program ?
Any ideas ?
This is the program:
pos var word ' Servo position
servo1 var PORTB.4 ' Alias servo pin
Low servo1 ' Servo output low
PORTB = 0 ' PORTB lines low to read buttons
TRISB = $fe ' Enable first button row
Pause 100 ' Wait for LCD to startup
Gosub center ' Center servo
mainloop:
If PORTB.5 = 1 Then
Gosub left
Endif
If PORTB.2 = 1 Then
Gosub center
Endif
If PORTB.6 = 1 Then
Gosub right
Endif
servo1 = 1 ' Start servo pulse
Pauseus 1000 + pos ' Delay for servo pulse high time
servo1 = 0 ' End servo pulse
Pause 16 ' Servo update rate about 60Hz
Goto mainloop ' Do it all forever
left:
If pos < 2000 Then
pos = pos + 1
GoSub display ' Display new position on LCD
Endif
Return
right:
If pos > 1000 Then
pos = pos - 1
GoSub display ' Display new position on LCD
Endif
Return
center:
pos = 1500
GoSub display ' Display new position on LCD
Return
display:
Lcdout $fe, 1, "Position = ", #pos
Return
end
thanks
Bookmarks