Hi, Charudatt
Do not worry !!! This is certainly one of the least documented feature of PBP ...
DEFINE INTHAND _INTER ...
1) keeps prog mem locations 2 and 3 free ...
2) places a GOTO _INTER at location 4 ... or a bit further if more than 1 program page ...and COULD need context saving.
_INTER ( Note the Leading Underscore ) is the PBP "INTER:" Label readable by Assembler ...
Consider it as a "classical" GOTO ... but you reach it when an "interrupt reason" occurs ... no latency then.
INIT (Without Underscore !!! ) is the first ASSEMBLER line your Program really executes at power ON ...
So, as is ... you can i.e. restart your PIC, ... without using MCLR - if not disposable !!!
... or goto the label you want !!!
Alain
************************************************** ***********************
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 " !!!
*****************************************
Allain,
I was right. Clearing GIE does work as it does on the '690. It will wake and continue without needing an interrupt handler.
Ron
<table><td>Vermont : 1
France : 0</td><td></td></table>
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
************************************************** ***********************
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 " !!!
*****************************************
The little window says if GIE is 0 and both the flag bit and enable bit are set, it will treat the sleep command as a nop. If the flag bit is cleared, it will sleep. It IS confusingly written!
ALAIN,
It still does not work,
"DEFINE INTHAND INIT" , maybe puts it to sleep and never comes out.
and "DEFINE INTHAND _BLINK" keeps the led blinking.
regards
Hi, RON
Ok, Thanks for the explanation ...
It really might be written instead of BUT ... : AND any interrupt ... !!!
So, appears no real need to set the GIE bit here ...
Back to Charudatt's program ...
mighn't there be a PORTB reading ... ( to end the "mismatch condition" ) ???.
Alain
Charudatt :
1) DEFINE ...INIT ... the result is quite normal !!! Pic wakes up to fall asleep ...
2) if the led keeps blinking means ... the program always stay in the interrupt stubb !!! We've traced it now.
in this case ... interrupt flags are not cleared ... : good reason, no ?
Last edited by Acetronics2; - 13th May 2007 at 10:54.
************************************************** ***********************
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 " !!!
*****************************************
Hi, Charudatt
Straight from my test bench :
@ __CONFIG _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _LVP_OFF & _PWRTE_OFF & _CP_OFF & _BODEN_OFF
DEFINE NO_CLRWDT 1
DEFINE LCD_EBIT 1
CMCON=7
VRCON=%01101100 'VRCON bit7 is OFF for no current drain
OPTION_REG.7 = 1 ' DISABLE INTERNAL PULLUPS
Porta = 0
PORTB = 0
Trisa = %11111111
Trisb = %01111111
LED VAR PORTB.5
SleepLed var PORTB.7
Dummy var byte
'
' PIC Low-Power Sleep Routine
' ---------------------------
'
' Set Sleep Interrupts
' --------------------
INTCON=%00010000 ' Interrupt Control Register
' 7=0 - GIE - Global Interrupt Enable
' 6=0 - PEIE - Peripheral Interrupt Enable
' 5=0 - TOIE - TMR0 Overflow Interrupt Enable
' 4=1 - INTE - RB0/INT Enable
' 3=0 - RBIE - PORTB change interrupt Enable
' 2=0 - TOIF - TMR0 Overflow Flag
' 1-0 - INTF - RB0/Ext Interrupt Flag
' 0=0 - RBIF - PORTB Interrupt Flag
OPTION_REG.6=1 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger
PAUSE 500
LCDOUT $FE,1
CYCLE:
'
' Reset Interrupt Flags
' ---------------------
INTCON.1=0 ' Reset RB0 Flag
INTCON.0=0 ' Reset PORTB change Flag
'
' Sleep
' -----
LOW LED
LCDOUT $FE,2 , "*** SLEEPING ***"
High Sleepled
@ SLEEP
Dummy = PORTB
LOW SleepLed
@ nop
@ nop
@ nop
Pause 100 ' Needed for system Wake-Up
HIGH LED : PAUSE 200
LCDOUT $FE,1, " HURRY UP "
PAUSE 5000
LOW LED
GOTO CYCLE
END
CONFIG Modified to suit MPLAB Requirements ...
I used a LCD to show what happening and fixed LEDs for Wake (green) /Sleep ( Red ) states ...
disabled CLRWDT PbP insertions ... ( a passing idea ??? )
also disabled the WPU ... but that is not problematic.
also changed LEDs PORTs ...
As PORTB was used ... I did not try "Interrupt change on PortB" ... but works great with B.0 interrupt.
Works fine ... as you intended to program it !!!
Regards
Alain
Last edited by Acetronics2; - 13th May 2007 at 14:11.
************************************************** ***********************
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