Thread: Displaying Values...

  1. #31
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You guys sure like to make things hard on yourselves. Use sprintf to format whatever style of number you want, then just display each character one at a time.


    Quzah.
    Hope is the first step on the road to disappointment.

  2. #32
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    hi quzah..
    sorry.. im quite new to C... wat is a sprintf?

    my display wont work with printf, %d, %f % etc.. so i think sprintf wont work too...

    so now what i need is to get two seperate integer
    so i could put into my display.

    help pls.....

  3. #33
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    sprintf prints to a buffer (string), not to an output device (stdout). If I wanted to store the number 1234 in a string, instead of printing it on the screen, I could use sprintf to store it in a string of characters, instead of storing it as an integer. Grab your book, or the nearest search engine, and look up sprintf.


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #34
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    could anyone help me using some coding to my question?
    thank you.

  5. #35
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    In post #29 I wanted to see if the logic was right for the ADC.

    No need to run it on your device - just see if it's right, on your computer.

    As noted above by Quzah, the sprintf() function could be very useful.

    Could sprintf(), be used on your device?

    I didn't think so, since it has no printf(), but it's too important a question not to ask.

  6. #36
    Registered User
    Join Date
    Jan 2010
    Posts
    25
    never mind guys.. i did it with a simple code..

    d3 = opvalue_d1 * 30 / 255;
    d1 = d3 / 10 + '0';
    d2 = d3 % 10 + '0';

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Displaying Minimum and Maximum values from input
    By mgardnertech in forum C Programming
    Replies: 1
    Last Post: 06-29-2008, 08:47 PM
  2. Storing values from Edit Box into an array
    By E_I_S in forum C++ Programming
    Replies: 10
    Last Post: 06-05-2008, 06:24 AM
  3. putting values into an array
    By zdream8 in forum C Programming
    Replies: 15
    Last Post: 05-21-2008, 11:18 PM
  4. Displaying numerical values in a window
    By drb2k2 in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2003, 12:05 PM
  5. unsigned char vs signed char and range of values
    By Silvercord in forum C++ Programming
    Replies: 5
    Last Post: 01-22-2003, 01:30 PM