PDA

View Full Version : servo control



parinshah
- 14th April 2006, 13:00
hi frenz,
hw do i control a servo with pc'c serial port.i hv prepared schematic for dc servo motor conrol,cnt post the schematic coz nt hving proper format,hving jpg format wich a huge 1,wel i m usin max232,pic16f876,4 mhz crystal,h bridge driving technique,pulse shaper 4 encoder ,d flip flop n then the encoder output is given to tmr2.wish to use pid algorithm wher in pulse is givn with duty cycle accordin to the speed n position required.i wish to regulate speed n position
can u guide me for coding,asin hw to start,i hv been tryin to do serial communication bt nt successful yet.code i made is:
trisc=%10000000
trisb=%00000000
adcon=%00000110
portb=$00
portc=$00
b var byte
main:
if portc.7=0 then goto serial
goto main
serial:
serin portc.7,n9600,[0],b
pause 20
serout portc.6,n9600,b
portb=b
pause 5000
goto main
end
correct me n gv ur valuable suggestion for codin.
thank u.

mischl
- 14th April 2006, 17:41
hi

take a look at this : http://www.melabs.com/resources/samples/x2/pbp/servox2.bas

this will help i hope