Konwersja w avr gcc

Witam.

Wiec mam taki prosty problem: czytam dana z rejestru (8-mio bitowa liczba okreslajaca stan portu B) jak ta liczbe zamienic na string zeby to wyscietlic na wyswietlaczy LCD?

Pozdrawiam.

Reply to
Viki
Loading thread data ...

Uzytkownik "Viki" snipped-for-privacy@poczta.onet.pl> napisal w wiadomosci news:d20rk5$f7m$ snipped-for-privacy@nemesis.news.tpi.pl...

Najlatwiej/najbardziej elastycznie jest sprintf'em, tyle ze to duza funkcja.

Krzysiek Rudnik

Reply to
Krzysztof Rudnik

Dnia 25-03-2005, pią o godzinie 12:08 +0100, Viki napisał(a):

Może coś takiego?

char * bleh(unsigned int n) { static char ret[4] = { 0, 0, 0, 0};

ret[0] = n/100 + 0x30; n -= n/100 * 100;

ret[1] = n/10 + 0x30; n -= n/10 * 10;

ret[2] = n + 0x30;

return ret; }

Reply to
Krzysztof Godlewski

Użytkownik Viki napisał:

#include <stdlib.h>

... itoa(int, string, 2); - jesli chcesz wyswietlic binarnie itoa(int, string, 10); - jesli chcesz wyswietlic dziesiętnie

ewentualnie sprintf

Reply to
Piotr Buczynski

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.