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

Best method for clearing interrupt in PIC18F458?

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



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

Best method for clearing interrupt in PIC18F458?
PostPosted: Tue Jun 22, 2004 3:02 am     Reply with quote

In the CCS compiler the function clear_interrupt(int_ext) clears the interrupt by resetting the INTCON.INT0IF bit.

But in the datasheets for the PIC18F458 the description for the INTCON register bit INT0IF states: 'The INT0 external interrupt occurred (must be cleared in software by reading PORTB)'.

The CCS code is working, but now I'm wondering: Is the datasheet wrong or is the CCS code working because of some undocumented features in the hardware?
Ttelmah
Guest







Re: Best method for clearing interrupt in PIC18F458?
PostPosted: Tue Jun 22, 2004 8:00 am     Reply with quote

ckielstra wrote:
In the CCS compiler the function clear_interrupt(int_ext) clears the interrupt by resetting the INTCON.INT0IF bit.

But in the datasheets for the PIC18F458 the description for the INTCON register bit INT0IF states: 'The INT0 external interrupt occurred (must be cleared in software by reading PORTB)'.

The CCS code is working, but now I'm wondering: Is the datasheet wrong or is the CCS code working because of some undocumented features in the hardware?

That would appear to be an error in the data sheet. The 'B change' interrupts, require the register to be read to properly clear them (this resets the 'comparison' latch for the port), otherwise if the condition is still 'changed' from the last read, and the interrupt flag is cleared, the bit will immediately be set again. However this does not apply for the EXT interrups.
This comment appears to have been put on the wrong line in the data sheet.
If you compare the register entries here with those for the 18F452 (where this register is the same), this comment does not appear, but a comment does appear below the B change interrupt, saying that the port must be read.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jun 22, 2004 9:08 am     Reply with quote

Thanks. I already thought so, but wanted to make sure.
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