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}
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.
Bookmarks