how to convert a int ( or unsigned char )

A

Andre

to a strings of char??
such as would
printf("%d",xx); do or better scanf(..)
I can't use scanf as I am running this on a PIC16F877 and I am short of
memory.
traget is to display time and temperature on a LCD, time being available
as long UTC;
Any idea??
Many thanks in advances.
Andre
 
B

Bjorn Augestad

Den 19.12.2012 11:53, skrev Andre:
to a strings of char??
such as would
printf("%d",xx); do or better scanf(..)
I can't use scanf as I am running this on a PIC16F877 and I am short of
memory.
traget is to display time and temperature on a LCD, time being available
as long UTC;
Any idea??
Many thanks in advances.
Andre

How about something like this untested snippet:
char s[3];
unsigned hour = some_value_between_0_and_23;

s[0] = hour / 10 + '0';
s[1] = hour % 10 + '0';
s[2] = '\0';

display_hour_on_LCD(s);
...

Same for minutes and temperatures. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top