Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Operator not applicable to this operand type (https://www.delphipraxis.net/12717-operator-not-applicable-operand-type.html)

flomei 3. Dez 2003 01:23


Operator not applicable to this operand type
 
Hallo!
Ich habe versucht einen C# (:kotz:) Quelltext nach Delphi zu portieren. Es scheint mir auch fast gelungen zu sein.
Doch ein Problem besteht.
Folgendes: Ich lese Daten über den LPT Port ein und vergleiche diese dann um so ganz ganz am Ende eine Temperatur zu erhalten (wenn es denn geht was ich da geschrieben habe... :roll:).

Ich erhalte aber immer die Fehlermeldung:
Zitat:

Operator not applicable to this operand type
bei folgendem Code Ausschnitt:
Delphi-Quellcode:
    if PortIn($379) AND $64 = $64 then byteW := 128;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 64;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 32;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 16;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 8;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 4;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 2;

    PortOut($37a, 1);
    PortOut($37a, 0);

    if PortIn($379) AND $64 = $64 then byteW := byteW + 1;

    PortOut($37a, 1);
Bei allen Vergleichen erhalte ich diese Fehlermeldung. Wo liegt der Fehler? Habe schon in der OH geguckt aber weitergeholfen hat mir das nicht wirklich...

Danke im Vorraus!

MfG Florian :xmas:

Hansa 3. Dez 2003 01:33

Re: Operator not applicable to this operand type
 
Dann liegt der Fehler doch hier:

Delphi-Quellcode:
if PortIn($379) AND $64 = $64 then
Denn ansonsten ist der Code identisch und du setzt den anderen Kram anhand dieser Bedingung. Nun meine Fragen: Warum machst Du das in C# und fragst hier ? Woher kommen diese Port Adressen ? Welche Temperatur und welches Gerät soll benutzt werden ?

Last but not least: warum läßt Du $64=$64 nicht einfach weg ? Das gibt immer true. :mrgreen:

flomei 3. Dez 2003 01:37

Re: Operator not applicable to this operand type
 
Nein. Das hast du jetzt falsch verstanden!
Ich habe hier C# Quelltext den ich versuche zu übersetzen.
Die Portadressen stammen vom Einlesen der Daten eines IC´s.
Welche Temperatur? Das will ich ja gerade wissen...
Gerät? :roll: Verstehe nicht was du mit Gerät meinst. Der IC ist ein LM75 mit integriertem AD Wandler...

MfG Florian :hi:

P.S.: Immer true wäre sehr schlecht! ;)

Leuselator 3. Dez 2003 01:48

Re: Operator not applicable to this operand type
 
Klammer mal den Spass dann sollte es funzen :-)
Code:
if [color=red][b](([/b][/color]PortIn($379) AND $64[color=red][b])[/b][/color] = $64[color=red][b])[/b][/color] then
// ^^^^^^<--- wenn das 'ne Funktion ist , die 'nen Byte zurückgibt

flomei 3. Dez 2003 02:02

Re: Operator not applicable to this operand type
 
Geht immer noch nicht. Was kann das denn noch sein?

MfG Florian :hi:

Hansa 3. Dez 2003 02:20

Re: Operator not applicable to this operand type
 
Zitat:

Zitat von Leuselator
Klammer mal den Spass dann sollte es funzen :-)

Wie denn ? :shock: AND übersehen ??


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz