Forum: Mikrocontroller und Digitale Elektronik Format-Fehler bei Bascom LCD-Ausgabe??


von Helmut Hofmann (Gast)


Lesenswert?

Hallo Bascomanhänger,

kann es sein, daß bei Benutzung von "Format" ein Fehler bei Bascom
vorliegt?
Ich will die Werte eines Zählers von 1-255 auf Display mit führenden
Nullen ausgeben (also: 001-255). Dafür soll in Bascom Format geeignet
sein.
Mein folgendes (Teil-)Programm :

Dim A As Byte
Dim B As String * 3

B = Format(a , "000")
Lcd B
End

zeigt aber folgenden Fehler:

error:242 line:4 Source variable does not match the target variable
(2), in File:.....Noname2.bas

Kann mir da jemand helfen? oder liegt wirklich ein Bug vor



Gruß Helmut

von andré (Gast)


Lesenswert?

"
target = Format(source, "mask")


Remarks

target  The string that is assigned with the formatted string.
source  The source string that holds the number.
"

Dein Source ist aber kein String, sondern ein byte :)

von andré (Gast)


Lesenswert?

Wir wollen ja keinen dumm sterben lassen :)

Dim A As Byte
Dim B As String * 3

B = Format(str(a) , "000")
Lcd B
End

mfg

von Helmut Hofmann (Gast)


Lesenswert?

danke andre
für die rasche Hilfe

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.