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 support@ccsinfo.com

Check the Flag of Time interrupt in EXTinterrupt use18F27K40

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



Joined: 09 Feb 2005
Posts: 48

View user's profile Send private message

Check the Flag of Time interrupt in EXTinterrupt use18F27K40
PostPosted: Fri Jan 11, 2019 4:55 am     Reply with quote

Is it possible to check the flag of Timer0 in EXT interrupt. I mean:
Code:

#INT_EXT1
void  EXT1_isr(void)
{
   if (Now_Timer0_interrupted_andwaiting_finish_thisprocess==True)
   {
      do_something
      tTimer0 overflow and waiting
   }
   else {
     do_something
     Don't worry about Timer0
   }
}

#INT_TIMER0
void  TIMER0_isr(void)
{
   clear_timer0_interrupt
   not important
}

is there any key or Flag statement for variable in my program that is "Now_Timer0_interrupted_andwaiting_finish_thisprocess"
temtronic



Joined: 01 Jul 2010
Posts: 9097
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Jan 11, 2019 6:27 am     Reply with quote

Yes, you can read the status of the TMR0IF bit in the INTCON register. While I don't have your PIC, I'll assume it's similar to the 18F46K22 and it can, fairly confident all PICs can.

Just be sure NOT to have some loop withing the ISR, or 'math' or prints.. just set a flag and exit.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Fri Jan 11, 2019 8:11 am     Reply with quote

Command in CCS, is 'interrupt_active'.

So in your INT_EXT, you can simply use:

if (interrupt_active(INT_TIMER0))

and then execute what you want to do if this interrupt is active.

Remember you will have to clear it. The standard interrupt handler
does this for you, (you are showing a clear in your code - this means it is
being cleared twice - if you want the compiler to not clear it, add 'NOCLEAR'
after the interrupt declaration.
Handling the interrupt yourself, you will need to add the 'clear_interrupt' code.
sraiderk



Joined: 09 Feb 2005
Posts: 48

View user's profile Send private message

PostPosted: Tue Feb 05, 2019 6:15 am     Reply with quote

Thank you for perfect explanation now and all before..
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