> -----Original Message-----
> From: EXT Peter Betts [
spam_OUTpeter.bettsTakeThisOuT
NOKIA.COM]
> Sent: Monday, June 12, 2000 2:53 PM
> To:
.....PICLISTKILLspam
@spam@MITVMA.MIT.EDU
> Subject: PCL, PCLATH and Tables
>
>
> Hi all,
>
> I understand that PCL is the lower bits of the program
> counter and PCLATH is
> the program counter latch high bits so PCLATH and PCL
> together form the
> program counter.
>
> When I see code reagrding tables like
>
> table: addwf PCL
> retlw value1
> retlw value2
> ..
> ..
> .. etc
>
> I can see that the lower bits of the program counter are
> modified according
> to the index given in "w" register so that it jumps to the
> table entry at
> the given index and then executes a return literal in "w" command.
>
> Now the table is therefore inherently limited by the size of the PCL
> register? Yes?
> This is 8 bits so the table size can only be 256 max.
>
> If the table is larger than 256 one has to start to modify the PCLATH
> register as well to adapt the higher bits of the program counter.
>
> So we could pass parameters to a function such as the index
> into the table
> in say TABLE_LO and TABLE_HI and use TABLE_LO to modify PCL
> and TABLE_HI to
> modify PCLATH
>
> Firstly, do I need to modify the PCLATH first and then PCL or can you
> independantly update then without need to worry about the
> other. i.e. if
> youwrite to PCLATH does it corrupt or modify PCL in any way?
> I don't think
> so?
>
> Secondly I've seen methods of table indexing which doesn't
> use the "retlw"
> command using the directive "dt" and then the data
>
> e.g.
> dt "This is a line of text", 0x34, "and some
> more", 0x12, 0x00
>
> I can't find an exact example to show you but can someone
> explain how this
> sort of table indexing works and what rules I must use for
> PCLATH and PCL?
>
> I've tried Phil Andersons code (It think it was Phil's) code to index
> mutiple text strings for display on an LCD but I cannot get
> it to work. I
> get garbage on the LCD and the PIC crashes but using the
> retlw method it's
> O.K. When I step through the code all seems well but when the data is
> transferred to the LCD display routine it all falls over.
> Have I mucked up
> the PC ?
>
> Can someone explain this for me?
>
> I'm searching through the archives now but if someone could
> point this out
> it would be great.
>
> Pete
>