please help me..we have a project using stepper motor..we are making simple linear robot..when the circuit is on it will automatically open the gripper then after a seconds it will close the grip then after a seconds the slider stepper will turn forward then after a seconds again the gripper will open again then close and back to its original position..
please give me sample code or correct my code because when i tried it the gripper will only vibrate:
Code:
clear
ti var byte
c var byte
z var byte
ti=100
trisb=0
gripper open(cw the gripper stepper):
for z=1 to 2
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay
gripper open1(cw the gripper stepper):
for z=1 to 2
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay3
close(reverse gripper stepper):
for z=1 to 2
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay1
close1(reverse gripper stepper):
for z=1 to 3
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay4
delay:
portb=0
pause 2000
goto close
delay1:
portb=0
pause 2000
goto loop
delay2:
portb=0
pause 2000
goto open1
delay3:
portb=0
pause 2000
goto close1
delay4:
portb=0
pause 2000
goto loop1
delay5:
portb=0
pause 2000
goto open
loop(cw the slider):
for c=0 to 11
portb=8
pause ti
portb=4
pause ti
portb=2
pause ti
portb=1
pause ti
next c
pause 2000
goto delay2
loop1(ccw the slider):
for c=0 to 11
portb=1
pause ti
portb=2
pause ti
portb=4
pause ti
portb=8
pause ti
next c
goto delay5
end
Bookmarks