need same phase 2 pwm pulses

Status
Not open for further replies.

raman00084

Full Member level 6
Joined
Nov 29, 2010
Messages
375
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
4,076
i am using pic ccs complier ic name pic 18f4620

my servo motor needs pulse train that is if i give 1000 pulses it will move 1 full ratation 360 deg.

i want to control two servo motors simultaneously that is the phase difference of the two pulses must be same ( nano second tolerance is ok)

my doubt is it is possible to get pulses from pwm say for example 100 pulses or 200 pulses

how to do this i need 2 channel pulses for controlling 2 motors simultaneously

i have 2 pwm channels in my chip kindly help me


regards kalyan
 

Im little confused with question but i will try answering based on what i understood from question.

If you want two separate PWM of different frequencies then u need two different time bases but the device only has one timer2. SO at any instant, the PWM generated will have same frequency. The duty cycle can be different as there are more than 1 CCP module.
Again, if u need phase difference between two PWM's, u again need two CCP's with two different time bases i.e. timer2 and timer4. Bcoz using only one time base i.e. timer2, when TMR2 to PR2 match will occur the output will automatically go high for both CCP PWM out. Two CCP with two time base are required for this. There are PWM modules like COG, CWG and PSMC which does have their own internal time base and does not depend on timer modules to provide time base found in PIC16F170x, PIC16F161x, PIC16F178x etc.
Also using one COG/CWG/ECCP i.e. complementary output generator or enhanced CCP module (already in ur selected MCU), u can generate two PWM's of 180 degrees phase shift automatically. But anything more or less phase shift, two modules are required.

Hope that helps.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…