printf problem!

  • kamil51

    kamil51 - 2007-08-17

    I have a problem at the printf() function. I am using AT89C52 chip. and I am sending the data to the serial port. For instance when using the code below,

    unsigned char value1,value2,value3,value4,value5;

    printf_tiny ("%x%x%x%x%x",value1,value2,value3,value4,value5);

    and data taking from the serial port(rx/tx) like this:
    but, data that I need should be like this:
    I used all printf function but same problem.

    awaiting for your reply


    • Frieder Ferlemann

      use "%02x%02x" with the printf function.
      (printf_tiny does not support field width)

    • Oliver Sedlacek

      Oliver Sedlacek - 2007-08-17

      Beaten to it! As frief says, printf("%02x%02x", value1, value2); is the answer.

    • kamil51

      kamil51 - 2007-08-17

      can I use printf_fast_f() function instead of printf()?


      • Frieder Ferlemann

        > can I use printf_fast_f() function instead of printf()?

        Do you really need floating point???
        Your code snippet gives no indications for that.

        See section 3.16 about printf in the manual and check which flavour you need.

        Of course:
        (or your local copy) would be the authoritative answer.

        I'd also consider to continue using printf_tiny() because it is so cute
        and write an extra function like puthex(); where you need an output format
        that printf_tiny() does not support.

    • kamil51

      kamil51 - 2007-08-17

      Dear Frieder ,

      Yes, you are right. I dont need using printf_fast_f() but when I used printf()function I am getting some message!
      ?ASlink-Error-Could not get 21 consecutive bytes in internal RAM for area DSEG.
      What does it mean?


    • kamil51

      kamil51 - 2007-08-17

      Does someone know what is the meaning of error below?

      ?ASlink-Error-Could not get 21 consecutive bytes in internal RAM for area DSEG

      this error appear when I used printf() function!!!


      • Maarten Brock

        Maarten Brock - 2007-08-18

        It means that printf is larger than printf_tiny and you now have run out of data memory.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks