Searching \ for 'need to implement big lookup tables' 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: 'need to implement big lookup tables'.

Truncated match.
PICList Thread
'need to implement big lookup tables'
1998\12\08@023619 by Bart Stofferis

flavicon
face
Hi there ...

I have to implement several lookup tables of 256 values.

I split the tables in parts of 128 values bit have a page select problem
... program crashes ...

does anyone has an example program or can explain me more in detail how
i can do this ?

here is a part of my soft:

LUT.ASM
************************************************************************
*********************
       org     0xC00

LUT1
       addwf   PCL,f

       retlw   0x000

       ...     128 values


       org     0xD00

LUT2
       addwf   PCL,f

       retlw   0x008

       ...     128 values


       org     0xE00

LUT3
       addwf   PCL,f

       retlw   0x010

       ...     128 values


I now access the table by doing:

;       bsf     STATUS,RP0
;       movlw   0x00D
;       movwf   PCLATH
;
;       bcf     STATUS,RP0
;       movfw   GOVALUE
;
;       bsf     STATUS,RP0
;       call    LUT2
;       movlw   0x000
;       movwf   PCLATH
;
;       bcf     STATUS,RP0
;       movwf   RETURNVALUE


Thanks in advance !

And happy PICing

Bart

1998\12\08@070404 by Dmitry Kiryashov

flavicon
face
Hello Bart.

> I have to implement several lookup tables of 256 values.
> I split the tables in parts of 128 values bit have a page select problem
> ... program crashes ...
>
> does anyone has an example program or can explain me more in detail how
> i can do this ?

Here is an example for midrange PIC16cXXX chips.
This example may not work in case of 8K and higher program memory PICs.

WBR Dmitry.


;       data_addr = high_addr*0x100 + low_addr

       movlw   some_addr_l
       movwf   low_addr

       movlw   some_addr_h     ;high_addr

       call    read_data
;
;...    continue after return

read_data:
       addlw   high    table
       movwf   pclath

       movfw   low_addr
       addlw   low     table
       skpnc
       incf    pclath,f
       movwf   pcl             ;goto [pclath,pcl]
;...

data:                           ;somewhere in the memory

       dt      1,2,3,4,5,6,....,0x221,0x222,0x223,...,0x333,0x334,0x335,.....

1998\12\08@125125 by Harold Hallikainen

picon face
On Tue, 8 Dec 1998 08:34:02 +0100 Bart Stofferis
<spam_OUTbart.stofferisTakeThisOuTspamBARCO.COM> writes:
>Hi there ...
>
>I have to implement several lookup tables of 256 values.
>
>I split the tables in parts of 128 values bit have a page select
>problem
>... program crashes ...
>
>does anyone has an example program or can explain me more in detail
>how
>i can do this ?
>


       Some sample code with full 256 byte tables is below.  The pclath
acts like a base register, pointing to the base of any of several tables,
while pcl is the index into the table.

Harold



Harold Hallikainen
.....haroldKILLspamspam@spam@hallikainen.com
Hallikainen & Friends, Inc.
See the FCC Rules at http://hallikainen.com/FccRules and comments filed
in LPFM proceeding at http://hallikainen.com/lpfm





DmxToClicksL
; Pass DMX code in W.  Returns with low half of timer value based on
brightness curve and
; duty cycle to RMS, based on RMS measurements.
; The table is formed by using delays in millipirads to give the
equivalent required rms voltage,
; based on the dmx curve and formulae in dmx.cc
       movwf   dtctemp         ; save DMX code for now
       movlw   high(dmxtoclicksL60)
       btfss   Hz60,0          ; If we're on 60 Hz, skip next
       movlw   high(dmxtoclicksL50) ; Not on 60 Hz, point to 50 Hz
table
       movwf   pclath          ; Update pc latch for table
       movf    dtctemp,0       ; get it back
       goto    DmxToClicksTable ; Jump into table pointed to by
pclath, returning with clicks low
                               ; in w
       org     0x0ff+($ & 0xff00)      ;Force below to be just
before page break

DmxToClicksTable
       addwf   pcl,1           ; Add w to PC, going into jump
table



DmxToClicksH60
                                                       ; DMX
Millipirads 'til turn-on
       retlw   high(d'1000'*ClicksPerHalfCycle60/d'1000'); 0
  1000
       retlw   high(d'972'*ClicksPerHalfCycle60/d'1000')       ; 1
          972
       retlw   high(d'956'*ClicksPerHalfCycle60/d'1000')       ; 2
          956
       retlw   high(d'944'*ClicksPerHalfCycle60/d'1000')       ; 3
          944
       retlw   high(d'933'*ClicksPerHalfCycle60/d'1000')       ; 4
          933
       retlw   high(d'923'*ClicksPerHalfCycle60/d'1000')       ; 5
          923
       retlw   high(d'914'*ClicksPerHalfCycle60/d'1000')       ; 6
          914
       retlw   high(d'906'*ClicksPerHalfCycle60/d'1000')       ; 7
          906
       retlw   high(d'898'*ClicksPerHalfCycle60/d'1000')       ; 8
          898
       retlw   high(d'891'*ClicksPerHalfCycle60/d'1000')       ; 9
          891
       retlw   high(d'884'*ClicksPerHalfCycle60/d'1000')       ;
10           884
       retlw   high(d'878'*ClicksPerHalfCycle60/d'1000')       ;
11           878
       retlw   high(d'872'*ClicksPerHalfCycle60/d'1000')       ;
12           872

[large part of table deleted...  End of this table and start of next]

       retlw   high(d'223'*ClicksPerHalfCycle60/d'1000')       ;
243          223
       retlw   high(d'217'*ClicksPerHalfCycle60/d'1000')       ;
244          217
       retlw   high(d'210'*ClicksPerHalfCycle60/d'1000')       ;
245          210
       retlw   high(d'203'*ClicksPerHalfCycle60/d'1000')       ;
246          203
       retlw   high(d'196'*ClicksPerHalfCycle60/d'1000')       ;
247          196
       retlw   high(d'188'*ClicksPerHalfCycle60/d'1000')       ;
248          188
       retlw   high(d'179'*ClicksPerHalfCycle60/d'1000')       ;
249          179
       retlw   high(d'170'*ClicksPerHalfCycle60/d'1000')       ;
250          170
       retlw   high(d'159'*ClicksPerHalfCycle60/d'1000')       ;
251          159
       retlw   high(d'147'*ClicksPerHalfCycle60/d'1000')       ;
252          147
       retlw   high(d'131'*ClicksPerHalfCycle60/d'1000')       ;
253          131
       retlw   high(d'112'*ClicksPerHalfCycle60/d'1000')       ;
254          112
       retlw   high(d'081'*ClicksPerHalfCycle60/d'1000')       ;
255          081



                                                       ;
DMXtoClicksL60
                                                       ; DMX
Millipirads 'til turn-on
       retlw   low(d'1000'*ClicksPerHalfCycle60/d'1000')       ; 0
         1000
       retlw   low(d'972'*ClicksPerHalfCycle60/d'1000')        ; 1
         972
       retlw   low(d'956'*ClicksPerHalfCycle60/d'1000')        ; 2
         956
       retlw   low(d'944'*ClicksPerHalfCycle60/d'1000')        ; 3
         944
       retlw   low(d'933'*ClicksPerHalfCycle60/d'1000')        ; 4
         933
       retlw   low(d'923'*ClicksPerHalfCycle60/d'1000')        ; 5
         923
       retlw   low(d'914'*ClicksPerHalfCycle60/d'1000')        ; 6
         914
       retlw   low(d'906'*ClicksPerHalfCycle60/d'1000')        ; 7
         906
       retlw   low(d'898'*ClicksPerHalfCycle60/d'1000')        ; 8
         898
       retlw   low(d'891'*ClicksPerHalfCycle60/d'1000')        ; 9
         891
       retlw   low(d'884'*ClicksPerHalfCycle60/d'1000')        ; 10
         884
       retlw   low(d'878'*ClicksPerHalfCycle60/d'1000')        ; 11
         878
       retlw   low(d'872'*ClicksPerHalfCycle60/d'1000')        ; 12
         872
       retlw   low(d'866'*ClicksPerHalfCycle60/d'1000')        ; 13
         866
       retlw   low(d'861'*ClicksPerHalfCycle60/d'1000')        ; 14
         861
       retlw   low(d'856'*ClicksPerHalfCycle60/d'1000')        ; 15
         856
       retlw   low(d'851'*ClicksPerHalfCycle60/d'1000')        ; 16
         851
       retlw   low(d'847'*ClicksPerHalfCycle60/d'1000')        ; 17
         847
       retlw   low(d'842'*ClicksPerHalfCycle60/d'1000')        ; 18
         842
       retlw   low(d'838'*ClicksPerHalfCycle60/d'1000')        ; 19
         838
       retlw   low(d'834'*ClicksPerHalfCycle60/d'1000')        ; 20
         834


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

1998\12\08@160819 by Stig Brautaset

flavicon
face
{Quote hidden}

Why do you set RP0? PCLATH is in both bank0 and bank1.


> ;       movlw   0x00D
> ;       movwf   PCLATH
> ;
> ;       bcf     STATUS,RP0
> ;       movfw   GOVALUE

I think you want to use movf here.


> ;
> ;       bsf     STATUS,RP0
> ;       call    LUT2
> ;       movlw   0x000
> ;       movwf   PCLATH

Are you sure that 0x000 is the actual location of adress of pclath? Remember
that your table takes up the first 256 spaces or so... Try this instead:

       movf    high    $
       movwf   PCLATH



{Quote hidden}

1998\12\08@203522 by Stig Brautaset

flavicon
face
Excuse me for the dubble posting. Se below for my humble attempt at your
problem.

Stig

{Quote hidden}

Why do you set RP0? PCLATH is in both bank0 and bank1.


> ;       movlw   0x00D
> ;       movwf   PCLATH
> ;
> ;       bcf     STATUS,RP0
> ;       movfw   GOVALUE

I think you want to use movf here.


> ;
> ;       bsf     STATUS,RP0
> ;       call    LUT2
> ;       movlw   0x000
> ;       movwf   PCLATH

Are you sure that 0x000 is the actual location of adress of pclath? Remember
that your table takes up the first 256 spaces or so... Try this instead:

       movf    high    $
       movwf   PCLATH



{Quote hidden}

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