PDA

View Full Version : Servo motor commander...



mayhem
04-24-2006, 03:05 PM
Hey i have built a servo motor commader using the PIC16F84 microcontroller however its giving me some problems although the servos are moving when im giving the command from the compter...they are not reseponding to their respective impulses....when i move the knob for servo 1 and servo 2 on the computer only servo one moves wheres it has no connection to knob since it is connected to a diff pin of the ic..the following is a part of the vb code i have used
For the PIC16F84:

Include "modedefs.bas" ' Include serial modes

si var PORTA.0 ' Set portA.0 as our serial input pin
pos var byte ' Define our storage location for the servo position information.
servo var byte ' Define our storage location for the servo number to move.
cont var byte ' Define a variable to hold the count.

trisb = 0 ' Make all of port B outputs to send position information to each servo.

start:
serin si,N2400,servo,pos ' Get the servo# and position for that servo.
for cont = 0 to 50
pulsout servo,pos ' Send servo# ? to position ?.
pause 15 ' Wait 15 ms.
next cont ' Next pulse.
goto start ' Return to get more serial input

According to this it cant send the same impulse to 2 i/o points so i cant figure out whats wrong and plus i have checked my cicuit for any shorts and none are there....any suggestions???????/

ice
04-25-2006, 01:38 AM
Which compiler is that ..CCS or PIC Basic pro?..
Post your circuit too.