CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PWM and two ccp at the same time?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PWM and two ccp at the same time?
PostPosted: Sat Aug 01, 2009 2:15 pm     Reply with quote

Hi,

Can I have a pwm signal at ccp1 pin and 2 ccp interrupts working at the same time? It is a PIC18F.

Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 01, 2009 2:25 pm     Reply with quote

See this example file:
Quote:
c:\Program Files\PICC\Drivers\Ex_Servos.c

It has interrupt routines for both CCP1 and CCP2.
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Sat Aug 01, 2009 2:33 pm     Reply with quote

Thank you for the answer.

Yes, both CCP interrupts working is fine. Let me explain better this time.

Both CCP interrupt only (no CCP1/CCP2 pin toggling just comparator match) plus PWM using timer2 on CCP1 pin.
Ttelmah
Guest







PostPosted: Sat Aug 01, 2009 2:51 pm     Reply with quote

Only on chips with a third CCP.
Some of the chips wth the ECCP module, have this as well as the standard two CCP's. The same registers are used on a CCP, to record the count values, _or_ to control it as a PWM. You can't perform both functions with one module.

Best Wishes
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Sat Aug 01, 2009 3:25 pm     Reply with quote

Ok, the chip is the PIC18F4620, with ECCP. It is not clear to me in the datasheet if it is possible to do what I want.

The family I see with more than 2 ccp is the dspic. Do you know one of the 18F with 3 ccp?
Ttelmah
Guest







PostPosted: Sun Aug 02, 2009 2:28 am     Reply with quote

The ECCP on your chip, replaces CCP1.
If you look at Figure 16-1, you will see that the ECCP, has only one set of CCP registers (meaning only one capture possible), so your chip has a total of just two channels.
Chips in the 18J family (like the 18J50), have two normal CCP channels, _plus_ one or more ECCP modules, rather than having the ECCP replacing one of the normal CCP channels, and (for this example), there are three separate ECCP modules, rather than just a single register set, with multiple outputs, giving up to five CCP channels.
Generally, the 'extra' CCP channel chips, are all higher pin count devices, since implementing multiple channels all supporting capture or PWM, means lots of pins are needed. Chips like the 18F87J10, are the 'smallest', offering the extra channels I know of.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 02, 2009 2:54 pm     Reply with quote

The 18F4431 series might do what you need. Look at the data sheet
and at this demo program:
http://www.ccsinfo.com/forum/viewtopic.php?t=37206
Ttelmah
Guest







PostPosted: Mon Aug 03, 2009 2:36 am     Reply with quote

Yes, that ought to do what is wanted.
The funny thing was, I was 'sure' I had used a 40pin device wth an extra PWM, but could not find it when I looked.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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