Searching \ for 'Problems with PCLATH, etc.' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=problems+with+pclath
Search entire site for: 'Problems with PCLATH, etc.'.

Truncated match.
PICList Thread
'Problems with PCLATH, etc.'
1996\10\29@020447 by fastfwd

face
flavicon
face
myke predko <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

Tjaart wrote:

> Fix_up_PCLATH MACRO
>         local   Local_Label
> Local_Label
>         movlw   ((Local_Label>>8)&&0xFF)
>         movwf   PCLATH
>         ENDM

.... and Myke replied:

> Actually, this can be simplified to:
>
>         movlw    $ >> 8
>         movwf    PCLATH

Tjaart and Myke:

Actually... The following is best:

   movlw high ($ + 2)
   movwf PCLATH

But who's counting?

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com                 ===
=== Fast Forward Engineering - Vista, California          ===
===                                                       ===
=== Custodian of the PICLIST Fund -- For more info, see:  ===
=== http://www.geocities.com/SiliconValley/2499/fund.html ===

1996\10\29@113147 by myke predko

flavicon
face
{Quote hidden}

Andy,

I forgot about the "high" operator in the MPASM - yes, that makes it even
simpler.

Out of curiosity, why are you adding 2 to the current address (This would
make the value that you are getting PCLATH for is the instruction *after*
"movwf PCLATH")?  I guess it's for maximizing code space for a table (ie
start two addresses before modifying PCL).

Is there any other reason for doing this?

myke

Avoiding precedents does not mean nothing should ever be done.  It only
means that nothing should ever be done for the first time - Sir Humphrey
Appleby K.C.B.

1996\10\29@192846 by Steve Hardy

flavicon
face
{Quote hidden}

I don't want to second guess Andy, but if the macro happens to be used
precisely at the end of page 0 it will produce the desired result for
the following instructions (in page 1).  However, it's one of those
largely academic niceties, such as defining 0! to be 1.  You get a warm
fuzzy feeling from having it, but probably won't ever need it.

Regards,
SJH
Canberra, Australia

1996\10\30@043528 by fastfwd

face
flavicon
face
myke predko <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU> wrote:

> > [Quoting me:]
> > Actually... The following is best:
> >
> >     movlw high ($ + 2)
> >     movwf PCLATH
>
> Out of curiosity, why are you adding 2 to the current address (This
> would make the value that you are getting PCLATH for is the
> instruction *after* "movwf PCLATH")?

Myke:

I add 2 in order to ensure that PCLATH is accurate for the
instruction after the MOVLW/MOVWF combination.  It's a very minor
point, but it's sorta important if, for instance, the MOVLW is on the
last address of a page and there's a lookup table right after the
MOVLW/MOVWF combination.

-Andy

=== Andrew Warren - fastfwdspamspam_OUTix.netcom.com                 ===
=== Fast Forward Engineering - Vista, California          ===
===                                                       ===
=== Custodian of the PICLIST Fund -- For more info, see:  ===
=== http://www.geocities.com/SiliconValley/2499/fund.html ===

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...