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

Disable Low Priority Interrupts

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



Joined: 27 Dec 2006
Posts: 8

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

Disable Low Priority Interrupts
PostPosted: Mon Aug 27, 2007 2:21 am     Reply with quote

How i can disable only the low priority interrupts
Ttelmah
Guest







PostPosted: Mon Aug 27, 2007 3:06 am     Reply with quote

This is just a case of CCS, not giving you all the 'define' options they should. Something like (check the data sheet for your chip, and that the two bits are the top two bits of the INTCON register):
Code:

#define HIGH_ON 0xF280
#define LOW_ON 0xF240

disable_interrupts(GLOBAL);
enable_interrupts(HIGH_ON);

Should enable the high priority interrupts only.

Best Wishes
cLuciano



Joined: 27 Dec 2006
Posts: 8

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

PostPosted: Mon Aug 27, 2007 3:16 am     Reply with quote

Supposing all the interruptions are already enabled.
Is correct the following procedure to disable only the low priority interruptions:

#inline
void disable_interrupts_lowPriority(void)
{
#asm
loop:
bcf INTCON,GIEL
btfsc INTCON,GIEL
goto loop
#endasm
}
Ttelmah
Guest







PostPosted: Mon Aug 27, 2007 9:55 am     Reply with quote

It is unnecessary to use assembler for this sort of thing:
Code:

#byte INTCON=0xFF2
#bit GIEL=INTCON.6

while (GIEL) GIEL=0;

The loop shown, is not needed on most PICs (just set GIEL=0). Check the data sheet on this. On most, interrupts are _disabled_ automatically when you access the INTCON register. There are a few, with an erratum, where interrupts are left enabled, and the instruction will get missed, if an interrupt occurs while the bit is being cleared. There are also some, where it is advised, that you should disable the interrupts, before changing any bit in this register, and some others, where this only applies when using the 'MOVFF' instruction. Really safer to disable, and then set just the required bit.

Best Wishes
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