BOY! I'am really sorry about the formating! This is my first post. Just when you feel smart, something simple as TABS and SPACES jump up and bite you in the butt. But I'll figure it out, I think.
This rutine was writen for MPLAB. Just cut and paste it into MPLAB.
It uses 16 bit addressing for tables larger than 256 bytes, but should work
with smaller tables. Tables smaller than 256 bytes only require 8 bit addressing. As writen it should send the text string "ERROR" .
The data char will be in W. Just change CALL LCDPRT to CALL "your_rutine".
;***********************************************************************
CBLOCK 0x20
Text_Pointer_L
Text_Pointer_H
ENDC
; setup rutine
MOVLW LOW(Text_4) ;point to Text Data label in program memory
MOVWF Text_Pointer_L
MOVLW HIGH(Text_4)
MOVWF Text_Pointer_H
CALL Table_Print ;print text to LCD
;***********************************************************************
;table rutine
Table_Print
CALL T_PRT1 ; read one char to be place in W
ANDLW 0xff ; check for 0x00 at end of text string
BTFSC STATUS, Z ; for end of text
RETURN ; 0x00 end of text, exit rutine
CALL LCDPRT ; print character in W to LCD screen
;MS_Pause_MAC .10 ;************ delay to slow down print for effect
CALL T_PRT2 ; get character to be printed
GOTO Table_Print
T_PRT1 MOVF Text_Pointer_H, W ; point to location of char
MOVWF PCLATH
MOVF Text_Pointer_L, W
MOVWF PCL
;JUMPS TO TABLE FROM HERE THEN RETURNS WITH THE CHARACTER TO BE PRINTED IN W
T_PRT2 INCFSZ Text_Pointer_L, F ;increment char address
RETURN
INCF Text_Pointer_H, F
RETURN
;***********************************************************************
;data table
; Text_0 clears a line without having to clear the entire screen
Text_0 DT ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0x00 ; 20 spaces
; Text_1 scrolling cursor
Text_1 DT 0x10,0xfe,0x10,0x11,0xfe,0x10,0x12,0xfe,0x10,0x13,0xfe,0x10,0x14,0xfe,0x10,0x15,0xfe,0x10,0x16,0xfe,0x10,0x17,0xfe,0x10,0x18,0xfe,0x10,' ',0x00
Text_2 DT 'S','T','A','R','T',0x00 ;"START"
Text_3 DT 'E','N','D',0x00 ;"END"
Text_4 DT 'E','R','R','O','R',0x00 ;"ERROR"