View previous topic :: View next topic |
Author |
Message |
Vacio
Joined: 15 Dec 2003 Posts: 2
|
How make a bounce free code? Help Please |
Posted: Thu Dec 18, 2003 4:20 am |
|
|
How make a bounce free by software code in the CCP1 and CCP2 interruptions?
here the code
Code: |
int8 T;
void Contador (void);
#int_CCP1
void CCP1_isr(void)
{
T=0;
}
#int_CCP2
void CCP2_isr(void) {
Contador();
}
void Contador (void)
{
T=T+1;
//output_B(T);
}
void main() {
setup_adc_ports(A_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_CAPTURE_FE);
setup_ccp2(CCP_CAPTURE_FE);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_CCP1);
enable_interrupts(INT_CCP2);
// enable_interrupts(INT_EXT);
enable_interrupts(global);
output_B(T);
}
|
any idea?
and the other question it's, how work the external interruption in the PIC16F84 in the CCS compiler, I did't work the code for me, help me please with my two newbie questions
Thanks for you answers
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 18, 2003 4:00 pm |
|
|
I'm not sure what your overall project is.
You're trying to use CCP capture mode, but
you have disabled Timer1. So the capture
mode will not work. You should look at some
CCS example files which show how to use the
CCP capture mode. These are:
EX_REACT.C
EX_CCPMP.C
These files are in this folder: c:\Program Files\Picc\Examples
To answer your other question about using INT_EXT with
the 16F84, you should study this example shown in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=17041 |
|
|
Vacio
Joined: 15 Dec 2003 Posts: 2
|
|
Posted: Mon Dec 22, 2003 9:03 am |
|
|
PCM programmer wrote: | I'm not sure what your overall project is.
You're trying to use CCP capture mode, but
you have disabled Timer1. So the capture
mode will not work. You should look at some
CCS example files which show how to use the
CCP capture mode. These are:
EX_REACT.C
EX_CCPMP.C
These files are in this folder: c:\Program Files\Picc\Examples
To answer your other question about using INT_EXT with
the 16F84, you should study this example shown in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=17041 |
Thanks Very Much PCM Programmer
I will read the example, and I will back later to the forum |
|
|
|