Fabiano, Try this org 20h Table1 > movwf temp > movlw HIGH $ > movwf pclath > movf temp,w addwf PCL,F retlw B'00001110' ; line 0x0000 retlw B'00010001' ; line 0x0001 retlw B'00010001' ; line 0x0002 retlw B'00010001' ; line 0x0003 Pailoor Fabiano Leitao wrote: > Hello, people. > > I want to implement a table look-up for a P16C74A. This table is called by > another routine placed at 0x200. As the table is large and crosses the 256 > bytes page boudary, I used the piece of code suggested by the application > note AN556, in order to allow me to place the table anywhere in program > memory. Please , see the code below: > > org 00 > goto Main > > org 04h > goto inter > . > . > org 20h > Table1 > addwf PCL,F > retlw B'00001110' ; line 0x0000 > retlw B'00010001' ; line 0x0001 > retlw B'00010001' ; line 0x0002 > retlw B'00010001' ; line 0x0003 > . > . > retlw B'00011111' ; linha 0x00fd > retlw B'00010001' ; linha 0x00fe > retlw B'00010001' ; linha 0x00ff > retlw B'00011110' ; linha 0x0100 > retlw B'00010001' ; linha 0x0101 > retlw B'00010001' ; linha 0x010f > . > . > retlw B'00010001' ; linha 0x011f > retlw B'00010001' ; linha 0x0120 > > org 0x 0200 > Call_table > ; do a lot of things here > . > . > movlw LOW Table1 ; AN556 suggestion > addwf offset_Table1 > movlw HIGH Table1 > btfsc STATUS,C > addlw 1 > movwf PCLATH > movf offset_Table1,w > call Table1 > . > . > return > > org 0x0300 > Main > . > . > call Call _table > . > . > end > > Well, the fact is that the return codes from the table calls are not > correct, and for some offset values given to the table, the PIC "crashes". > I suspect that the jump to the table routine is not OK. > > Could anyone help me ? > > This is my first message to this list. I expect to give many contributions > to everybody in the future. > > Thanks in advance. > > Fabiano O.L. > > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com -- Website : http://business.vsnl.com/chiptech Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Ravi Pailoor Content-Disposition: attachment; filename="vcard.vcf" Attachment converted: wonderland:vcard.vcf 3 (TEXT/CSOm) (0000BC89)