Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM on 18F4525

Status
Not open for further replies.

futz

Active Member
I've been grinding through the 18F4525 datasheet PWM sections and, unless I'm mistaken (I probably am :p), it looks to me like you have to have both PWMs running off the same timer. Therefore they have to have the same duty cycle. This just won't do it for me. I need two independant duty cycles.

Do I have to build my own PWM with a different timer for the second motor output?

I'll be working on this more tonight. Must go to work now.
 
blueroomelectronics said:
Same period, independant duty though. CCP1 CCP2
But of course! :p Both wheels PWMing independantly now. Should have this thing at least attempting to balance by tonight. Tomorrow or Sunday at the latest. :D

I didn't need independant PWM to get it balancing, but for steering later I do.

I think what was throwing me on the datasheet was part of the Enhanced PWM chapter. I should have never looked at it. It just confused me.
 
Last edited:
I got the balancer attempting to balance itself. I think it might even work with accelerometer only. But it's going to need faster motors and/or bigger wheels. It can't begin to catch itself. It's doing all the right things. The accelerometer is sensing the slightest tilt and turning on the motors correctly, but the motors just aren't fast enough to catch and correct the tilt.

In a lot of balancing robot web-sites I see the guy mention switching to bigger wheels or faster motors. Now I know why. :D

Now I'm going to dig through all my motors and wheels and see what I can come up with for tomorrow.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top