Hi Terd
This is how I do it when I have a number of messages to either print or put out to a 7 segment display.
Code:
' Thank DT for this Macro
ASM
GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
CHK?RP Wout
movlw low Label
movwf Wout
movlw High Label
movwf Wout + 1
endm
ENDASM
Address var word
gr[0] var byte
' Examples of how to put your strings in memory
prn_SetDate: PokeCode "Date changed",0
prn_SetTime: PokeCode "Time changed",0
prn_LogPrinted: PokeCode "Log printed",0
' And this is how to use it
@ GetAddress _prn_SetDate, _Address
gosub Prt_puts ' This is my routine to put the string to Printer.
' You could change this to your LCDout routine.
return
' And this is My Prt_puts function
' Print an ASCIIZ string
' Input - Address points to the string
Prt_puts:
repeat
peekcode Address, gr[0] ' read a byte to GR[0] (general register 0)
if gr[0] then ' if end of message (0) not found,
gosub Prt_putc ' print this character
Address = Address+1 ' advance to the next position of input string
endif
until gr[0]=0 ' go back if the message end is found
return
This is not adapted to your requirement, but, I think you can do that yourself.
Bookmarks