14M pwm

sid

Senior Member
I'm a bit confused around the pwm and hpwm commands and the 14m.
The pin out and appendix for advance use shows PWM2 on pin C5.
In my simplistic way I would assume that there should be a PWM0 and a PWM1 as well but this is not shown. The data says that.......
"C5 can be used with the pwmout command, but will make this pin an output.
Pins C2-5 (hpwm A-D) can all be used with the hpwm command, but will also
make the corresponding pins outputs"

So I suppose my question is "what's the difference between PWM and HPWM and could I use a 14M to drive a small motor one way and then the other using pwm on two of these outputs" ?
Rgds,
Sid
 

BeanieBots

Moderator
Never assume;)

There is only one PWMout on the 14M and it is channel 2. (just like the manual says).

Whether or not you use PWMout (on C5) or the four HPWM channels depends on how/if you want to drive an H-bridge.

The simplest way of using PWM to drive a motor in both directions is use PWMout to drive a FET for speed control and a seperate output to control a relay for direction control.

If in dount about PWMout on a particular PICAXE chip, select the type of PICAXE in options and use the PWMout wizard. For the 14M, it will only give the option of channel 2.

eg PWMout 2,period,duty will output the PWM stream on C5.
 

sid

Senior Member
Thanks for that,
Could I use any axe (with four outputs) and then drive 4 transistors arranged as an H-Bridge to drive a motor in small increments?
 

BeanieBots

Moderator
Thanks for that,
Could I use any axe (with four outputs) and then drive 4 transistors arranged as an H-Bridge to drive a motor in small increments?
If you want PWM drive with that type of H-Bridge, then you will need those four outputs to be HPWM outputs.
The only other way would be to pulse the outputs in code.
I guess it depends what you mean by "small increments"
 

sid

Senior Member
Hi Russbow,
For what I had in mind probably not, but this is very useful, I've saved a copy for future reference/use, so thanks muchly for suggesting.

It might help if I explain What I am planning to do, (and I'm at the thinking stage at the moment). I confesse to being a railway modeller and we use these things called point motors to switch tracks. There are two types, the £5 version that slams the point blades from one position to the other and the £20 version that does the same but in a more realistic slow motion which is also kinder to hand built track. Both use eletro magnets to pull a metal bar towards which ever coil has been switched on.
I was thinking of using an axe to convert a £4 motor into a slow action motor possibly by the use of pwm. The other way would be to use a small electric motor controlled by pwm. I'd like to be able to replicate a working point motor as the planned layout will have in access of 20 point motors so keeping the component count low is a must.
The distance that has to be travelled is just 10mm.
If anyone has any suggestions, I'm open to any ideas
 

BeanieBots

Moderator
How about using a Hobby Servo.
You can control position and speed using the servo command.
They are available for about £5 (£2.50 if you hunt around), so no real change in price but much more control. No need to worry about drivers and PWM signals.
You can fit one to any regular PICAXE output or you could use the 21 servo controller board.
 

sid

Senior Member
How about using a Hobby Servo.
You can control position and speed using the servo command.
They are available for about £5 (£2.50 if you hunt around), so no real change in price but much more control. No need to worry about drivers and PWM signals.
You can fit one to any regular PICAXE output or you could use the 21 servo controller board.
Sounds interesting, I shall go do some research,
thanks for the pointer
 
Top