|
|
View previous topic :: View next topic |
Author |
Message |
z3ngew
Joined: 20 Apr 2013 Posts: 50
|
CCP1 & CCP2 does not work together |
Posted: Sun Sep 15, 2013 1:16 am |
|
|
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
|
|
Posted: Sun Sep 15, 2013 3:38 am |
|
|
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 |
|
|
|
|
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
|