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

clear_interrupt

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



Joined: 19 Jun 2004
Posts: 2

View user's profile Send private message

clear_interrupt
PostPosted: Sat Jun 19, 2004 3:18 pm     Reply with quote

I am using the new version em4095.c driver but I still have an older CCS compiler (3.181), and a 16F877A.
My compiler does not have the "clear_interrupt()" built in function.

Question: Does anybody know how I can implement "clear_interrupt(INT_CCP1);" and "clear_interrupt(INT_CCP2);" ?

I have identified four Interrupt Flags (INTF, CCP1IF, TMR1IF, and CCP2IF)but I'm not sure which ones are necessary and what the precise code syntax should be. I have tried some things but nothing helped.

PS: The main symptom is in the CCS driver snippet where my CCP_1 is always zero.
Code:
#INT_CCP1
void isr_ccp1()
{
   int width;

   // Toggle between capturing rising and falling edges to meausure width
   if(RE_FE_TOGGLE)
   {
      setup_ccp1(CCP_CAPTURE_FE);
      RE_FE_TOGGLE = 0;
   }
   else
   {
      setup_ccp1(CCP_CAPTURE_RE);
      RE_FE_TOGGLE = 1;
   }

   // Calculate the width
   width = CCP_1 - old_clock;
   old_clock = CCP_1;

   switch(RF_readMode)
   {
      // Use to receive manchester formatted data from a transponder
      case RF_MANCHESTER_DATA:
      {
         if(width > 54)           // Check for a phase change
         {
            bitValue = ~bitValue; // Invert the save bit value
            storeData = TRUE;     // Force a bit store
         }


Thanks
Ken_o
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jun 20, 2004 12:43 am     Reply with quote

You are really asking two questions here.
1. How can I implement the new clear_interrupt() function
in my older version of the compiler ?
2. My program doesn't work. Please fix it for me.

It being the weekend, I'm going to answer the first, easy, question. Mr. Green

Here is part of a listing file, which was compiled for the 16F877A
with PCM vs. 3.202.

Code:
.................... clear_interrupt(INT_CCP1); 
000F:  BCF    PIR1.2
....................   
.................... clear_interrupt(INT_CCP2); 
0010:  BCF    PIR2.0

You can see that in the first line, CCS is clearing the CCP1IF flag in PIR1,
and in the 2nd line, they are clearing CCP2IF in PIR2.
So you could easily do the same thing by declaring those bits
with the CCS #byte and #bit statements. Then set them to 0.
Example:

Code:
#include <16F877A.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

#byte PIR1 = 0x0C
#bit CCP1IF = PIR1.2

#byte PIR2 = 0x0D
#bit CCP2IF = PIR2.0

void main()
{
CCP1IF = 0;     // Clear CCP1 interrupt enable flag

CCP2IF = 0;     // Clear CCP2 interrupt enable flag

while(1);
}
ken_o



Joined: 19 Jun 2004
Posts: 2

View user's profile Send private message

PostPosted: Sun Jun 20, 2004 3:45 pm     Reply with quote

Thanks for the prompt reply. It really did help my weekend efforts!

My clear_interrupt is working now, and your post helped me to advance to the "real" problem.

I believe the real cause was that I did not connect RDY/CLK clock pulse to pin C0 as well as C1.

Thanks again!!

ken_o
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