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

Why is a loop included in disable_interrupts?

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



Joined: 25 Aug 2004
Posts: 66

View user's profile Send private message

Why is a loop included in disable_interrupts?
PostPosted: Tue Aug 28, 2007 12:17 am     Reply with quote

Hello,

The code generated (18F2620) to disable global interrupts is as follows...

Code:

....................    disable_interrupts(GLOBAL);
00028:  BCF    FF2.6
0002A:  BCF    FF2.7
0002C:  BTFSC  FF2.7
0002E:  BRA    002A


FF2.6 and FF2.7 are INTCON.GIEL and INTCON.GIEH respectively. Does anyone know why PCH includes the loop? I have never seen any Microchip documentation or errata that offer an explanation.

/Cheers, Ross.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 28, 2007 12:52 am     Reply with quote

See AN576:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en027642
Ttelmah
Guest







PostPosted: Tue Aug 28, 2007 3:18 am     Reply with quote

Add though the following:
I was told by an engineer at Microchip, that on _most_ 18 chips, it is not necessary. They added a latch, so that interrupts are automatically disabled during accesses to the INTCON register.
If you look at some of the Mcrochip examples for some 18 chips, they do just simply access the bits, and don't bother to loop. However there are quite a few erratas for interrupt enable/disable on some chips, and a few bring back the need to do this on specific chips. I'd suspect that CCS, are 'playing it safe', and assuming that the latch doesn't work...

Best Wishes
RossJ



Joined: 25 Aug 2004
Posts: 66

View user's profile Send private message

PostPosted: Tue Aug 28, 2007 4:54 am     Reply with quote

Thankyou both.
/Cheers, Ross.
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