You are close, you have many of the elements required.
Go to your manual and take a look at ON INTERRUPT. You should be able to see what is missing.
When you say "low power", are you wanting the chip to sleep until a button is pressed?
You are close, you have many of the elements required.
Go to your manual and take a look at ON INTERRUPT. You should be able to see what is missing.
When you say "low power", are you wanting the chip to sleep until a button is pressed?
Dave
Always wear safety glasses while programming.
no need for any ON INTERRUPT here. One thing you MUST look at first is if RB_INT can wake up the PIC. Also double check your configuration fuses AND all INT related registers. INTCON and the likes.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Yup, but the OP did ask about interrupts, so I figured he may as well start with the basics...![]()
Dave
Always wear safety glasses while programming.
I know Dave but looking at the original code
should have give you some pointer? OK OK OK I'm being a smart a55 as usualCode:ASM sleep ENDASM
</pre>
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
PORTB change interrupt interrupts twice when :
first > the pin goes low
Second > the pin goes high.
Thus, pin toggle happens twice and ends up at the same state.
You should use a flag, or bounce until the second interrupt occurs.
____________
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
This interrupt can wake the device from the Sleep
mode, or any of the Idle modes. The user, in the
Interrupt Service Routine, can clear the interrupt in the
following manner:
a) Any read or write of PORTB to clear the mismatchsource or destination of a MOVFF instruction).
condition (except when PORTB is the
b) Clear the flag bit, RBIF.
A mismatch condition will continue to set the RBIF flag bit.
Reading or writing PORTB will end the mismatch
condition and allow the RBIF bit to be cleared. The latch
holding the last read value is not affected by a MCLR nor
Brown-out Reset. After either one of these Resets, the
RBIF flag will continue to be set if a mismatch is presenta great classical ...
I didn't see anything about the WDT nor ... but config is not shown ...
Alain
Last edited by Acetronics2; - 24th January 2011 at 13:56.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks