PWM and Servo together on 18M2

Hi there,

I am evaluating to buy the CHI035 high power board (using 18M2) but I am not sure wether I understand correctly what it says in the Manual 2 Page 167:

* On older PICAXE parts the same internal timer (timer2) is used for both
pwmout and servo, so these commands cannot be used at the same time.
However some newer parts have additional dedicated internal timers that allow
pwmout and servo to work together. This applies to these pwmout channels:
18M2 B.3, B.6


I want to drive 2 dc gear motors and 2 servos at the same time.
Setup:
PWMOUT on b.3 (Motor 1)
PWMOUT on b.6 (Motor 2)
SERVO on C.0 (Servo 1)
SERVO on C.7 (Servo 2)

Will this work together?

Thank you!
 
Hmmm...does this setup work then?

PWMOUT on b.3 (Motor 1)
PWMOUT on b.6 (Motor 2)
SERVO on B.1 (Servo 1)
SERVO on B.2 (Servo 2)

Thanks!
 
I am still very interested whether 2 servos and 2 DC-motors (setup above) will work with the high power board (CHI035)

Advice highly apreciated!
 

Technical

Technical Support
Staff member
B.3 is not the motor controller on CHI035 (motors are 4&5, 6&7)
The CHI035 is not designed to use pwmout for motor speed control, most useable pwmout frequencies are too high for 'toy' DC motors

However the rest is ok.
 
Bad news for me...what you write about the pwm frequencies puts me back to field 1....I guess underclocking is no option as well since it messes with the servo-command?

Just for my understanding: it's not possible to control the speed of a dc-motor using pwm (with the right frequency) and a FET? (No direction control requierd)

What hardware can you recommend that fullfill my needs? I have seen the instant robot shield but I was hoping for a single-PCB solution....
 
Bad news for me...what you write about the pwm frequencies puts me back to field 1....I guess underclocking is no option as well since it messes with the servo-command?

Just for my understanding: it's not possible to control the speed of a dc-motor using pwm (with the right frequency) and a FET? (No direction control requierd)

What hardware can you recommend that fullfill my needs? I have seen the instant robot shield but I was hoping for a single-PCB solution....
 

erco

Senior Member
Yes, one mosfet and manual bit banging to achieve a ~10 hz pwm signal works fine on a small dc motor.

Sure would be nice if the PWM command would go that low. And if IROUT gave a 38 khz signal instead of 40 khz. And if ULTRA worked with cheap HC-SR04s. And SOUND wasn't a blocking command. And RFIN/OUT worked with Bluetooth instead of Manchester coding. A guy can dream...? :)
 
Last edited:
Top