Another Motor Control problem
Drew
Posts: 9
Im using the L298 motor controller hoping to program a minesweeping robot.· Im in the beginning·phases, so im trying to get simple things like 'motion of my wheels' working.··I can get my wheels to move both forward and·backwards, but in attempting to·have them 'stop' after a given amount of time,·doesnt seem to work.· The wheels·keep moving.· I was using the source code given on the robotics v20 guide (page 111), and i edited it to match my motor controller configuration.·
FOR counter = 1 TO 122 ' Clockwise just under 3 seconds.
PULSOUT 12, 650 'Pin 12 connected to forward on motor controller
PAUSE 20
NEXT
FOR counter = 1 TO 40 ' Stop one second.
PULSOUT 12, 750
PAUSE 20
NEXT
FOR counter = 1 TO 122 ' Counterclockwise three seconds.
PULSOUT 13,·650 'Pin 13·connected to Backwards on motor controller
PAUSE 20
NEXT
END
Should i use the robotics v20 as an outline for my robot, or is their another guide i should use.
Here is a link to my motor controller:
http://www.hvwtech.com/downloads/manuals/L298%20Kit%20Manual%20v31.pdf
And here is the link to the robotics guide ive been using.·
http://www.parallax.com/dl/docs/books/edu/RoboticsV20.pdf
Regards,
Drew
·
FOR counter = 1 TO 122 ' Clockwise just under 3 seconds.
PULSOUT 12, 650 'Pin 12 connected to forward on motor controller
PAUSE 20
NEXT
FOR counter = 1 TO 40 ' Stop one second.
PULSOUT 12, 750
PAUSE 20
NEXT
FOR counter = 1 TO 122 ' Counterclockwise three seconds.
PULSOUT 13,·650 'Pin 13·connected to Backwards on motor controller
PAUSE 20
NEXT
END
Should i use the robotics v20 as an outline for my robot, or is their another guide i should use.
Here is a link to my motor controller:
http://www.hvwtech.com/downloads/manuals/L298%20Kit%20Manual%20v31.pdf
And here is the link to the robotics guide ive been using.·
http://www.parallax.com/dl/docs/books/edu/RoboticsV20.pdf
Regards,
Drew
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Is there an argument in PWM to keep it constant?
I had to debug line by line just to get what I wanted. Here's what I cut out just to control one motor. It will PWM a motor and enable one to adjust the speed. Pretty neat.
I still don't understand though, that is the real issue.
NOW, what I want to do is control it with a pot. RCTIME perhaps?
' {$STAMP BS2sx}
'
Define Constants & Variables
pwmpin5 CON 5
cycles VAR Byte: cycles = 10
neutral VAR Byte: neutral = 180 'pwm value for 3.0V out
full_fwd VAR Byte: full_fwd = 180 'pwm value for 3.5V out
x VAR Byte: x = 0 'counter variable
pause_time VAR Word: pause_time = 250 'pause between counter increments
PWM pwmpin5,neutral,cycles 'bring voltage up to 3.0V (neutral)
runmotor:
FOR x = neutral TO full_fwd
DEBUG ?x
PWM pwmpin5,x,cycles
PAUSE pause_time
NEXT
RETURN