> -----Original Message-----
> From: pic microcontroller discussion list
> [
EraseMEPICLISTspam_OUT
TakeThisOuTMITVMA.MIT.EDU]On Behalf Of Caisson
> Sent: Tuesday, March 31, 1998 3:38 AM
> To:
PICLIST
spam_OUTMITVMA.MIT.EDU
> Subject: Re: Subroutine locations
>
>
> > Van: Tim Crist <
@spam@tjcristKILLspam
CCGATE.HAC.COM>
> > Aan:
KILLspamPICLISTKILLspam
MITVMA.MIT.EDU
> > Onderwerp: Subroutine locations
> > Datum: maandag 30 maart 1998 13:29
> >
> > I have a question about subroutines that are located above and
> > below 255H in the 16F84 and the 16C54A. I understand that tables
> > that use the program counter will not work if they cross 255H
> > because of PCLATH.
>
> I assume you mean 255 Decimal (or FF HexaDecimal).
>
> You are right, but for the wrong reasons. It's not because of PCLATH, but
> because the register PCL consists outof only 8 bits. this means that you
> can't put a number higher than FF (or 255 decimal) into PCL. Said
> otherwise,
> if you add a Index of 0x05 to a PCL of 0xFE the result will become 0x03,
> and
> NOT 0x0103. Ah. before I forget : The low 5 bits of PCLATH will be
> prepended
> to PCL to obtain the full 13 -bit adres on a add-to-PCL -jump. Not that
> all
> PIC's have that much Code-memory, but it seems to be a sort of
> standard for
> Mid-range PIC's.
>
> > My question is: Can I have a subroutine below 255H successfully
> > call a subroutine above 255H without incident? If not, how would
> > one go about making it work.
>
> Yes, they can. A Goto or Call has a 11 Bit adres, wich means you can jump
> from 0x0000 to 0x07FF. If you would like to be able to jump to an adres
> beyond this, you would have to (besides finding a PIC with more
> Code-memory)
> set bits 3 & 4 in the PCLATH register. these will be prepended to your
> Jump/
> Call adres to obtain (again) the full 13 -bit adres.
>
> > TIA,
> >
> > Tim Crist
>
> Greetz,
> Rudy Wieser
>