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

CCP1 and Timer3 on 16F183xx

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



Joined: 05 Nov 2010
Posts: 42
Location: Sweden

View user's profile Send private message Visit poster's website

CCP1 and Timer3 on 16F183xx
PostPosted: Sat Aug 07, 2021 5:06 am     Reply with quote

Compiler: 5.075
IDE: MPLAB-X 5.45
PIC: 16F18325

Dear gurus, once again I seek your help.

Manual says you may use TMR0/1/3/5 for CCP1, but the only constants I find in 16F18325.h are #define CCP_TIMER2/4/6 which are for PWM only according to me.

Things work if I set CCP1CON=0b10000101 and CCPTMRS=0b00000010 directly to regs, but not via setup_ccp1()

Since I often change uP types during development, I try to use CCS functions if possible.

Have I missed something here?


All the best:

/Björn
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sat Aug 07, 2021 7:41 am     Reply with quote

They are not for 'PWM only'.
This is a classic problem of CCS choosing names that are not really very
informative.
The setting for Timer4 when using the PWM, is exactly the same bits as
the setting for Timer3 when using the CCP. Similarly the setting for
Timer6 when using the PWM, is exactly the same bits as the setting for
Timer5 when using the CCP.
You can just use CCP_TIMER4 to use timer3 with the CCP and CCP_TIMER6
to use Timer5.
Obviously the associated timer has to be set to EXTERNAL_SYNC.

Sometimes the CCS 'choice of names', is really silly.
bdeb



Joined: 05 Nov 2010
Posts: 42
Location: Sweden

View user's profile Send private message Visit poster's website

PostPosted: Sat Aug 07, 2021 7:52 am     Reply with quote

D'oh!!

Should have spotted that myself while fiddling with the bits..
Since it had become 5:30 in the AM, I was probably happy to get it going..

Thank you Ttelmah for explaining!

All the best:

/Björn
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sat Aug 07, 2021 10:35 am     Reply with quote

I suggest you suggest to CCS that a name like PWM_TIMER4_CCP_TIMER3
would be much more sensible. Smile
bdeb



Joined: 05 Nov 2010
Posts: 42
Location: Sweden

View user's profile Send private message Visit poster's website

PostPosted: Sat Aug 07, 2021 10:55 am     Reply with quote

Spot on!

Even typing *that* would take shorter time than what I´ve spent saying unprintable Evil or Very Mad words to my computer!

Laughing
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Sun Aug 08, 2021 10:08 am     Reply with quote

Been there. Got the 'T' shirt....
I call it, "wall, head, impact technology testing".
bdeb



Joined: 05 Nov 2010
Posts: 42
Location: Sweden

View user's profile Send private message Visit poster's website

PostPosted: Sun Aug 08, 2021 11:52 am     Reply with quote

Aha! The old WHITT-syndrom! Laughing

If politicians where replaced by engineers - global peace && understanding would happen in 4 clock cycles..
pmuldoon



Joined: 26 Sep 2003
Posts: 218
Location: Northern Indiana

View user's profile Send private message

PostPosted: Wed Sep 08, 2021 8:54 am     Reply with quote

This thread needs to be saved in the archives, lol!
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