Forum: Mikrocontroller und Digitale Elektronik Codevision AVR - Funzt nicht richtig


von Marcel (Gast)


Lesenswert?

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

von Oliver (Gast)


Lesenswert?

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.

von Marcel (Gast)


Lesenswert?

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 :)

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.