|
|
View previous topic :: View next topic |
Author |
Message |
Begineer Guest
|
A small question on PWM |
Posted: Mon Aug 15, 2005 8:10 am |
|
|
Hi Everyone
i m using a 16F877A PIC , and i m trying to control 2 DC motors using the Built-in PWM
when i checked ex_pwm.c, how come they ask us to use C2, lets say
i have 2 counters
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
and i setup 2 duties for 2 different motors
set_pwm1_duty(X1);
set_pwm2_duty(X2);
how can i know where to connect my H-Bridge from the DC motor C1 , C2 ....??
i know in the HEader file of 16f877a.h
it says
#define CCP_PWM 0xC
which means i m using port C, but how can choose and know which pin in Port C to use
i hope i made myself Clear |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Aug 15, 2005 8:14 am |
|
|
Read the datasheet for the PIC. It will tell you where the PWM outputs are. |
|
|
Beginner Guest
|
|
Posted: Mon Aug 15, 2005 10:09 am |
|
|
I could't find it on the Manual of the Chip |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Aug 15, 2005 11:40 am |
|
|
Are you trying to tell me that you read the datasheet for the PIC and could not determine which outputs were the PWM's? I'd suggest that you look again!
CCP1 is RC2
CCP2 is RC1 |
|
|
Guest
|
Re: A small question on PWM |
Posted: Mon Aug 15, 2005 11:54 am |
|
|
Begineer wrote: | Hi Everyone
i m using a 16F877A PIC , and i m trying to control 2 DC motors using the Built-in PWM
when i checked ex_pwm.c, how come they ask us to use C2, lets say
i have 2 counters
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
and i setup 2 duties for 2 different motors
set_pwm1_duty(X1);
set_pwm2_duty(X2);
how can i know where to connect my H-Bridge from the DC motor C1 , C2 ....??
i know in the HEader file of 16f877a.h
it says
#define CCP_PWM 0xC
which means i m using port C, but how can choose and know which pin in Port C to use
i hope i made myself Clear |
2 different motors? So you mean two different H-bridges too?
You plan on controlling them with four independent PWMs each?
I don't know how you plan on hooking the h-bridge up (let alone TWO h-bridges), with just 2 pwms.
Go read the ECCP on a pic18f448. you might even need a dspic or an 18f4431 to control two motors with an h-bridge. |
|
|
sseidman
Joined: 14 Mar 2005 Posts: 159
|
Re: A small question on PWM |
Posted: Mon Aug 15, 2005 12:09 pm |
|
|
Anonymous wrote: |
2 different motors? So you mean two different H-bridges too?
You plan on controlling them with four independent PWMs each?
I don't know how you plan on hooking the h-bridge up (let alone TWO h-bridges), with just 2 pwms.
Go read the ECCP on a pic18f448. you might even need a dspic or an 18f4431 to control two motors with an h-bridge. |
I'm using the L293 quad half h-bridge chip. I use PWM into the enable, and the h-bridge just gets direction controls
Scott |
|
|
beginner Guest
|
Re: A small question on PWM |
Posted: Tue Aug 16, 2005 7:56 am |
|
|
Anonymous wrote: | Begineer wrote: | Hi Everyone
i m using a 16F877A PIC , and i m trying to control 2 DC motors using the Built-in PWM
when i checked ex_pwm.c, how come they ask us to use C2, lets say
i have 2 counters
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
and i setup 2 duties for 2 different motors
set_pwm1_duty(X1);
set_pwm2_duty(X2);
how can i know where to connect my H-Bridge from the DC motor C1 , C2 ....??
i know in the HEader file of 16f877a.h
it says
#define CCP_PWM 0xC
which means i m using port C, but how can choose and know which pin in Port C to use
i hope i made myself Clear |
2 different motors? So you mean two different H-bridges too?
You plan on controlling them with four independent PWMs each?
I don't know how you plan on hooking the h-bridge up (let alone TWO h-bridges), with just 2 pwms.
Go read the ECCP on a pic18f448. you might even need a dspic or an 18f4431 to control two motors with an h-bridge. |
i m sorry my mistake i ll be controling a one-way motor , which means i won't be needing a full H bridge, the motors will go only for one direction ,, and i figured out the PWM registers for 16f877A they are
RC1 -->set_pwm2_duty()
RC2----> set_pwm1_duty()
thanks guys |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: A small question on PWM |
Posted: Tue Aug 16, 2005 7:59 am |
|
|
beginner wrote: | Anonymous wrote: | Begineer wrote: | Hi Everyone
i m using a 16F877A PIC , and i m trying to control 2 DC motors using the Built-in PWM
when i checked ex_pwm.c, how come they ask us to use C2, lets say
i have 2 counters
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
and i setup 2 duties for 2 different motors
set_pwm1_duty(X1);
set_pwm2_duty(X2);
how can i know where to connect my H-Bridge from the DC motor C1 , C2 ....??
i know in the HEader file of 16f877a.h
it says
#define CCP_PWM 0xC
which means i m using port C, but how can choose and know which pin in Port C to use
i hope i made myself Clear |
2 different motors? So you mean two different H-bridges too?
You plan on controlling them with four independent PWMs each?
I don't know how you plan on hooking the h-bridge up (let alone TWO h-bridges), with just 2 pwms.
Go read the ECCP on a pic18f448. you might even need a dspic or an 18f4431 to control two motors with an h-bridge. |
i m sorry my mistake i ll be controling a one-way motor , which means i won't be needing a full H bridge, the motors will go only for one direction ,, and i figured out the PWM registers for 16f877A they are
RC1 -->set_pwm2_duty()
RC2----> set_pwm1_duty()
thanks guys |
Yeah, I already told you that. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|