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 & CCP2 does not work together

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



Joined: 20 Apr 2013
Posts: 50

View user's profile Send private message

CCP1 & CCP2 does not work together
PostPosted: Sun Sep 15, 2013 1:16 am     Reply with quote

Hello everyone,
I am trying to use both ccp1 and ccp2 in the compare mode, the isr of ccp1 is running but the isr of ccp2 only respond one time, i don't know what is the problem, but when i disable interrupt at int_ccp1, ccp2 isr works great, i think timer 3 does not reset or something


Code:
#int_CCP1
void CCP1_isr()
{
//ccp1 isr routine
}

#int_CCP2
void CCP2_isr()
{
//ccp2 isr routine
}

setup_ccp1(CCP_COMPARE_INT);
setup_ccp2(CCP_COMPARE_INT);
setup_timer_1 ( T1_INTERNAL | T1_DIV_BY_2 );
setup_timer_3 ( T3_INTERNAL | T3_DIV_BY_4 );
enable_interrupts(INT_CCP1);
enable_interrupts(INT_CCP2);
enable_interrupts(GLOBAL);


Thanks in advance,
z3ngew
Ttelmah



Joined: 11 Mar 2010
Posts: 19543

View user's profile Send private message

PostPosted: Sun Sep 15, 2013 3:38 am     Reply with quote

What chip?. What compiler version?.

Though the CCP's are pretty generic, the settings do differ.

Why should timer3, enter the equation?. You are not setting CCP2 to use timer3. Each CCP module, can normally use timer1, or timer3, and defaults to timer1. There is a setting in the configuration for the CCP, to say which timers to use. Varies with compiler/chip. On new compilers, on a 18F45xx:
Code:
setup_ccp2(CCP_COMPARE_INT | T3_CCP2);

etc.

Show a minimum test program we can actually try. Only running once, suggests that something in an ISR is actually resulting in blocking.

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