View Full Version : PWM PIN(S), DUTY, CYCLE ?Plural possible?
earltyso
- 17th November 2007, 02:11
I am sure this is a dumb question....but I will suck up my pride and ask it anyway..
Is it possible to use the PWM command on multiple pins?
ex:
pwm portb.0 & portb.1, 127, 3000
this does compile but only performs PWM on portb.1
I need to drive 2 seperate h-bridges at the same time and for the same # of cycles...
any help would be great.
Charles Linquis
- 17th November 2007, 04:19
This is probably a silly question, but if you are attempting to drive two pins with the same signal, at the same time and the same phase, why do you need TWO pins?
earltyso
- 17th November 2007, 18:18
As I stated, I am driving 2 seperate h-bridges...each bridge has 2 inputs. I have a total of 4 inputs to both h-bridges and want to always drive 2 pins at any one time.
if I want my robot to turn right I need to drive
'ex: not actual code...
rightwheelfw var portb.0
rightwheelrs var portb.1
leftwheelfw var portb.2
leftwheelrs var portb.3
turnright:
high rightwheelrs
high leftwheelfw
pause 50
goto commands
turnleft:
high rightwheelfw
high leftwheelrs
pause 50
goto commands
In my case though I want to have variable speed control not just HIGH.
This is why I want PWM on 2 pins at the same time.
mister_e
- 17th November 2007, 20:41
there's some PIC which give you 2 different CCP module and allow that.
There's also some PIC with ECCP (even a 12F615), which can be used to drive in half bridge/Full bridge mode + few feature such as dead band time. 18F2431/4431 are some good example.
http://ww1.microchip.com/downloads/en/DeviceDoc/39616C.pdf
depending your expected PWM frequency, Darrel's Muti_SPWM could be used
http://www.pbpgroup.com/modules/wfsection/article.php?articleid=12
Timer interrupt is another way to go.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.