In another thread someone was asking about doing calls from within an interrupt as they wanted to use a lookup table for a seven segment display. I suggested an alternative way to do a lookup table without a call instruction.
I realised this hadn't come up previously and so I thought I'd post it here.
The above code can be run inline and whatever value is in W prior to it being executed will be used as an offset into the phrase "Hello World!". This saves a valuable call in the interrupt. The only downside is it is less efficient.
Mike.
I realised this hadn't come up previously and so I thought I'd post it here.
Code:
movwf temp
addwf PCL,f
xorlw "H"^"e"
xorlw "e"^"l"
xorlw "l"^"l"
xorlw "l"^"o"
xorlw "o"^" "
xorlw " "^"W"
xorlw "W"^"o"
xorlw "o"^"r"
xorlw "r"^"l"
xorlw "l"^"d"
xorlw "d"^"!"
xorlw "!"
xorwf temp,w
Mike.