Topic: [8051] printf to anything
hello!
i'm working on a project in our school. we're in the near end implementing the software for the hardware we developed.
it's a modular hardware where you can plug in a lcd, use a soft-uart for communication, print something via the normal uart and so on.
i've already implemented the basic routines for printing to every device, but i'd like to make it printf-compatible.
i already read about setting a bit which determines the way the string is sent out, but this method is not comfortable enough.
i'd like to implement for example lcd_printf which calls printf outputting to the LCD. same for uart and i2c.
i saw on other compiles printf-implementations where the output-rounine used is passed on as a parameter
extern int _doprnt( void (*iofunk)(uchar) reentrant, far char* pfmt, va_list (fap));
int lcd_printf(far char* pfmt, ...){
va_list(ap);
va_start(ap,pfmt);
return _doprnt(lcd_putc, pfmt, ap);
}is something like this also possible in RIDE?
or other way round: is it possible to get the address of the printf-buffer used by the compiler internally? i could conserve memory if i use the same buffer. using that address i could sprintf into the
buffer and output it comfortably with my existing functions.
thanks in advance!
greets, christian hartl