Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 9th May 2008, 03:07 PM   #1 (permalink)
Experienced Member
 
 
Join Date: Sep 2007
Location: Vancouver, B.C.
Posts: 900
futz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to all
Default PWM on 18F4525

I've been grinding through the 18F4525 datasheet PWM sections and, unless I'm mistaken (I probably am ), 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.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is online now   Reply With Quote
Old 9th May 2008, 03:12 PM   #2 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: Toronto, Canada
Posts: 4,123
Blog Entries: 1
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

Same period, independant duty though. CCP1 CCP2
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now   Reply With Quote
Old 9th May 2008, 03:44 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Location: Balanga City,Philippines
Posts: 5
joseph@e-tech is on a distinguished road
Send a message via Yahoo to joseph@e-tech
Default

Quote:
Originally Posted by blueroomelectronics
Same period, independant duty though. CCP1 CCP2
what do you mean sir?
joseph@e-tech is online now   Reply With Quote
Old 9th May 2008, 03:47 PM   #4 (permalink)
Experienced Member
 
 
Join Date: Jan 2007
Location: Toronto, Canada
Posts: 4,123
Blog Entries: 1
blueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to beholdblueroomelectronics is a splendid one to behold
Send a message via Skype™ to blueroomelectronics
Default

The two PWM outputs share a common clock (period) but have their own duty registers.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is online now   Reply With Quote
Old 9th May 2008, 03:51 PM   #5 (permalink)
New Member
 
Join Date: Apr 2008
Location: Balanga City,Philippines
Posts: 5
joseph@e-tech is on a distinguished road
Send a message via Yahoo to joseph@e-tech
Default

they have the same period but they can have there own pulse width
joseph@e-tech is online now   Reply With Quote
Old 9th May 2008, 07:54 PM   #6 (permalink)
Experienced Member
 
 
Join Date: Sep 2007
Location: Vancouver, B.C.
Posts: 900
futz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to all
Default

Quote:
Originally Posted by blueroomelectronics
Same period, independant duty though. CCP1 CCP2
But of course! Both wheels PWMing independantly now. Should have this thing at least attempting to balance by tonight. Tomorrow or Sunday at the latest.

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.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================

Last edited by futz; 9th May 2008 at 07:56 PM.
futz is online now   Reply With Quote
Old 10th May 2008, 04:49 AM   #7 (permalink)
Experienced Member
 
 
Join Date: Sep 2007
Location: Vancouver, B.C.
Posts: 900
futz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to allfutz is a name known to all
Default

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.

Now I'm going to dig through all my motors and wheels and see what I can come up with for tomorrow.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Latest
PWM Sort of question AtomSoft Micro Controllers 10 30th April 2008 02:32 PM
PWM feature doubt raviram87 Micro Controllers 3 6th April 2008 03:57 AM
PWM signal problem iznalgnaij Robotics Chat 4 25th March 2008 12:40 PM
PIC PWM outputs? Andy1845c Micro Controllers 33 30th November 2007 03:06 AM
PWM using software AtoD jeremygaughan Micro Controllers 11 27th November 2007 11:11 PM


All times are GMT. The time now is 03:44 PM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 (Unregistered)