Sleep mode not functionning


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default Sleep mode not functionning

    Hi,

    I am trying to use the sleep command (assembler way) with and without the LCD as shown in my code. Either way it does not seem to work because without the LCD I always get 22mA from my 12v batteries and with the LCd module about 85mA . Can someone tell me why the sleep command do not work.
    I know I dont have any interrupt to get out of sleep, but first thing first
    Thanks
    ken


    Code:
    'using a pic16F88
    ' MPASM  Header
    
    
    INCLUDE "modedefs.bas"
     OSCCON = %01110000 '8 Mhz
     Define OSC 8 
     
     
    '///////////////////////////
    '// Interrupt section //
    '///////////////////////////
    'ON INTERRUPT Goto MyInterrupt
    ' INTCON = %10010000
     
     
    CMCON = 7 : ANSEL = 0 : ADCON1 = 7
    '/////////////////////////
    '// LCD configuration //
    '/////////////////////////
    
    DEFINE LCD_DREG PORTA ' Set LCD Data port
    DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
    DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTA ' Set LCD Enable port
    DEFINE LCD_EBIT 7 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 500
    
    
    Mainloop:
    
    
     lcdout $FE,1, "Test: ", dec 22 
     PAUSE 3000         
    
    @sleep
    
            
    goto Mainloop
    
    end

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Sleep mode not functionning

    I read in a post that I needed to chang the GIE in the INTCON register.. so I did with no luck:

    INTCON.7 = 0 ' GIE = 1
    INTCON.4 = 1
    @ sleep

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default Re: Sleep mode not functionning

    Hi, Ken

    When talking about sleep mode current draw ...

    a full scheme AND full code of the project are highly necessary ...

    Alain

    PS : I already bet 10 mA for your 12v/5v regulator ....
    Last edited by Acetronics2; - 1st May 2012 at 17:19.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Sleep mode not functionning

    Problem solved by a phone call
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts