Hi Artem, Tanks for your help. I=B4m looking for retlw instead tblrd (table-read instructions) becouse I have some codes writes for the 16Fxxx and I have to change for the 18Fxxx series, Then In this case, it will be easier for me. I=B4ve found 2 ways to do it: Can I use the example 1 of Bob Amerman without problems? To me it look like simpler. Thanks in advanced Luis F. 1-) I=B4ve found this : http://www.piclist.com/techref/microchip/tables.htm Bob Ammerman of Ram Systems says: Here is a trick I use to avoid problems with PCLATH/PCLATU and interrupts o= n = 18C chips: given: MOVF OFFSET,WRLNCF OFFSET,1 ;here, you have to adjust de OFFSET mpy by 2 ;Now the program counter addresses bytes instead words.rcal= l = lookup_func instead of: ;align to page start if needed lookup_func: addwf PCL,Fretlw 1 retlw 2.................................................... I have used: ;align to page start if needed lookup_func: rcall lookup_index retlw 1 retlw 2 lookup_index: addwf TOSL,F return ; For large tables you can: lookup_index: addwf TOSL,F btfsc STATUS,C incf TOSH,F return........................................................ 2-)I=B4ve found in DS00716A page 3 movf OFFSET,W call TABLE ...... TABLE: movwf TABOFF ;save table offset rlncf TABOFF,1 ;mpy by 2 movlw HIGH(TAB_ST) btfsc STATUS,C incf WREG,W movwf PCLATH ;modify PCLATH if required movlw LOW(TAB_ST) ;get low byte of table address addwf TABOFF,W ;add in offset btfsc STATUS,C incf PCLATH,1 ;inc if needed movwf PCL ;make jump TAB_ST: retlw 1 retlw 2 retlw 3 ... ... Hi, Luis. I've found this : http://www.piclist.com/techref/microchip/bigtable.htm It work fine for my application. I use litle and big tables in relocatable code and i have crossing of page boundary. For avoid error in calculation You need to check the crossing by adding Offset to StartTableAdress and if result > 256 simply increment the PCLATH (high byte of adress) movlw Low(TableStart) addwf OffsetL,W skpnc incf PCLATH,F movwf PCL ;computed goto with right PCLATH ... TableStart Retlw d'0' Retlw d'255' Retlw d'9' .... etc Best Regards Artem antoniasse a =E9crit : > Hi, > > How is the correct form (or best way) to create a table lookup with > RETLWs and don=B4t cross 256 byte page boundary on PIC18Fxxxx? > > Any suggestion? > > Regards > > Luis F. > -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist