Problem mit Longword?

  • 1
  • 2
  • Seite 1 von 2
dr.boost
 
Avatar
 
Betreff:

Problem mit Longword?

 · 
Gepostet: 11.04.2011 - 10:52 Uhr  ·  #1
Hallo.

Ich habe ein Problem mit der Longword-Variable. Ich möchte sie nutzen um auf 32 einzelne Bits zugreifen zu können. Dazu mache ich folgende Deklaration:
var
lw:longword;
test[@lw,0]:bit; //Das funktioniert noch
...
begin
if bit (test) then //alternativ "if test" oder "if not test"
...
endif;
end. //Erzeugt im Compiler den Fehler "not implemented"

incl(test) bzw. excl(test) funktioniert.

Laut Handbuch sollte die Longword-Variable für Bit-Operationen geeignet sein und scheint ja auch teilweise so zu sein. Ich behelfe mir, indem ich 2 Word-Variablen nehme. Damit funktioniert es problemlos. Ist aber an anderer Stelle im Programm umständlicher zu handhaben. Ich habe auch schon mal probehalber das Longword aus dem System importiert (From system import: Longword;), hat aber auch nicht geholfen. Ich verwende die Professional-Version in der neuesten Release.
Habe ich da einen Denkfehler?
Viele Grüße
O.Kolbe
Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 11.04.2011 - 14:57 Uhr  ·  #2
Is your variable global or not global? Bit() works only with global. Have you tried simple:
Code
if test then
  ..
endif;

or 
Code
if Bit(lw, 0) then // longword only with AvrCo version 4
  ..
endif;

If you have old AvrCo then you can have 4 byte variables or 2 word variables point to longword, and then you can test corresponding bit.
dr.boost
 
Avatar
 
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 11.04.2011 - 15:32 Uhr  ·  #3
Hi Avra.

Yes, it's a global variable. Yes, I tried the simple form (my prefered form). I'm using AVRCo V4, latest release.
mc-electronic
Benutzer
Avatar
Geschlecht: keine Angabe
Herkunft: Sauerland NRW
Beiträge: 372
Dabei seit: 03 / 2008
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 11.04.2011 - 18:20 Uhr  ·  #4
Hi DrBoost,

I tried your sample and various ways of making it work, it didn't. As you say, with Word it works, with LongWord it doesn't.
I think, this could be a little bug in the compiler.

Regards, Michael
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1474
Dabei seit: 03 / 2005
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 11.04.2011 - 19:37 Uhr  ·  #5
I agree - a bug, but here is a work-around:

Code
var
  lw : longword;
  lw1[ @lw ] : word;
  test[ @lw1, 0 ] : bit;


Regards

Merlin.
dr.boost
 
Avatar
 
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 12.04.2011 - 09:10 Uhr  ·  #6
Thanks Merlin.

I will try it this evening.

Regards

Olaf
Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 12.04.2011 - 14:39 Uhr  ·  #7
That is exactly what I said here:
Zitat
If you have old AvrCo then you can have 4 byte variables or 2 word variables point to longword, and then you can test corresponding bit.
mc-electronic
Benutzer
Avatar
Geschlecht: keine Angabe
Herkunft: Sauerland NRW
Beiträge: 372
Dabei seit: 03 / 2008
Betreff:

Re: Problem mit Longword?

 · 
Gepostet: 12.04.2011 - 15:07 Uhr  ·  #8
Hi Avra,

I have the latest version and there it also does not work with longword, just word. I think, this is something for Rolf. So, the matter is not confined to the older 4xx versions.

Cheers, Michael
  • 1
  • 2
  • Seite 1 von 2
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   121   135 · Page-Gen-Time: 0.033218s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI