Won't go back to SLEEP after 1st Interrupt


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Two suggestions.
    • Take a 100K resitor from +5V to your ammeter, and the other lead to ground.
      If your meter is working correctly, you should get a reading of 50uA.
      <br>
    • Remove the inputs from any of the pins that you can.
      Compile and load this program ...
      Code:
      ASM  ; 16F690
        ifdef PM_USED                  ; For PM assembler
          device  INTRC_OSC_NOCLKOUT   ;   Oscillator Selection
          device  FCMEN_OFF            ;   Fail-Safe Clock Monitor
          device  IESO_OFF             ;   Internal External Switchover
          device  BOD_OFF              ;   Brown-out Detect
          device  CPD_OFF              ;   Data Code Protection
          device  PROTECT_OFF          ;   Code Protection
          device  MCLR_OFF             ;   Master Clear Reset
          device  PWRT_OFF             ;   Power-up Timer
          device  WDT_OFF              ;   Watchdog Timer
      
        else                            ; For MPASM assembler
      cfg=      _INTRC_OSC_NOCLKOUT     ;   Oscillator Selection
      cfg=cfg&  _FCMEN_OFF              ;   Fail-Safe Clock Monitor
      cfg=cfg&  _IESO_OFF               ;   Internal External Switchover
      cfg=cfg&  _BOR_OFF                ;   Brown-out Reset
      cfg=cfg&  _CPD_OFF                ;   Data Code Protection
      cfg=cfg&  _CP_OFF                 ;   Code Protection
      cfg=cfg&  _MCLRE_OFF              ;   Master Clear Reset
      cfg=cfg&  _PWRTE_OFF              ;   Power-up Timer
      cfg=cfg&  _WDT_OFF                ;   Watchdog Timer
        __CONFIG  cfg
      
        endif
      ENDASM
      
      END   ; Enter Comma (sleep forever with no hope of waking)
    DT

  2. #2
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question Assembler errors??

    Quote Originally Posted by Darrel Taylor View Post
    T
    <br>[*]Remove the inputs from any of the pins that you can.
    Compile and load this program ...
    Code:
    ASM  ; 16F690
      ifdef PM_USED                  ; For PM assembler
        device  INTRC_OSC_NOCLKOUT   ;   Oscillator Selection
        device  FCMEN_OFF            ;   Fail-Safe Clock Monitor
        device  IESO_OFF             ;   Internal External Switchover
        device  BOD_OFF              ;   Brown-out Detect
        device  CPD_OFF              ;   Data Code Protection
        device  PROTECT_OFF          ;   Code Protection
        device  MCLR_OFF             ;   Master Clear Reset
        device  PWRT_OFF             ;   Power-up Timer
        device  WDT_OFF              ;   Watchdog Timer
    
      else                            ; For MPASM assembler
    cfg=      _INTRC_OSC_NOCLKOUT     ;   Oscillator Selection
    cfg=cfg&  _FCMEN_OFF              ;   Fail-Safe Clock Monitor
    cfg=cfg&  _IESO_OFF               ;   Internal External Switchover
    cfg=cfg&  _BOR_OFF                ;   Brown-out Reset
    cfg=cfg&  _CPD_OFF                ;   Data Code Protection
    cfg=cfg&  _CP_OFF                 ;   Code Protection
    cfg=cfg&  _MCLRE_OFF              ;   Master Clear Reset
    cfg=cfg&  _PWRTE_OFF              ;   Power-up Timer
    cfg=cfg&  _WDT_OFF                ;   Watchdog Timer
      __CONFIG  cfg
    
      endif
    ENDASM
    
    END   ; Enter Comma (sleep forever with no hope of waking)
    [/list]
    I copied this code into my MicroCode Studio editor, assembled it with PICBasic Pro compiler, programmed it into my 16F690 that is installed in a PICkit2 Low Pin Development Board, and then tried to run the program. I get the following Assembler errors:
    "Overwriting previous address contents (2007)
    Symbol not previously defined (_FCMEN_OFF)
    Symbol not previously defined (_IESO_OFF)
    Symbol not previously defined (_BOR_OFF)
    SYmbol not previously defined (_CPD_OFF)"

    I presumed this was because I had the _config file commented out in the 16F690.INC file, so decommented it and tried again. Same errors ocurred. Any suggestions.
    Question: If I get this program to run, what will that tell me? Are you saying that with the 16F690 programmed this way I can then measure the power consumed when running and it will tell me the lowest possible power for the 16F690 before adding any other code??

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    First off, do the resistor test. Make sure the meter's working.
    Never assume the reading you get is what you are actually testing.

    For the "Overwriting previous address contents (2007)" error, see this post ...
    http://www.picbasic.co.uk/forum/show...75&postcount=5

    I'm not sure what you mean by "decommented it", you should have Commented it.

    The idea is to eliminate your code and config's as the problem.
    If you still get high current readings with the chip locked in sleep mode, then you need to look at the hardware.
    By itself, the chip disables pull-ups, puts all pins in input mode, with all analog channels enabled. Current due to noise will be minimal.
    <br>
    DT

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    John,
    add this to your config: _FCMEN_OFF , this disables the fail safe clock monitor, made about 200 micro amp difference here.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Pin won't stay high during Repeat...Until loop??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th August 2009, 00:57
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 08:12
  3. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 03:35
  4. Using Sleep
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th August 2008, 05:05
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

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