PDA

View Full Version : Problem with PULSEOUT



Forkosh
- 21st October 2007, 00:44
I am using the PIC16F616
I modified two HS425BB servos for continuous rotation and I cannot get them to go counterclockwise. Every pulse that I give makes the servo spin clockwise ( but at different speeds based on the pulse).

What can I do to make it go counterclockwise????



Define OSC 8

symbol servo1=portc.3
symbol servo2=portc.2
x var byte
b var byte

pause 20
x = 50
b = 250
main:
pulsout servo1,x
Pulsout servo2,b



goto main

Darrel Taylor
- 21st October 2007, 03:36
The Servo pulses should be between 1.05 - 1.95 ms

With an 8Mhz OSC, the resolution of PULSOUT is 5 us.

0.00105/0.000005 = 210 - Minimum PULSOUT
0.00150/0.000005 = 300 - Center or Stop
0.00195/0.000005 = 390 - Maximum PULSOUT

And, the overall frequency should be approx 50Hz.
So the PAUSE 20 needs to be inside the Main loop.

ADDED:
  They need to be Positive Pulses, so you should make sure the pins are LOW to start with.
  PORTC = 0 should do it, in your case.
<br>

Forkosh
- 21st October 2007, 12:19
Thanks


What are the differences of running the PIC at 8mhz or at 4mhz? NAyadvantages at the 8mhz speed???