Autor Beitrag
Nickture
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Win 98
D2
BeitragVerfasst: Di 07.10.03 17:22 
Wie Greift Man mit delphi am besten auf ports zu ?? ich muss auf eine analog-digitalwandelnde eingangskarte zugreifen die die hexports
[§0300] - [§0307] vervendet und auf diesen ports muss ich sowohl schreiben als auch lesen wie geht das ?
Ich weis dass man unter dem normalen pascal sie quasi als variable gebrauchen konnte sprich  port[§0300] := 3 blos delphi will das so nicht wer kann mir helfen ?
Adrian
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 314



BeitragVerfasst: Mi 08.10.03 12:30 
Servus!

Vielleicht so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
function InPort (PortAddr: Word): Byte;
{ Funktion, mit der direkt von den Port-Adressen unter Win32 ein Byte
  eingelesen werden kann }

{$IFDEF WIN32}
assemblerstdcall;
asm
  mov dx,PortAddr
  in al,dx
end;
{$ELSE}
begin
  Result:=Port(PortAddr);
end;
{$ENDIF}

procedure OutPort(PortAddr: Word; DataByte: Byte);
{ Prozedur, mit der ein Byte direkt auf eine Port-Adresse unter Win32
  ausgegeben werden kann }

{$IFDEF WIN32}
assemblerstdcall;
asm
  mov al,DataByte
  mov dx,PortAddr
  out dx,al
end;
{$ELSE}
begin
  Port(PortAddr):=DataByte;
end;
{$ENDIF}


Gruß,

Adrian
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 08.10.03 12:51 
Und unter NT ff. System kracht es. Da haben nur Treiber direkten Zugriff auf die Hardware. Ergo ein Treiber muß her. Ist aber nicht mit Delphi möglich. Also besorg die eien Komponente die eine Treiber DLL bereit stellt.
Nickture Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Win 98
D2
BeitragVerfasst: Mi 08.10.03 14:36 
Titel: Ist 98
Es ist aber Win 98 daher währe das egal wenn NT und folgende das nicht könnten .
Nochmal Zu der portbenennung in dem beitrag von adrian müsste der aufruf um vom port [$0300] zu lesen dann heißen
ausblenden Delphi-Quelltext
1:
a := Inport($0300)					

?
Adrian
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 314



BeitragVerfasst: Mi 08.10.03 15:24 
Servus!

Exakt.
ausblenden Delphi-Quelltext
1:
a:=InPort($300);					


Reicht aber auch.

@Luckie: Stimmt. Da Nickture aber nur Win98 im Profil stahen hat, gehe ich davon aus, daß er damit arbeiten will.

Gruß,

Adrian
Nickture Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Win 98
D2
BeitragVerfasst: Do 09.10.03 16:22 
Titel: Danke
Jupp funzt wunderbar Danke ihr beiden