I am using the Microchips MPASM suite software, version 7.4. MPLAB IDE (fresh download and install of it).
I have compiled my sourcecode with 0 errors and warnings and have only the 2 expected messages about ensuring the correct banks are being used.
BUILD SUCCEEDED: Sat Nov 27 14:23:57 2006
My issue is when I attempt to use the simulator it always displays a stack overflow error as seen below.
CORE-E0002: Stack under flow error occurred from instruction at 0x000005
Using the program memory tool I find that the simulator is always starting at Address 0x000, my actual code starts at Address 0x0007 and I have instructed it to start at Address 0x0004. Below are the first lines from the program memory tool.
1 0000 3FFF ADDLW 0xff
2 0001 3FFF ADDLW 0xff
3 0002 3FFF ADDLW 0xff
4 0003 3FFF ADDLW 0xff
5 0004 3FFF ADDLW 0xff
6 0005 3400 RETLW 0
7 0006 3400 RETLW 0
8 0007 3000 MOVLW 0 ; This is the start of my code
9 0008 1683 BSF 0x3, 0x5
The actual start of my code is this
ORG 0x0004
MAIN CODE
movlw b'00000000' ; Define all zeros
bsf STATUS, RP0 ; Shift to bank 1
Why does the simulator start at 0000, my code start at 0007 and my ORG statement say 0x0004? Altering the ORG statement has no effect on the output of the compiler. My data section starts at 0x064 using the ORG 0x064 switch and it starts right where it should be. I have copied my program into a new Project using the 16f628 and I get the same indications when I build the project. Program starts at 0x007.
If I manually set the PC to 0x0007 the simulator runs beautifully without any errors (at least none for now
). Any idea what I did wrong?
I can post the full program if needed or I can stand in an open field if all thats needed is beaning me with a few rocks