Let's Make Robots!

Help with the HPWM command

Well, with my new motor controller parts soon in the mail, I am playing with the HPWM command on a 28x...

I am just plain lost, yo. I have re-read the picaxe manual about 40 times now, including the HPWM command and the HPWMDUTY command and am getting nowhere!

I have everything hooked up to a L293D -A,B hooked up to one side and C,D to the other. I can get the motors to spin and have had success in controlling their speed, but they are both stuck in one direction.

To be honest, I just simply don't understand single vs. full, active high and low, the polarity thing -really I am super lost. 

Anyone out there wanna give me a quickie walk-through including some sample code (with notes) in plain English? --I would love you for ever and ever!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I ordered a 28x1 today, so I don;t feel totally useless browsing for the right manuals. I found this one. Is it anything like yours?

First: I already tripped over a minor spello. I think. Page 60 on the hpwm command in half mode writes "In half mode outputs A and C control a half bridge" . That has got to be "A and B", right?

When it goes on to say "The PWM signal is output on pin A", I interpret that as "the modulation is pushed out through that pin".

And "...the complementary PWM signal is..." reads to me like "The second pin always says the opposite of the first". Iguess that is what half mode is all about. The dead band delay is a safety feature.

About "active high" vs "active low". The picaxe does not know if your driver expects high TTL levels in the "on fase" of the pwm cycle. Or the opposite. Use the hpwm command to make that clear.

I am reading on, but don't hold your breath. Bedtime has passed.



Use full mode if you want forward AND reverse. But I do not believe the picaxe will let you control two motors. I am confusing myself now. Definately time for bed.

The picaxe manual refers to the " hpwm motor driver datasheet" but the only reference I found was on the picaxe forum archive where someone said the datasheet was being written. That was one year ago. I gave up on HPWM and stuck with pwmout

You can use speed control in two directions with the pwmout command. Remember that 75% in terms of pwm means the pwm pin is low 25% of the cycle and highthe other 75%

I connected output pin 1 and PWM1 (=input pin 1) to the motor driver for the motor A.

To move forward at 75% speed. make output 1 low and use pwm 1 with 75% of the cycle high.

To reverse at 75% speed. make output 1 high and use pwm 1 with 25% of the cycle high.

That way you only need 1 PWM signal per motorfor bi-directional speed control