On Fri, 05 Feb 2010 00:27:13 GMT, the renowned Jan Panteltje
<(E-Mail Removed)> wrote:
>Ping Spehro Pefhany question about PIC 18F14K22
>
>I have this PIC, and since you seem to be familiar with it,
>maybe you know the answer.
Hi, Jan:-
Unfortunately, there are many more ways that things can go wrong than
right. I've never seen this problem. But then I'm using vanilla MPLAB
runing under XP, Win2K or Win7 64, plus ICD2, ICD3, PicKit2, PicStart,
PicKit3 or RealICE.
>When I program the PIC, I find that the code is only executed from about location decimal 60 decimal.
>That is everything before that location is ignored.
>The PIC jumps directly to org D'60'.
Try using MPSIM and see what happens when you look at the program
memory and when you step into the program from a simulated /MCLR
reset.
This works for me:
;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------
RES_VECT ORG 0x0000 ; processor reset vector
GOTO START ; go to beginning of program
;------------------------------------------------------------------------------
; HIGH PRIORITY INTERRUPT VECTOR
;------------------------------------------------------------------------------
ISRH ORG 0x0008
; Run the High Priority Interrupt Service Routine
GOTO HIGH_ISR
;------------------------------------------------------------------------------
; LOW PRIORITY INTERRUPT VECTOR
;------------------------------------------------------------------------------
ISRL ORG 0x0018
; Run the High Priority Interrupt Service Routine
GOTO LOW_ISR
;------------------------------------------------------------------------------
; MAIN PROGRAM
;------------------------------------------------------------------------------
START
; dummy program that loops forever
GOTO $
In this case, the value of START is 0x1C (28d), which is right after
the 4-byte LOW_ISR vector (GOTO 0x36 in this case, located
at 0x18-0x1B.
>Only thing I can think of is that the PIC somehow enters debugging mode.
>I have read about a debugging flag.
>However in the related documents no debugging flag or related register is to be found.
>I have tried 2 PICs and both do exactly the same.
Well, when you use MPLAB the debug configuration bit is controlled
"behind the scenes" by the selection of release vs. debug drop-down
window (also there is a debug executive that is loaded into high
program memory in debug mode). Microchip has taken to hiding this bit
from unwashed data sheet users-- it's shown as "unimplemented" and
"reads as zero". If you're using your own programming software you
need to control it explicitly.. in this case it's bit 7 of CONFIG4L
located at 300006h. Set it to '1' to disable background debug (and I
also suggest disabling LVP).
>I checked the generated code, and listed it from 2 different programmers,
>and also assembled it with 2 different assemblers one MPASM, the other gpasm,
>exactly the same result.
>The fact that the PIC skips the interrupt vector space makes it totally useless for me.
>Any ideas?
>
>All other code (no interrupts) executes normally after org D'60' or higher...
Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
(E-Mail Removed) Info for manufacturers:
http://www.trexon.com
Embedded software/hardware/analog Info for designers:
http://www.speff.com