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

Help me with Capture Module in PIC16F887

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



Joined: 10 Mar 2010
Posts: 10

View user's profile Send private message

Help me with Capture Module in PIC16F887
PostPosted: Thu Apr 01, 2010 8:31 pm     Reply with quote

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 !
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Sat Apr 03, 2010 7:58 am     Reply with quote

How are you generating that rising/falling edge? If it's with a pushbutton, you may well be seeing the contacts bounce when it changes state. So whichever way the button is going, there is at least one lowgoing electrical edge.
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