View previous topic :: View next topic |
Author |
Message |
JaSoN
Joined: 05 Jul 2006 Posts: 15
|
SET BIT IN PIC REGISTER |
Posted: Fri Jul 07, 2006 8:53 am |
|
|
HI, how can I set bit0 'ON' in PIC register PIE1? |
|
|
epideath
Joined: 07 Jun 2006 Posts: 47
|
|
Posted: Fri Jul 07, 2006 9:07 am |
|
|
bit_set(PIE1,0);
where PIE1 is the register where PIE1 is located on your PIC. |
|
|
Ttelmah Guest
|
|
Posted: Fri Jul 07, 2006 9:19 am |
|
|
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
|
|
Posted: Fri Jul 07, 2006 9:45 am |
|
|
THANKS VERY MUCH!! |
|
|
Gabor
Joined: 19 Jun 2012 Posts: 2
|
|
Posted: Tue Jun 19, 2012 6:42 am |
|
|
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: 1345
|
|
Posted: Tue Jun 19, 2012 7:47 am |
|
|
Try taking out the semicolons |
|
|
Gabor
Joined: 19 Jun 2012 Posts: 2
|
|
Posted: Tue Jun 19, 2012 10:31 am |
|
|
Thank you it's work!!! |
|
|
|