Thanks guys for the replies, but I finally figured it out. Here is the code I finally came up with (that I forgot to post in my original question), pretty much what I already had going and was wondering why it would not work!
Code:
DisplayBatID call LCD_Clr
clrf offset ;set offset register to zero
movlw d'1' ;set count register to the first
movwf count ;|character in the table
DisplayBatID_1
movf count, w ;put count value in offset
movwf offset ;|
movlw LOW BatIDL1 ;get low address of the table
addwf offset, f ;add the low address of the offset value
movlw HIGH BatIDL1 ;get high adress of the table
btfsc STATUS, C ;check if carry bit is set from the add operation
addlw 1 ;if carry set add 1 to w
movwf PCLATH ;place the high address in PCLATH
movf offset, w ;place low address in w
call BatIDL1 ;get a character from the text table
xorlw 0x00 ;is it a zero?
btfsc STATUS, Z ;check if zero bit is set from the above compare
goto DisplayBatID_2 ;if zero set get out of here
call LCD_Char ;zero not set, display character
incf count, f ;increment count register
goto DisplayBatID_1 ;start again and get next character in table
DisplayBatID_2 call LCD_Line2
clrf offset ;set offset register to zero
movlw d'1' ;set count register to the first
movwf count ;|character in the table
DisplayBatID_3
movf count, w ;put count value in offset
movwf offset ;|
movlw LOW BatIDL2 ;get low address of the table
addwf offset, f ;add the low address of the offset value
movlw HIGH BatIDL2 ;get high adress of the table
btfsc STATUS, C ;check if carry bit is set from the add operation
addlw 1 ;if carry set add 1 to w
movwf PCLATH ;place the high address in PCLATH
movf offset, w ;place low address in w
call BatIDL2 ;get a character from the text table
xorlw 0x00 ;is it a zero?
btfsc STATUS, Z ;check if zero bit is set from the above compare
goto DisplayBatID_4 ;if zero set get out of here
call LCD_Char ;zero not set, display character
incf count, f ;increment count register
goto DisplayBatID_3 ;start again and get next character in table
DisplayBatID_4 bcf flags, change
retlw 0x00
Well after a good nights sleep and alot of dreaming of ASM code. It came to me that my tables started with a standard "addwf PCL, f" and should not be adding the w register to the PCL but replace the PCL with the calculated value so I changed the start of my tables with the instruction "movwf PCL" and all works now.
After looking at the application note from Microchip, it flashed in my face that this is what they were doing also but just did not notice it before!!!
Now that it works, I try to optimise the code a little, I probably can cut down on the variable registers (offset and count) so that only one is required and save a few instructions in the process.
In reply to Matt...
Not sure how your code works but from what I can see it should not work at all because the "incf HU_LOW,F" does not affect the Carry bit. So your "incf LU_HIGH,F" right after your carry test would never be executed.
This is why I use the "addwf" instead of a standard "incf" instruction in my code instead of incrementing it. It's also why I must use two different registers to keep track of where I am in my offset calculations and carry over test!
In reply to Nigel and motion...
I tought of doing this (changing the location of my tables) but I have so many messages to display I'm going over 3 memory boundaries. If I would add other tables in the middle of them so that relevant messages are grouped together, I would have to recode a bunch of code to take in to account the changes each time!
Anyway thanks to everyone for the suggestions, I think all I needed was a good 5 hours of sleep