Hi Nikos,
using this code:
Which is a derivitive of your code, I fought with the interrupt a bit.Code:;@ DEVICE PIC16F648A, INTRC_OSC_NOCLOCKOUT ;@ DEVICE pic16F648A, WDT_OFF ;@ DEVICE pic16F648A, PWRT_ON ;@ DEVICE pic16F648A, MCLR_OFF ;@ DEVICE pic16F648A, BOD_OFF ;@ DEVICE pic16F648A, LVP_OFF ;@ DEVICE pic16F648A, CPD_OFF ;@ DEVICE pic16F648A, PROTECT_OFF @ __CONFIG _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _LVP_OFF & _BODEN_OFF & _BOREN_OFF DEFINE OSC 4 DEFINE NO_CLRWDT 1 PORTA=0 TrisA = 255 trisb = %00000001 'RB0 as input CMCON = 7 ' Turn off comparators 'VRCON = %01101100 ' VRCON bit7 is OFF for no current drain OPTION_REG.7 = 1 ' 1=DISABLE INTERNAL PULLUPS,0=ENABLE OPTION_REG.6 = 1 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger LED VAR PORTA.2 INTCON = %11010000 ' 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 on interrupt goto cycle2 CYCLE: LOW LED 'pause 500 @ SLEEP ;@ nop ;@ nop ;@ nop disable cycle2: HIGH LED PAUSE 500 LOW LED PAUSE 500 INTCON = %11010000 enable GOTO CYCLE end
By setting port a as all inputs the sleep current dropped from 3.71 ma to 0.12 ma
The 16F648A was as close a chip to yours as I have.




Bookmarks