Hi, Charudatt

Here it is :





@ __CONFIG _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _LVP_OFF & _PWRTE_OFF & _CP_OFF & _BODEN_OFF

DEFINE NO_CLRWDT 1
DEFINE INTHAND _Blink


CMCON=7
VRCON=%01101100 'VRCON bit7 is OFF for no current drain
OPTION_REG.7 = 0 ' ENABLE INTERNAL PULLUPS
Porta = 0
PORTB = %11110001
Trisa = %11110011
Trisb = %11111111

LED VAR PORTA.2
SleepLed var PORTA.3
Dummy var byte

'
' PIC Low-Power Sleep Routine
' ---------------------------
'
' Set Sleep Interrupts
' --------------------
INTCON=%10011000 ' 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=1 - 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 = 0 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger

CYCLE:
'
' Reset Interrupt Flags
' ---------------------

INTCON.1 = 0 ' Reset RB0 Flag
INTCON.0 = 0 ' Reset PORTB change Flag
INTCON.7 = 1
'
' Sleep
' -----
LOW LED

High Sleepled

@ SLEEP
@ nop

Blink:

Dummy = PORTB
Pause 100 ' Needed for system Wake-Up

LOW SleepLed

HIGH LED

While ( PORTB >> 4 ) <> %00001111
Wend

PAUSE 200

PAUSE 5000
LOW LED

GOTO CYCLE

END



As you see it's not so different from the "non interrupted" way ...

But, IF I correctly understand Mel ( one more time, Mel : You're the one and Only ... !!! - no sexual meanings hidden ( LOL) ) , the interrupt way could fit both 628 and 628A ...

I must say I used a 16F628-04 batch N° 0145H9F for tests ( I do not have any 628A ... but will run a try with a brand new 648A.

********************************************
********************************************
A little "bug" in the "non interrupted" listing ... to correct:

TRISB must be % 11111111 ... instead of % 01111111

I was wondering why PortB.7 was inactive .... LOL !!!


Have fun, and read you soon

regards

Alain