pk178
Joined: 10 Mar 2010 Posts: 10
|
Help me with Capture Module in PIC16F887 |
Posted: Thu Apr 01, 2010 8:31 pm |
|
|
Hi everybody !
I want to use capture module in PIC16F887, this is my simple code :
Code: | #include <16f887.h>
#use delay(clock = 4000000)
#fuses LP,XT,EC_IO,INTRC,NOWDT,WDT,NOPUT,PUT
#use fast_io(d)
//******************************************************************************
int i = 0;
//******************************************************************************
#int_ccp1
void ccp1_isr(){
for(i = 0; i < 10; i++){
output_d(0xFF);
delay_ms(200);
output_d(0x00);
delay_ms(200);
}
}
void main(){
setup_oscillator(OSC_4MHZ);
output_d(0x00);
set_tris_d(0x00);
SETUP_CCP1(CCP_CAPTURE_FE);
SETUP_TIMER_1(T1_INTERNAL);
enable_interrupts(int_ccp1);
enable_interrupts(global);
while(1);
} |
I want PORTD will blinking if on CCP1 pin has falling edge pulse, but when I test, both falling pulse and rise pulse make PORTD blinking.
Please help me solve this prroblem. Thanks very much ! |
|