Jinx wrote: > But this adds W to PCL and returns immediately to 00xx, not > to 01E8 > > 01E2 movwf devno > call bitnum > 01E8 movwf temp > 01EA bra cp_num > > 0204 bitnum > addwf pcl > retlw 0x01 > retlw 0x02 > etc > > =============================== > > The problem is obviously (?) something to do with the high part > of PCL, I think you've got it. There is nothing wrong with RETLW. It's never getting to that instruction. The problem is that PCLATH and PCLATU are not set properly and the ADDWF PCL therefore jumps to an unexpected location instead of into the table as you intended. As has been said many times before, ADDWF PCL type lookup tables are a bad idea unless you really really need the code space or cycles. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.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