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

Clear Interrupts

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



Joined: 04 Nov 2004
Posts: 33

View user's profile Send private message Send e-mail

Clear Interrupts
PostPosted: Thu Nov 09, 2006 9:38 am     Reply with quote

Compiler: PCWH version 3.236
Controller: PIC16F628A
Supply Voltage: 5V

Is there a way to clear all interrupts? While searching in this forum I found the command "clear_interrupt(INT_TIMER0);" but it does not work with my version of compiler.

When I get in RB interrupt routine, I want to be to clear all other interrupts flags when I exit the RB interrupt in case my other interrupts occured while I was in the RB interrupt routine.

So, is there a C command which will clear all interrupt flags?

Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 09, 2006 12:30 pm     Reply with quote

Quote:
Is there a way to clear all interrupts?

In the 16F628A, the interrupt flags for the peripheral modules are
contained in two registers: PIR1 and INTCON. You could declare the
address of PIR1 with the #byte directive and then write 0x00 to it with
a line of code. You could declare the RBIF, INTF, and T0IF bits in
INTCON with the #bit directive and then write 0 to each one of them
with a line of code.

Look in the 16F628A data sheet, in the section on Special Function
registers, for a list of all the register addresses and bit locations.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Nov 09, 2006 3:28 pm     Reply with quote

Quote:

Is there a way to clear all interrupts?

Sorry if I miss understood your question but I canīt imagine a situation where it
will be necessary or useful to clear ALL interrupts.
It seems to me that there is an erroneous interpretation of interrupts handling.

An interruption is not generated if previously it has not arranged that this happens,
that is ENABLE_INTERRUPT(xxx).
If an interrupt had been triggered by an event, the corresponding interrupt
flag is cleared when such interrupt is serviced.
Erase ALL the interruptions without knowing wich of the peripherals generated
this interruption is at least a contradiction.

If you want to clear ALL interrupts, simply do not use them or do not ENABLE it.

The compiler versions that you are using handle interrupts properly, hence
let the compiler to do his job.

Anyway I suggest you to read a very good tutorial regarding interrupts written
by Peter Anderson.

http://www.phanderson.com/PIC/16C84/interrupts/interrupt_1.html

cheers,

Humberto
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