Truncated match.
PICList
Thread
'PCLATH isn't working'
1997\06\10@192202
by
Aydin Yesildirek
My simulator is showing different response than that of microchip
data book. Since the system is also crashing simulator isn't wrong.
The problem is: PCLATH doesn't show the wright value after RETFIE.
After Timer2 interrupt Top Of Stack (TOS) is 0x8D2, in bank1, after ISR
RETFIE instruction is executed. Program goes to 0x8D3 but PCLATH
stays zero unchanged, however PCL is changed to 0xD3. I expect PCLATH
to show 0x08 but does not. Then why am I at the 0x8D3 address in the
program memory? I have no access to stack manually solve this
problem.
Any help is apreciated.
Thank you.
Aydin Yesildirek
VGT, Panama
1997\06\10@211155
by
Clyde Smith-Stubbs
|
On Tue, Jun 10, 1997 at 11:39:54AM +0000, Aydin Yesildirek wrote:
> The problem is: PCLATH doesn't show the wright value after RETFIE.
The RETFIE instruction (or any other return instruction) does NOT
update PCLATH. The stack is 14 bits wide, and stores the whole PC,
of which only 8 bits is visible in PCL. The PCLATH register is NOT the
upper 8 bits of the PC, but just a holding register that is copied to
the high bits of the PC whenever you explicitly change PCL (by a goto,
movf etc.).
What you have to do is save PCLATH on entry to your ISR, and restore
it on exit. This is necessary if you have any goto's in the ISR, and
your PIC has more than one ROM page. You also need to zero PCLATH in
the ISR, after saving it, of course, but I suspect you are already
doing that.
--
Clyde Smith-Stubbs |HI-TECH Software, |Voice: +61 7 3354 2411
spam_OUTclydeTakeThisOuT
htsoft.com |P.O. Box 103, Alderley,|Fax: +61 7 3354 2422
http://www.htsoft.com|QLD, 4051, AUSTRALIA. |PGP: finger .....clydeKILLspam
@spam@htsoft.com
---------------------------------------------------------------------------
Download a FREE beta version of our new ANSI C compiler for the PIC
microcontroller! Point your WWW browser at http://www.htsoft.com/
1997\06\11@114544
by
Aydin Yesildirek
|
> What you have to do is save PCLATH on entry to your ISR, and restore
> it on exit. This is necessary if you have any goto's in the ISR, and
> your PIC has more than one ROM page. You also need to zero PCLATH in
> the ISR, after saving it, of course, but I suspect you are already
> doing that.
I tried that, but after the interrupt pclath is showing the new
address value. I need to get upper portion of top of stack and update
my pclath with that value at the end of the ISR. I thought c-complier
was supposed to handle this updating pain but not working in my case.
I am trying to avoid it by staying within first 2K of the program
memory by now.
Regards,
Aydin
> --
> Clyde Smith-Stubbs |HI-TECH Software, |Voice: +61 7 3354 2411
> clyde
KILLspamhtsoft.com |P.O. Box 103, Alderley,|Fax: +61 7 3354 2422
> http://www.htsoft.com|QLD, 4051, AUSTRALIA. |PGP: finger .....clydeKILLspam
.....htsoft.com
> ---------------------------------------------------------------------------
> Download a FREE beta version of our new ANSI C compiler for the PIC
> microcontroller! Point your WWW browser at http://www.htsoft.com/
>
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- Today
- New search...