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

SET BIT IN PIC REGISTER

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



Joined: 05 Jul 2006
Posts: 15

View user's profile Send private message

SET BIT IN PIC REGISTER
PostPosted: Fri Jul 07, 2006 8:53 am     Reply with quote

HI, how can I set bit0 'ON' in PIC register PIE1?
epideath



Joined: 07 Jun 2006
Posts: 47

View user's profile Send private message

PostPosted: Fri Jul 07, 2006 9:07 am     Reply with quote

bit_set(PIE1,0);

where PIE1 is the register where PIE1 is located on your PIC.
Ttelmah
Guest







PostPosted: Fri Jul 07, 2006 9:19 am     Reply with quote

Further answers:

#byte PIE1=(put address here to suit the chip concerned)
#bit PIE1BIT0=PIE1.0

Then PIE1BIT0=1 will set it, and PIE1BIT0=0 will clear it.

Or, since PIE1.0, is normally the 'timer1 interrupt enable' bit, use the inbuilt instruction:

enable_interrupts(INT_TIMER1);

The latter has the advantage of remaining portable, if you change to another chip (16 to 18 for example). In general, I'd recommend this.

Best Wishes
JaSoN



Joined: 05 Jul 2006
Posts: 15

View user's profile Send private message

PostPosted: Fri Jul 07, 2006 9:45 am     Reply with quote

THANKS VERY MUCH!!
Gabor



Joined: 19 Jun 2012
Posts: 2

View user's profile Send private message

PostPosted: Tue Jun 19, 2012 6:42 am     Reply with quote

Ttelmah wrote:
Further answers:

#byte PIE1=(put address here to suit the chip concerned)
#bit PIE1BIT0=PIE1.0

Then PIE1BIT0=1 will set it, and PIE1BIT0=0 will clear it.

Or, since PIE1.0, is normally the 'timer1 interrupt enable' bit, use the inbuilt instruction:

enable_interrupts(INT_TIMER1);

The latter has the advantage of remaining portable, if you change to another chip (16 to 18 for example). In general, I'd recommend this.

Best Wishes


Hi I tried this:
Code:

#BYTE RCSTA=0x18;
#BIT RCSTABIT7=RCSTA.7;
 

But I am given an "Expecting a declaration" error message.

What is my mistake?
jeremiah



Joined: 20 Jul 2010
Posts: 1337

View user's profile Send private message

PostPosted: Tue Jun 19, 2012 7:47 am     Reply with quote

Try taking out the semicolons
Gabor



Joined: 19 Jun 2012
Posts: 2

View user's profile Send private message

PostPosted: Tue Jun 19, 2012 10:31 am     Reply with quote

Thank you it's work!!!
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