Hello, You can also define a 'lcd_putc' function and then use it through 'putchar' which is called by the usual 'printf' library code.
void putchar(char c) { if (print2lcd) lcd_putc(c); else ser_putc(c); } Sample code : http://www.linux-france.org/prj/embedded/sources/lcd_msc1210.h http://www.linux-france.org/prj/embedded/sdcc/sdcc_course.lcd.html#sdcc_course.lcd.sdcc hth, Le dimanche 4 janvier 2009, Maarten Brock a écrit : > If you don't need a full printf, you can also use puts > which also uses putchar. > > > Thanks for the reply. On your reccomendation, I looked at some print > > examples, but didn't need anything as powerful as printf. I just created > > a print_LCD (unsigned char* message). function. Here's the working code > > for anyone at my level... > > > > void WriteLCD( unsigned char* message ) > > { > > ?unsigned char i; > > ? > > ?for( i=0; i<32; i++ ) > > ?{ > > ??if( !message[i] ) > > ???break; > > ??? > > ??DATA_OUT(message[i]); > > ?} > > }?? > > Thanks for the lead. > > Ron > > > > > > -----Original Message----- > > From: Jacques Pelletier <jpellet...@ieee.org> > > To: sdcc-user@lists.sourceforge.net > > Sent: Sat, 3 Jan 2009 3:21 pm > > Subject: Re: [Sdcc-user] LCD print("string") function? > > > > On January 3, 2009 02:16:53 pm ronnym...@aol.com wrote: > > > This is probably a very basic question, but since I am new to SDCC and > > > the 8051, I will ask anyway. How can I create a function that will > > > allow me to write a command like Print_to_LCD("Hello"); without having > > > to previously store the text to code space or data space and using a > > > pointer. I have a character print routine running for the I2C LCD > > > already. I just need to know where to find the ("text") to print after > > > the function call. Thanks, > > > Ron > > > > > > > > > ************** > > > New year...new news. Be the first to know what is making > > > headlines. (http://www.aol.com/?ncid=emlcntaolcom00000026) > > > > If you define your own function putchar to send characters to the LCD, > > you can use printf to print strings. It should call your putchar routine. > > > > JP > > > > > > ------------------------------------------------------------------------- > >----- _______________________________________________ > > Sdcc-user mailing list > > Sdcc-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > --------------------------------------------------------------------------- >--- _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user -- - Philippe Latu philippe.latu(at)linux-france.org http://www.linux-france.org/~platu (GPG|PGP) KeyId 0x742A6424 - http://www.linux-france.org/~platu/key.asc
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user