Steve, 'TABLE' is a label. It is at the begining of the data table below. "OFFSET' is how deep into the table do you want to go. For instance, in the table listed below, lets say you had the offset at 2. In this case, RETLW would return "C". The reason for this is that at compile time, the compiler saw the label 'TABLE', and set it's address to whatever. This address can be found several places, but I like looking at the listing file. So when the table lookup routine is called, the PC is loaded with the address of the label table. Next it adds the 'OFFSET' to the PC to come up with the final destination address. And in this case, that equates to final destination address points to 'C' in the table. Is this clear to you now? Basically what you have is the compiler locates the table somewhere in memory, and the combination of the base address plus the offset equals the element in the table you want to retrieve. Hope this helps you out. Regards, Jim On Thu, 29 June 2000, "Kosmerchock, Steve" wrote: > > Friends, > > I know this question has been asked, and yes I looked at the > PICLIST FAQ. There was good info their, but I was hoping somebody could > explain a few things to me. > > In MICROCHIPs application note AN556 "Implemeting a Table Read" > the code is as follows: > > movlw LOW Table > addwf offset > movlw HIGH Table > btfsc status,c > addlw 1 > movwf PCLATH > movf offset,w > call Table > ; > ; > ; > Table: > movwf pcl > retlw 'A' > retlw 'B' > retlw 'C' > ; > ; > etc............ > > > I know that "LOW" is taking the lower byte of "Table". > Problem is,..... what is "Table"? Do you equate it to a > number at the beginning of the program like: > > Table EQU H'0200' > > This will load 0x00 into "LOW" and 0x02 into "HIGH"? > Does it have to have the same name as the table of data? > Also, the register labeled "offset", is it some type of > register that is being incremented, decremented,...etc? > > Thank you very much!! > > Best regards, > Steve > > > Steven Kosmerchock > Radio Frequency Systems > Phoenix Arizona USA > www.rfsworld.com > > www.geocities.com/researchtriangle/lab/6584 jim@jpes.com