I hope you would not mind if I share a modification of your macro set. I'd use 0 termination for strings so it would be compatible with C if at any stage you would need to mix C with your existing code base. Also it makes things easier with the end-of-string checking, see below: display macro var ;load TBLPTR with string address movlw upper(var) ; I wouldn't save on this 1 instruction movwf tblptru movlw high(var) movwf tblptrh movlw low(var) movwf tblptrl call get_txt endm Use as eg display calib ;retrieve characters from memory get_loop dispw ;"print W to LCD" macro get_txt ; i'd put the function entry here, ; so can save a tblrd*+ in the macro tblrd*+ movf tablat,w ; we have to read the data to W anyway bnz get_loop ; ...so easier to check end-of-string return ;data strings padded to even number of characters with FF terminator ; i'd use db instead as the trailing zero occupy 1 space in that way ; (see the program memory view to see what happens with different data definitions) compress db "Compress",0 serial db "Serial port",0 calib db "Calibrate",0 ;macro - display contents of W on LCD via write_d entry point dispw macro call write_d endm Tamas On Fri, Jun 20, 2008 at 10:47 AM, Jinx wrote: > > I just use table reads on the 18F series > > Wrote a table macro, keeps the listing a bit tidier. Seems to be > OK so far > > display macro var ;load TBLPTR with string address > clrf tblptru > movlw high(var) > movwf tblptrh > movlw low(var) > movwf tblptrl > tblrd*+ > call get_txt > endm > > Use as eg display calib > > ;retrieve characters from memory > > get_txt movfw tablat ;get characters until > btfsc wreg,7 ;W > 0x7f (ie FF terminator) > return > dispw ;"print W to LCD" macro > tblrd*+ > bra get_txt > > ;data strings padded to even number of characters with FF terminator > > compress data "Compress",0xffff > serial data "Serial port",0xffff > calib data "Calibrate",0xff > > ;macro - display contents of W on LCD via write_d entry point > > dispw macro > call write_d > endm > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- Rudonix DoubleSaver http://www.rudonix.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist