I have a small test board that has an ICSP and a USB connection to a pic 18f4550. I have a reset button on the MCLR and a second button on portb.1. An led is connected to portb.0
The ICSP is used to program a bootloader onto the chip. Then USB is used to add the user program.
I have loaded the Diolan bootloader onto this chip and it is working.
I can make a test program in PBP 2.6 that flashes the LED on port b.0
like this: The Bootloader required code to start at 0x800
Code:
DEFINE OSC 48
DEFINE RESET_ORG 0x800
' Example program to blink an LED connected to PORTB.0 about
' once a second
Main:
High 0 ' Turn on LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Low 0 ' Turn off LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Goto Main ' Go back to loop and blink LED forever
End
The above program works as expected. So the next step was to try the DT_INTS-18 with the bootloader...the code appears to load into the PIC fine, but after reset there is a pause of about 5 seconds then the chip shows up as an un-recognized USB device but does not enter the bootloader mode. To enter bootloader mode the PB on portb.1 is held down during power-on/reset. OR the user application can branch to 0x0016.
It appears the program is branching somewhere to restart the bootloader code since the pic shows up as an unrecognized USB device. It should not show up at all after the code is loaded since I don't have any usb code in the user app listed below.
Here is my test program with the DT_INTS-18 that is not working...
Code:
DEFINE OSC 20
DEFINE RESET_ORG 0x800
INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
LED1 VAR PORTB.0
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
T1CON = $31 ; Prescaler = 8, TMR1ON
@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts
Main:
PAUSE 1
GOTO Main
'---[TMR1 - interrupt handler]--------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
Any thoughts on why it's not blinking the led using the DT_INTS-18 code and running off into la la land?
ADDED: I am using the MPASM assembler as well.
Thanks
Tom
Bookmarks