Searching \ for 'lookup-tables woes' 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=lookup
Search entire site for: 'lookup-tables woes'.

Truncated match.
PICList Thread
'lookup-tables woes'
1998\01\01@154519 by calls

flavicon
face
Well,
                                       I have a question relating to lookup tab
les that cross the page
boundaries.  I know that microchip has an app note about this, and I've
read it.  I use the Parrallax assembler, and I'm having trouble getting
it to copy the high byte of the table location into the w register for
computation. It copies the low byte fine.  I know this because I've used
psimulator to track the problem down. Unfortunately, in the manual, they
only mention that < is high byte and > is low byte.  MPASM used the
command 'HIGH _memory location_", but I couldn't get spasm to work with
that command.  I think you use the parallax assmbler too. Here's my
code. Please note that this code will be placed somewhere else in memory
and there is a larger data table, too. I tried to make the code as
compact as possible. Please note the remark that says
";copy high byte ***problem area***," that's where the assembler isn't
doing what I want it to do.
;--------------------------------------------------------------------
                device pic16c73,xt_osc,wdt_off,protect_off
                org     20h             ;Start of available RAM
lamp            ds      1
w_copy          ds      1
s_copy          ds      1
TMRlow          ds      1               ;16-bit timer value/low byte
TMRhigh         ds      1               ;16-bit timer value/high byte
REDval          ds      1

;        =====================================================
;        CREATE DELAY
;        =====================================================
;        ----------------------- USE LOOK-UP TABLE (HIGH BYTE)
        org 000
        mov     REDval,#01100100b
loop    movlw   POWERhi:tbl >                  ;copy low byte
        add     REDval,w
        mov     w,POWERhi:tbl <  ;copy high byte ***problem area***
        snc
         add     w,#00000001b
        mov     PCLATH,W
        mov     W,REDval
        call    POWERhi
        mov     TMRhigh,w               ;put value in countdown
register

;====== HI-BYTE LOOK-UP ========================
POWERhi movwf   PCL                           ;jump to appropriate byte
:tbl    retw    001,001,001                               ;100% - 98%
       retw    002,002,002                               ; 97% - 95%
       retw    003,003,003                               ; 94% - 92%
       retw    004,004,004,004                           ; 91% - 88%
       retw    005,005,005,005                           ; 87% - 84%
       retw    006,006,006,006                           ; 83% - 80%
       retw    007,007,007,007                           ; 79% - 76%
       retw    008,008,008,008                           ; 75% - 72%
       retw    009,009,009,009                           ; 71% - 68%
       retw    010,010,010,010                           ; 67% - 64%
       retw    011,011,011,011                           ; 63% - 60%
       retw    012,012,012,012                           ; 59% - 56
       retw    013,013,013,013,013                       ; 55% - 51%
       retw    014,014,014,014,014                       ; 50% - 46%
       retw    015,015,015,015,015                       ; 45% - 41%
       retw    016,016,016,016,016                       ; 40% - 36%
       retw    017,017,017,017,017                       ; 35% - 31%
       retw    018,018,018,018,018,018                   ; 30% - 25%
       retw    019,019,019,019,019,019                   ; 24% - 19%
       retw    020,020,020,020,020,020                   ; 18% - 13%
       retw    021,021,021,021,021,021                   ; 12% -  7%
       retw    022,022,022,022,022,022,022               ;  6% -  0%

1998\01\01@231758 by Andrew Warren

face
flavicon
face
Shawn Call <spam_OUTcallsTakeThisOuTspamcoral.indstate.edu> wrote:

> I use the Parrallax assembler, and I'm having trouble getting it
> to copy the high byte of the table location into the w register for
> computation. .... MPASM used the command 'HIGH _memory location_",
> but I couldn't get spasm to work with that command.

Shawn:

Presumably, even a toy assembler like Parallax's can parse simple
mathematical expressions.  Try something like:

   MOVLW   TABLE/256

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499

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