This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using printf for serial & LCD together

in C51, the default printf() is used for serial comm., depends on putchar.c
now, i'm trying to modify it(putchar.c) for my 8-bit LCD.

the question is, can putchar.c or printf() be used on both, serial comm. and 8-bit LCD, at same time (at the same main program)?

nb: i want to display floating point, that's why i'm trying to use printf()

Parents
  • "in C51, the default printf() is used for serial comm"

    No: you need to be clear that printf() is entirely unaware of what physical interface is used to send the output that it generates!

    It is entirely a matter of the putchar() implementation.

    "the question is, can putchar() be used on both, serial comm. and 8-bit LCD, at same time"

    Why would that not be possible??

    char putchar( char c)
    {
       put_to_serial( c );
       put_to_lcd( c );
       put_to_whatever_else_you_like( c );
       return c;
    }
    

Reply
  • "in C51, the default printf() is used for serial comm"

    No: you need to be clear that printf() is entirely unaware of what physical interface is used to send the output that it generates!

    It is entirely a matter of the putchar() implementation.

    "the question is, can putchar() be used on both, serial comm. and 8-bit LCD, at same time"

    Why would that not be possible??

    char putchar( char c)
    {
       put_to_serial( c );
       put_to_lcd( c );
       put_to_whatever_else_you_like( c );
       return c;
    }
    

Children