Sleep & nap


Results 1 to 25 of 25

Thread: Sleep & nap

Threaded View

  1. #23
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Glad you got it working. It probably was before, but you had to wait a heck of a long time before it would wake up..;o}

    Would a USB development board be good for... what?
    Development boards, like say the Microchip USB dev board & meLabs USB dev boards are handy for testing things quickly without having to build your own boards or hand-wire stuff.

    Definitely not necessary, but handy if you're lazy like me..;o}

    Now that you have the sleep/nap/WDT stuff down pat, here's a fix for your interrupts.

    This isn't what you want;
    DEFINE INTERRUPT_ORG 1008h ' For Microchip USB Bootloader

    It looks like you're using the newer version USB loader, so your interrupts are re-mapped to locations 0x1008 for high priority, and 0x1018 for low priority.

    What you need to do with PBP to make sure it points to these re-mapped vectors goes like this;

    DEFINE RESET_ORG 1000h ' For Microchip USB Bootloader
    DEFINE INTHAND high_isr ' high-pri int vector
    DEFINE INTLHAND low_isr ' low-pri int vector

    Note that you don't need the DEFINE LOADER_USED 1.

    DEFINE RESET_ORG 1000h tells PBP to start compiling all code at 1000h.

    DEFINE INTHAND high_isr. When PBP see this it inserts a ORG RESET_ORG + 8 followed by a goto INTHAND, which is your high_isr routine.

    DEFINE INTLHAND low_isr. Now PBP inserts a ORG RESET_ORG + 18h followed by a goto INTLHAND, which is your low_isr routine.

    So you don't need to specifiy the address.

    Note that your interrupt routines will need to be assembler. Something like this;
    Code:
    asm
    high_isr
      ; do stuff here
      RETFIE FAST
    
    low_isr
      ; do stuff here
      RETFIE
    endasm
    Now your PBP .asm interrupts can work directly with the Microchip USB loader re-mapped int vectors.
    Last edited by Bruce; - 3rd December 2008 at 23:54.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Battery powered applications
    By NavMicroSystems in forum Off Topic
    Replies: 7
    Last Post: - 22nd June 2009, 07:12
  3. 16F628A current high during sleep
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 9th October 2006, 10:21
  4. Wierd sleep issue
    By orca in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th March 2006, 22:06
  5. Replies: 5
    Last Post: - 5th February 2006, 16:51

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