Searching \ for '[PIC]: Jumping to address stored in two 8-bit reg' 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/microchip/devices.htm?key=pic
Search entire site for: 'Jumping to address stored in two 8-bit reg'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Jumping to address stored in two 8-bit reg'
2002\06\25@232155 by A.J. Tufgar

flavicon
face
Hello all,
         I've got a device that has a bunch of different beep codes.
What I'd like to do is store the different codes in a look-up table.

So far I've created a routine that does such (motified version of
microchips table routines), but I'm having problems going to a specfic
line number in my program.

What I want to do is this: (NOTE: is is not my actual code, just to show
what I'm having problems with)

movlw 0x000
movwf table_lowbyte

movlw 0x003
movwf table_highbyte

movwf PCLATH
movf  table_lowbyte, w
call table_highbyte + table_lowbyte <--  This is my problem how do I
tell the pic to call the address stored in the two variables?

org 0x300
movwf PCL
retlw
retlw
...

Thanks to all,
Aaron

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2002\06\26@003952 by Tony Nixon

flavicon
picon face
This is one method...


       clrf Offset
GData   movlw High(DList)
       movwf PCLATH
       movlw Low(DList)
       addwf Offset,W
       btfsc STATUS,C
       incf PCLATH
       call DList
       clrf PCLATH
       incf LoopCount
       ; do whatever with data in W
       goto GData



       org 0xWhatEver

DList   addwf PCL
       retlw 0x00
       retlw 0x01






"A.J. Tufgar" wrote:
{Quote hidden}

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
salesspamKILLspambubblesoftonline.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\26@004012 by Tony Nixon

flavicon
picon face
This is one method...


       clrf Offset
GData   movlw High(DList)
       movwf PCLATH
       movlw Low(DList)
       addwf Offset,W
       btfsc STATUS,C
       incf PCLATH
       call DList
       ; do whatever with data in W
       incf LoopCount
       movlw High(GData)       ; restore PCLATH
       movwf PCLATH
       goto GData



       org 0xWhatEver

DList   addwf PCL
       retlw 0x00
       retlw 0x01






"A.J. Tufgar" wrote:
{Quote hidden}

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
EraseMEsalesspam_OUTspamTakeThisOuTbubblesoftonline.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\26@023131 by Dwayne Reid

flavicon
face
Tony - please forgive me for disagreeing with you.

What you have written has two problems:  At the label Dlist, change 'addwf
PCL' to 'movwf PCL'  and change the (Dlist) in the statements with High and
Low with (Dilst+1).

The first problems is because you already have the correct address in W
when calling the jump table.  The second problem is because you need the
address of the start of the jump list.  You have shifted that address by 1
because of the 'addwf PCL'.

dwayne

At 01:56 PM 6/26/02 +1000, Tony Nixon wrote:
{Quote hidden}

--
Dwayne Reid   <dwaynerspamspam_OUTplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\26@055618 by A.J. Tufgar

flavicon
face
Sorry excuse my ignorance then I'm not sure of how to load the 16-bit
register not familiar with this.....

can I say movwf LOW DList?

Aaron

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\26@135540 by Dwayne Reid

flavicon
face
Late last evening, I wrote:

{Quote hidden}

This still has a problem *if* the label DList is on the last word of a 2K
ROM page.

A better fix is to move the stuff that modifies PCLATH right to the DList
subroutine as follows:

        clrf Offset
GData   call DList   ;use Xcall if DList is on a different 2K page
        ; do whatever with data in W
        incf LoopCount
        goto GData


        org 0xWhatEver

DList   ;enters with appropriate offset in register Offset
        movlw High(DListStart)
        movwf PCLATH
        movlw Low(DListStart)
        addwf Offset,W
        btfsc STATUS,C
        incf PCLATH,F
        movwf PCL,F
DListStart
        retlw 0x00
        retlw 0x01
        ...



--
Dwayne Reid   <@spam@dwaynerKILLspamspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\06\27@212554 by Tony Nixon

flavicon
picon face
Dwayne Reid wrote:
>
> Late last evening, I wrote:
>
> >Tony - please forgive me for disagreeing with you.

Hey! Stop stealing my applogies, I was the one who was wrong :-))

I simulated that with MPLAB too, and it appeared to work. I guess doing
ad_hok code with the FLU doesn't work too well.

Thanks for the pick up.


"A.J. Tufgar" wrote:
>
> Sorry excuse my ignorance then I'm not sure of how to load the 16-bit
> register not familiar with this.....
>
> can I say movwf LOW DList?

The syntax is...

       movf High(0xFFEE),W     ; W = 0xFF
       movf Low(0xFFEE),W      ; W = 0xEE

       movf High(Label),W      ; W = High byte of label value
       movf Low(Label),W       ; W = Low byte of label value

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
KILLspamsalesKILLspamspambubblesoftonline.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


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