PCLATH has two slightly different uses.
First, whenever a write to PCL occurs then PCLATH is copied to the high byte of the program counter.
An example may help,
Code:
movlw 0x01
movwf PCLATH
movlw 0x23
movwf PCL
After the write to PCL the program will jump to location 0x0123 because the program counter gets loaded from PCLATH and PCL. Note the write to PCLATH doesn't affect anything until the write to PCL.
When it comes to tables then the normal way to use them is to place the table on a page boundary (0xnn00) and load PCLATH with the high byte of the address (0xnn). The limitation of this method is that the table has to be in the one block of 256 bytes.
An alternate method that gets around this limitation is to calculate PCLATH as well as PCL. Such as,
Code:
movlw high(table)
movwf PCLATH
movwf low(table)
addwf Pointer,W
btfsc STATUS,C
incf PCLATH,F
movwf PCL
table retlw 00
This allows the table to be anywhere and if you make the Pointer 16 bit then you can have a table of any size.
The second use for PCLATH is when doing a jump or call. These instructions only provide 11 bits for the address and so the other bits come from the top 5 bits of PCLATH.
So, to jump to location 0x876 you would do,
Code:
movlw 0x08
movwf PCLATH
goto 0x076
However, this is never encountered unless you use a larger pic - one with more than 2K of program space.
HTH
Mike.