Saw something like this in a dsPIC30 running MPLAB and SIM. The MPLAB=20 environment doesn't want to switch to the include file for debugging. I=20 simply wrote it off as a limit of MPLAB SIM and started pasting in the=20 contents of the include and not ever using includes for anything but register definitions. You might want to go thru Microchip tech support to see if they have any=20 suggestions. (NOT FORUMS, just the Tech support). There may be some setup stuff in MPLAB that fixes that. ASM30 has some odd stuff= =20 (compared to the 16F/18F environment) and that may be in the list of "odd" MPLAB doesn't handle exceptions very well and there may be one generated=20 when the program tries to step into the include. I had a math error and it took me forever to get the math error interrupt trap to= =20 catch it. MPLAB would simply go back to __reset. It turns out that the default handler for any rupt not explicitly decalred is= =20 __reset (Dug that out of the linker script) at least for the dsPIC30 ----- Original Message -----=20 From: "Steve Smith" To: "'Microcontroller discussion list - Public.'" Sent: Tuesday, November 27, 2012 3:09 PM Subject: [PIC] MPLAB problem > Guys.... > > I have a problem.... I have just started with 24F's in ASM30 and have run > into a stubborn issue. I have a simple piece of code that kicks a text > display into life. > > The main code operates from the reset to the first call to a subroutine=20 > that > is in an included file. At this point the simulator goes back to the=20 > __reset > line in the main source code instead of switching to the included file. I= f=20 > I > have the code in line in the main file it simulates properly. It does thi= s > with both MPLAB Sim and ICD3. > > When ICD3 is the target the program runs on the device properly it also > displays as expected in the disassembly listing. > > This was never a problem with and 8 bit device and I cant drive 'C' yet=20 > and > there is very sparse web recourses on ASM30 at all... > > Thanks in advance > > Steve > > > > Main code segment > > > .equ __p24FJ256GB210.inc, 1 > ; > .include "p24FJ256GB210.inc" > ; INCLUDE FILES > .global __reset ; reset vector > .global __T2Interrupt ; Timer ISR entry > > .global delay > > .section __CONFIG_REG.sec, code > .global __CONFIG_REG > __CONFIG_REG: .pword POSCMOD_NONE & IOL1WAY_ON & OSCIOFNC_OFF & > FCKSM_CSECMD & FNOSC_FRCPLL & PLL96MHZ_ON & PLLDIV_DIV2 & IESO_ON > > .DATA ; Switch to DATA RAM segment: > Flag_0: .space 2 ; Reserve two bytes (one 16-bit word) in a > DATA RAM space for FLAGS bits > ; Bit assignments in Flag_0: > Tick =3D 0 ; Bit 0 in Flag_0 is named Tick > > .extern Start_TXT > .extern TXT_Cmd > .extern TXT_Dta > > > ; Start of executable code: > > __reset: > > bra Init > > .include "interrupt.s" ; int handlers > > Init: > > mov #__SP_init,W15 ; Initialise stack pointer and stack > limit register, > mov #__SPLIM_init,W0 ; __SP_init and __SPLIM_init values > are defined at compile/link time. > mov W0,SPLIM ; > nop > > ; bset T2CON,#TCS ; int/2 and on and /8 > bset T2CON,#TCKPS0 > bset T2CON,#TON > bset IPC0,#T2IP0 ; timer 1 lowest priority > bset IEC0,#T2IE ; enable int > > > > > > call Start_TXT ; THIS IS THE CALL THAT GOES > WRONG > nop > mov.b #'F',W0 > call TXT_Dta ; .....and then > > .include "TextDisplay.inc" ; this is currently at the > bottom of code but it fails in the same way where ever it gets put !!! > > > TextDisplay.inc > > > .global Start_TXT > .global TXT_Cmd > .global TXT_Dta > .extern delay > ;-------------LCD Port setup with standard text > module----------------------- > Start_TXT: > mov #0b1111101111111011,W0 > mov W0,TRISD ; RS,E outputs > nop > bclr PORTD,#0x02 ; E low > clr PORTE > > mov #0xFF00,W0 ; E0-7 > mov W0,TRISE ; make outputs > > mov.b #0x38,W0 ; 8 bit > call TXT_Cmd > > There is more here > > --=20 > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist=20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .