Codevision AVR - Funzt nicht richtig

Gast #35609
Hallo,

also nach dem ich meinen avr gebrannt bekommen habe, wollte ich nat. 
auch mein kleines projekt fortsetzen, nur leider klappt das nicht so 
ganz... habe mithilfe von Codevision AVR ein kleines programm 
geschriebenund bekomme wenn ich compiliere, immer den fehler "Error in 
library c:\cvavr\lib\stdio.lib  Line:1238 Declaration Syntax error."

und: >too many parameters in function call< in dieser zeile

"sprintf(lcd_temp,"RPM: %6u",rpm);"

kann mir da vielleicht einer nen tipp geben?

Mfg
Marcel
Gast
Hi Marcel,
du musst mal unter der Hilfe von Code Vision nach sprintf suchen. Dort 
wird die Syntax erklärt. Du hast offentsichtlich zu viele Parameter 
übergeben. sprintf braucht nur 2.

Ich hoffe, das hat geholfen
Gruß Oliver

void sprintf(char *str, char flash *fmtstr [ , arg1, arg2, ...])

  this function is identical to printf except that the formatted text is 
placed in the null terminated character string str.

In order to reduce program code size, there is the Project|Configure|C 
Compiler|Code Generation|(s)printf features option.

It allows linking different versions of the printf and sprintf 
functions, with only the features that are really required  by the 
program.

The following (s)printf features are available:

·  int - the following conversion type characters are supported: 'c', 
's', 'p', 'i', 'd', 'u', 'x', 'X', '%', no width or precision specifiers 
are supported, only the '+' and ' ' flags are supported, no input size 
modifiers are supported

·  int, width - the following conversion type characters are supported: 
'c', 's', 'p', 'i', 'd', 'u', 'x', 'X', '%', the width specifier is 
supported, the precision specifier is not supported, only the '+', '-', 
'0' and ' ' flags are supported,  no input size modifiers are supported
·  long, width - the following conversion type characters are supported: 
'c', 's', 'p', 'i', 'd', 'u', 'x', 'X', '%' the width specifier is 
supported, the precision specifier is not supported, only the '+', '-', 
'0' and ' ' flags are supported,  only the 'l' input size modifier is 
supported

·  long, width, precision - the following conversion type characters are 
supported: 'c', 's', 'p', 'i', 'd', 'u', 'x', 'X', '%', the width and 
precision specifiers are supported, only the '+', '-', '0' and ' ' flags 
are supported,  only the 'l' input size modifier is supported
·  float, width, precision - the following conversion type characters 
are supported: 'c', 's', 'p', 'i', 'd', 'u', 'e', 'E', 'f', 'x', 'X', 
'%', the width and precision specifiers are supported, only the '+', 
'-', '0' and ' ' flags are supported,  only the 'l' input size modifier 
is supported.

The more features are selected, the larger is the code size generated 
for the printf and sprintf functions.
Gast
Danke für den ausführlichen hinweis, es hatte tatsächlich mit dem 
sprintf() zu tun, aber dies lag an meiner alten version von codevision 
;( hierdrauf wurde ich gestern im chat hingewiesen, nach dem update 
klappt (soweit) erstmal alles

Mfg
Marcel :)

Antwort schreiben

Eine eigene Frage? Dieser Thread ist über 23 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.