Searching \ for 'Look up table: can I do this?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/mems.htm?key=table
Search entire site for: 'Look up table: can I do this?'.

Truncated match.
PICList Thread
'Look up table: can I do this?'
1998\08\27@103836 by Quentin

flavicon
face
To ensure that my lookup table is in the first 256 places, is this right?:
       org     0x000

;Lookup table here.
;ensure table does not cross 0x0FF

       org     0x0FF   ;or less,depending on size of table

;main program here
;call lookup table from here
       end

Thanks
Quentin

1998\08\27@105514 by Dmitry Kiryashov

flavicon
face
Quentin wrote:
>
> To ensure that my lookup table is in the first 256 places, is this right?:
>         org     0x000
>
> ;Lookup table here.
> ;ensure table does not cross 0x0FF
>
>         org     0x0FF   ;or less,depending on size of table

Correct this org value to 0x100

> ;main program here
> ;call lookup table from here
>         end

0xFF addr is owned by zero page. First page is starting from 0x100 addr.
Don't forget that 0x000 addr is reset vector and 0x004 is int vector.

WBR Dmitry.

1998\08\27@173853 by Mike Ghormley

flavicon
face
Quentin wrote:

> To ensure that my lookup table is in the first 256 places, is this right?:
>         org     0x000
> ;Lookup table here.
> ;ensure table does not cross 0x0FF
>
>         org     0x0FF   ;or less,depending on size of table
>
> ;main program here
> ;call lookup table from here
>         end

Nope.  You didn't mention which flavor of PIC you are using, but most PIC's
take their first instruction from location 0x000.  Additionally, many PIC's
use 0x004 for the Interrupt vector.

If your table isn't huge (<200 or so) then you might try:

       ORG     0x000
       GOTO    MAIN_LOOP
       ORG     0x004
       GOTO    INT_ROUTINE
LOOKUP_TABLE
       ; Lookup table here.

INT_ROUTINE
       ; put your interrupt code here

MAIN_LOOP
       ; main program here
       ; call lookup table from here
       END

You will still need to be cautious not to inadvertantly cross the 0xFF
boundary without accounting for it.

If your table is >200 or so, then you might be better served to just place the
table at 0x100 (which is on the second page).

Michael

*************************************************************************
When the way of the Tao is forgotten, kindness and ethics must be taught.
Men must learn to pretend to be wise and good.  --  Lao Tzu
*************************************************************************

1998\08\28@064642 by Caisson

flavicon
face
> Van: Quentin <spam_OUTqscTakeThisOuTspamICON.CO.ZA>
> Aan: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
> Onderwerp: Look up table: can I do this?
> Datum: donderdag 27 augustus 1998 16:32
>
> To ensure that my lookup table is in the first 256 places, is this
right?:
{Quote hidden}

You could do that, but when Resetting your PIC (most of them anyway) will
want to start at adress 0x0000.  But that is where you want to put your
table.  So, You've got a problem.  Not a big one, but nevertheless :-)

When you use a Table Look-up you are using a ADWF PCL instruction to a
RETLW in the table.  When modifying the PCL you will use some bits outof
the PCLATH register also.  Those bits (outof the PCLATH-register) will
provide the high-bits of your Destination-adres when changing the
PCL-register.  In short : When you change the PCL register the target adres
for the "jump" will consist outof 8 bits from the PCL register, and
pre-pended to (placed to the left of) that will be the bits outof the
PCLATH register. This means that the PCLATH register contains a sort of
"page-adres" for your table.  And this in turn means that you can place
your table at any 256-byte page in memory !

Greetz,
 Rudy Wieser

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