Re: modifying PC

Started by Eirik Karlsen November 20, 2003
Hi guys

PIC18:
I want the program to branch to the variable(computed) 16bit address contained in TEMP1:TEMP0

How do I modify the PC to do this?

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen



Hi
 
The 18 series need computed jumps to be multiplied by two as opposed to all 16f chips.  The PRODH I mostly fix as I put tables in a certain code position but this can also be dynamically calculated at a huge code cost.  Tables preferably should be contained with a page (256 bytes) if you do not want to manage this with plenty of code.
 
      movlw       HIGH (MyTable)
      movwf       PCLATH
      movlw       JumpToThisPosition
      call            MyTable
      .........
      .........
 
 
MyTable
      mullw         2
      movf         PRODL,w
 
      addwf       PCL,F           ;add to PCL to jump into table
      retlw       '0'       
      retlw       '1'              
      retlw       '2'       
 
 
regards
Martin
 
----- Original Message -----
From: Eirik Karlsen
To: p...@yahoogroups.com
Sent: Friday, November 21, 2003 10:18 AM
Subject: Re: [piclist]modifying PC

Hi guys

PIC18:
I want the program to branch to the variable(computed) 16bit address contained in TEMP1:TEMP0

How do I modify the PC to do this?

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Best Regards
Eirik Karlsen


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

">Yahoo! Terms of Service.