Searching \ for 'table setup' 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/mems.htm?key=table
Search entire site for: 'table setup'.

Truncated match.
PICList Thread
'table setup'
2000\02\21@131857 by Josh NG

flavicon
face
I'm a little lost looking at this piece of code. I know that it sets the jump target to a table, but syntax used is different than what I usually use.  I wondering if someone can help me with this.  Basically, I don't understand these two lines:

movlw   (freqdatable >> 8)
and
addlw   (freqdatatable & h'ff)

------------------------------------------
;here's the snipplet

       org             d'768'

freqd   movlw           (freqdatatable >> 8)
       movwf           PCLATH
       movf            INDF,0
       addlw           (freqdatatable & h'ff')
       movwf           PCL

freqdatatable
               #include        "freq.asm"
               ;<- freq data goes here ->


--== Sent via Deja.com http://www.deja.com/ ==--
Share what you know. Learn what you don't.

2000\02\21@133805 by James Paul

flavicon
face
Josh,

The first one (ie...freqdatable>>8) is saying to shift the
data in the variable 'freqdatable' 8 places to the right.
The second one is a logical operation probably intended to
clear some bit(s).  freqdatatable & h'ff means to do a logical
AND on each bit in the variable freqdatatable on a bit by bit
basis.  ie lets say the freqdatatable contains '3E' and we are
going to AND this with 'FF'

 3Eh = 0011 1110
 FFh = 1111 1111
 -------------------
so.... 0011 1110

The after this operation, the result is aded to 'W'.  'W' now
contains (I assume) the offset into the table.

                                        Regards,

                                          Jim

On Mon, 21 February 2000, Josh NG wrote:

{Quote hidden}

spam_OUTjimTakeThisOuTspamjpes.com

2000\02\21@152551 by paulb

flavicon
face
James Paul wrote:

>  The first one (ie...freqdatable>>8) is saying to shift the
>  data in the variable 'freqdatable' 8 places to the right.
>  The second one is a logical operation probably intended to
>  clear some bit(s).

 In broader terms, put the high byte of the address freqdatable into
PCLATH, and use the low byte to add to the value to be put in PCL.

 Since the add instruction only takes an 8-bit value anyway, this is
purely to avoid the assembler telling you you are trying to add a number
that is too big.


--
 Cheers,
       Paul B.

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