16f84 ile Seri Port Üzerinden Robot Kol Kontrolü

Başlatan gareven, 16 Haziran 2012, 23:44:52

gareven

http://www.facebook.com/photo.php?v=10150691150611821

video yukarıda arkadaşlar kaynak ise

http://www.rentron.com/SerialServo.htm



devre bu şekilde.

kodlar ise

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.
portb = 0
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.

For the Basic Stamp I:

symbol si = 0               ' Serial input on pin 0
symbol pos = B0         ' B0 holds the position
symbol servo = B1      ' B1 holds the servo #
symbol cont = B2        ' B2 holds the count

start:
   serin si,N2400,servo,pos
for cont = 0 to 50
   pulsout servo,pos
   pause 15
next cont
   goto start