Witam!!!
Znalazłem w internecie kawałek kodu w PASCALU do odczytu danych z karty chipowej podpiętej bezpośrednio do LPT. Proszę o przetłymaczenie tego kodu na język VisualBasic najlepiej przy użyciu biblioteki inpout32.dll
oto kod:
Z góry bardzo dziękuje
Znalazłem w internecie kawałek kodu w PASCALU do odczytu danych z karty chipowej podpiętej bezpośrednio do LPT. Proszę o przetłymaczenie tego kodu na język VisualBasic najlepiej przy użyciu biblioteki inpout32.dll
oto kod:
program CHIPR;
uses crt;
Procedure VCC(aa : boolean); {power}
Begin
If aa = true Then port[$378] := port[$378] + 1 Else port[$378] := 0;
End;
Procedure RST(aa : boolean); {reset}
Begin
If aa = true Then port[$378] := port[$378] + 8 Else port[$378] := port[$378] - 8;
End;
Procedure CLK(aa : boolean); {clock}
Begin
If aa = true Then port[$378] := port[$378] + 4 Else port[$378] := port[$378] - 4;
End;
Function IO(aa : byte) : byte; {I/O}
Begin
If aa = 0 Then port[$37A] := 255;
If aa = 1 Then port[$37A] := 0;
If aa = 3 Then Begin
If port[$37A] mod 2 = 0 then IO := 1 Else IO := 0;
End;
End;
var
DANEK : array[1..1024] of Byte; {tutaj beda dane z karty}
bit : array[1..8] of byte;
{VCC, RST, CLK, IO : byte;}
i,ii,bajt : integer;
Begin
clrscr;
Writeln('Wcisnij cos aby odczytac !!!');
Readkey;
port[$378] := 0; {wszystkie V na wyjsciach 0.V}
port[$379] := 0;
port[$37A] := 0;
VCC(true); {power ON}
Delay(1);
RST(true);
Delay(1);
CLK(true);
Delay(1);
CLK(false);
Delay(1);
RST(False);
ii :=0;
bajt:=0;
For i := 1 To 128 Do
Begin
Delay(1);
ii := ii+1;
Bit[ii]:=IO(3);
If ii = 8 Then Begin
Bajt :=bajt + 1;
Danek[bajt]:=Bit[1]*1 + Bit[2]*2 +Bit[3]*4 + Bit[4]*8 + Bit[5]*16 + Bit[6]*32 + Bit[7]*64 + Bit[8]*128;
ii:=0;
End;
CLK(True);
Delay(1);
CLK(False);
End;
VCC(false); {power OFF}
port[$378] := 0; {wszystkie V na wyjsciach 0.V}
port[$379] := 0;
port[$37A] := 0;
Writeln;
For i:=1 to 16 do Write(Danek[i],' ');
Writeln;
Writeln('UDAťO SI¨ !!!!!!!');
Readkey;
end.
Z góry bardzo dziękuje