Gast
#2425542
Hallo, ich habe ein Problem mit sprintf()unter AVR Studio 5. Ich will folgenden String formatieren. sprintf(current1, "Trafo2 = %F1.2 A\n", tmp); oder sprintf(current1, "Trafo2 = %f1.2 A\n", tmp); oder sprintf(current1, "Trafo2 = %e1.2 A\n", tmp); oder sprintf(current1, "Trafo2 = %E1.2 A\n", tmp); Die Ausgabe erfolgt auf einen LCD Display. Das Display gibt bei allen Formaten folgendes aus: 'Trafo2 = ?1.2 A' mit sprintf(current1, "Trafo2 = %d1.2 A\n", tmp); 'Trafo2 = -123451.2 A' wobei -12345 nur ein Beispiel ist um zu zeigen, dass bei %d eine Formatanweisung ausgeführt wird. tmp ist float = 1.33. Kann jemand helfen, habe ich irgend eine Bibliothek nicht geladen? folgende Files habe ich importiert: #include <stdbool.h> #include <stdio.h> #include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <string.h> #include "display_current.h" #include "lcd_dip204ks0073_spi_avr.h" // LCD-Funktionen #include "hardware.h" #include "config.h"