Forum: Mikrocontroller und Digitale Elektronik Variablen in einem Tiny unter Bascom


von Karsten (Gast)


Lesenswert?

Nach mehreren Projekten mit ATMega's will mich jetzt an die kleinen
tiny's ran. Da ja diese keinen SRam haben, nun mein Problem:

Ich brauch 2 Byte Variablen. Wie kann ich diese im Bascom
implementieren?

von Andi (Gast)


Lesenswert?

Keine Ahnung.
Aber nimm doch einfach den Tiny13, der hat 128Byte SRAM und sogar ADC
wenn erwünscht.

Gruß
Andi

von Karsten (Gast)


Lesenswert?

Ich habe da was in der Hilfe gefunden:

$Tiny

Hat da jemand mit Erfahrung?

von Christian (Gast)


Lesenswert?

ja, ich hab das schonmal versucht mit dem $tiny und es hat nicht
funktioniert... in den Samples von Bascom ist allerdings für den 1200er
auch das $tiny verwendet... funktioniert bei mir leider genausowenig!

von Rufus T. Firefly (Gast)


Lesenswert?

Bascom verwendet doch für den Datentyp integer sowieso
zwei-Byte-Variablen, wo ist da das Problem?

von Christian (Gast)


Lesenswert?

das Problem ist, dass Bascom die Variablen in den SRam speicher, wobei
die meißten Tinys keinen SRam haben... also muss man Bascom sagen, dass
es sich um einen Tiny handelt, damit es die Variablen anders speichert!

von Rufus T. Firefly (Gast)


Lesenswert?

Aus der Bascom (1.11.7.3)-Dokumentation:
(auf das unten angehängte Beispiel achten)


$Tiny

Instruct the compiler to generate initialize code without setting up
the stacks.

Remarks

The tiny11 for example is a powerful chip. It only does not have SRAM.
BASCOM depends on SRAM for the hardware stack and software stack.

When you like to program in ASM you can use BASCOM with the $TINY
directive.

Some BASCOM statements will also already work but the biggest part will
not work.

BASCOM will support a subset of the BASCOM statements and function to
be used with the chips without SRAM. There will be a special tiny.lib
that will use little registers and will have at most a 3 level deep
call since tiny chips do have a 3 level deep hardware stack that may be
used for calls.

Note that the generated code is not yet optimized for the tiny parts.
The $tiny directive is just a start of the tiny parts implementation!

No support is available for this feature until the tiny.lib is
implemented.




  $tiny
  dim X AS iram BYTE, y AS iram BYTE
  X = 1 : Y = 2 : X = x + y


Zitat aus einer Mail aus der Bascom-Mailingliste:

  You can do some things with tiny's with bascom.
  1) You need a $tiny directive.
  2) Only byte operations are supported - no words, longs or singles.
  3) Calls/gosubs only 3 deep - hardware stack.
  4) Only single maths operations per line.
  5) Not all the comands will work, some conditional branches
     (if/then) don't work as expected.

von Christian (Gast)


Lesenswert?

ja, das obige aus der Bascom Hilfe kenn ich schon... hab auch alles so
angewendet!

Bei dem Zitat kommt mir der Punkt 5 seltsam vor... wie soll ich
Überprüfungen auf nen bestimmten Wert meiner Byte-Variablen machen,
wenn nicht mit if???

von Andi (Gast)


Lesenswert?

Gibt es vielleicht "Select Case" in BASCOM?

Gruß
Andi

PS: Keine Ahnung von BASCOM, nur allgemeine Kenntnisse in Basic, also
bitte nicht hauen!

von Raimond (Gast)


Lesenswert?

@Andy

Ja, "Select Case" gibt es.

von Andi (Gast)


Lesenswert?

OK, dann kann man vielleicht damit mit einem Tiny Vergleiche
durchführen?

Gruß
Andi

von Christian (Gast)


Lesenswert?

mhh... wäre ne Idee... Ich würde es zwar ne verstehen warum das geht und
if nicht, aber ich werds mal probieren, wenn ich wieder aus dem Urlaub
da bin!

Ich glaube, das wird jetzt erstmal der letzte Post sein, eh ich in den
Winterurlaub starte!
Erstmal danke für eure 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.