Hi Stefan,
habe mir inzwischen auch einiges überlegt:
void inttostring(int value, char \*valuestring)
{
bool neg = false;
char tempstr[20];
int i = 0;
int c; // one digit
char \*tempstring;
tempstring = valuestring;
if (value -1;i--)
{
\*tempstring = tempstr[i];
tempstring++;
}
\*tempstring = '\0';
}
void floattostring(float value, int decimal, char \*valuestring)
{
bool neg = false;
char tempstr[20];
int i = 0;
int j = 0;
int c; // one digit
long int val1, val2;
char \*tempstring;
tempstring = valuestring;
if (value 0) && (i == decimal))
{
tempstr[i] = (char)(0x2E);
i++;
}
else
{
c = (val2 % 10);
tempstr[i] = (char) (c + 0x30);
val2 = val2 / 10;
i++;
}
}
if (neg)
{
\*tempstring = '-';
tempstring++;
}
i--;
for (;i \> -1;i--)
{
\*tempstring = tempstr[i];
tempstring++;
}
\*tempstring = '\0';
}
Ich brauche in diesem Falle ja ne Dezimalausgabe (soll ein einfach abzulesenes Meßgerät werden) vielleicht läßt sich der Code aber noch etwas optimieren? (will nicht zuviele Libraries einbinden, wenn ich es smarter programmieren kann, habe für alles nur 16K *16bit zur Verfügung)
Habe keine speziellen Funktionen gebraucht, aber werde Deinen Algorithmus mir nachher genauer anschauen.
PS: ich habe hier keine Standardausgabe, nur das LCD am Prozessor, und da schaut der Funktionsaufruf dann so aus:
lcd\_print(zeile,HOME2\_LCD);