Hello boys and girls,
I use for a first time sleep mode with my 16F627 pic after searching and reading to the forum.
I manage to send my pic to sleep mode and I can wake it up with interrupt on portb.0.
My problem is the big Consumption in sleep mode.It is about 370uA
That is my code:
My hardwarev is simply a resistor from porta.2 with a Led to GND and XTL with 2capasitors.NOTHING MORECode:@ DEVICE PIC16F627, XT_OSC @ DEVICE pic16F627, WDT_OFF @ DEVICE pic16F627, PWRT_ON @ DEVICE pic16F627, MCLR_OFF @ DEVICE pic16F627, BOD_OFF @ DEVICE pic16F627, LVP_OFF @ DEVICE pic16F627, CPD_OFF @ DEVICE pic16F627, PROTECT_OFF DEFINE OSC 4 DEFINE NO_CLRWDT 1 CMCON = 7 'Turn off comparators VRCON=%01101100 'VRCON bit7 is OFF for no current drain OPTION_REG.7 = 0 ' 1=DISABLE INTERNAL PULLUPS,0=ENABLE LED VAR PORTA.2 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=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=1 ' 1=RB0 Rising-Edge Trigger, 0=Falling-Edge Trigger CYCLE: INTCON.1=0 ' Reset RB0 Flag INTCON.0=0 ' Reset PORTB change Flag ' ' Sleep ' ----- LOW LED @ SLEEP @ nop @ nop @ nop Pause 100 ' Needed for system Wake-Up HIGH LED PAUSE 5000 LOW LED GOTO CYCLE END
Please advice
Nikos





Bookmarks