So I'm trying to get my little LCD up and running on my PIC18F4550. I got putcXLCD to work just fine and I think my microchip is communicating fine. I can get putrsXLCD to work however trying to use putsXLCD in any form just causes garbage on the screen.
I'm having trouble wrapping my head around why putsXLCD would get garbage for string data. Is it because it's declared as a local variable? If I change the storage qualifier to rom and use putrsXLCD everything works fine.
It is due to the different types of pointers available on a Pic. The various subroutines can take ROM or RAM pointers. If a ROM pointer is used then the code uses the Table read commands to access the data, if RAM then the FSR register is used. If you pass a RAM pointer to a function that expects a ROM pointer then it reads garbage from the ROM area instead of the data from the RAM area. Likewise if you pass a ROM pointer to a function expecting a RAM pointer. Unfortunately Microchip didn't implement a function to distinguish between the two pointer types and so invariably two functions have to be written. For completeness I should mention that there are actually 4 pointer types as there are also near and far pointers.
I understand that for the most part, I'm just trying to figure out why ROM puts works fine but normal RAM doesn't. Luckily printf rerouted through putcXLCD works flawlessly so I'll just stick with that for now.