Is that PWMDUTY command meant to be using 'timer' or should it be using 'timer3' ?
....Wow. I can't believe I made such a stupid mistake. That solves half the problem. The ramping code works now, however issuing a pwmout command by itself does nothing.
This code causes the motor to ramp up slowly, then drop and start over again like it's supposed to:
Code:
symbol LED1 = 4
symbol timer3 = w2
init: pulsout LED1, 20000
sertxd ("-------------Init------------ ")
main:
sertxd ("Main ")
pwmout 2, 255, 1
sertxd ("pwmout ")
for timer3 = 400 to 1023
sertxd ("for-next start ")
pwmduty 2, timer3
sertxd ("timer incriment ", #w2)
pause 20
next
goto main
This code will make the motor run at near-full speed continuosly, because timer3 just jumps back and forth between 1022 and 1023:
Code:
symbol LED1 = 4
symbol timer3 = w2
init: pulsout LED1, 20000
sertxd ("-------------Init------------ ")
main:
sertxd ("Main ")
pwmout 2, 255, 1
sertxd ("pwmout ")
for timer3 = 1022 to 1023
sertxd ("for-next start ")
pwmduty 2, timer3
sertxd ("timer incriment ", #w2)
pause 20
next
goto main
Yet the following code doesn't do anything at all...:
Code:
Main:
pwmout 2, 255, 1023
Or:
Code:
Main:
pwmout 2, 255, 1
pwmduty 2, 1023
Why would the motor run with pwmduty jumping between 1022 and 1023, but not with a single "pwmout 2, 255, 1023" command?
Sputz: I don't see how it would help, as I'd have no way of knowing whether the motor was running correctly. Unless I'm grossly mistaken, none of the picaxe chips can directly drive a motor.
BeanieBots: The spec sheet for the 5v LDO regulator is
here. I hear what your saying about the capacitor being a little on the small side. As for no decoupling, are you saying not to use decoupling, or that with the capacitor so small I'm practically not decoupling?
MPep: I haven't directly measured the current at 5v, but I do no the stall current to be about 600mA at 6v. With the L298 H-Bridge, the motor supply current will come directly from the battery instead of sharing the 5v regulator.
Edit: Now I'm just confused. Putting the pwmout command in a do-loop makes the motor run continuously. I thought pwmout ran continuously in the background? Why would I have to loop it?
With this code, nothing happens until the picaxe is restarted, then the motor runs full:
Code:
Main:
pwmout 2, 255, 1
pwmduty 2, 400
In this code the motor runs at a very low speed as it should:
Code:
Main:
pwmout 2, 255, 1
Do
pwmduty 2, 400
Loop
Also, I'll see what I can do about finding an alternative host for the schematic image. It's just too bad the forum restrictions on pixel x pixel size are so extreme.
There we go.