Mirroring characters in RAM buffer to serial LCD

04 Jul 2012

Hello, I want to use a RAM buffer of 32 chars to mirror the contents of a 2 x 16 serial LCD. I will use a pointer to point to the current cursor position in the RAM buffer. This will allow me to easily perform actions like clear the contents of a line from the current position to the end of the line. So to clear the display I would simply clear the RAM buffer to 0x20. I would use a Ticker to periodically refresh the real LCD characters. My question, how do I use call printf and intercept the data it produces so that I can put each char into the RAM buffer and increment the RAM cursor pointer for each char? In other compilers I have declared a function _putchar which would receive each char generated by calling printf. I look forward to hearing your suggestions. Regards Phil.