Parallel Port I/O Using Delphi V 6.0
(With thanks to Ken Hopkins for the techniques ...)
|
NOTE: Delphi 6 Personal may be downloaded from: http://www.borland.com/delphi/tryitnow.html |
STEP 1 Copy Fred
Bulback's io.dll into the default Project
Folder.
See: http://geekhideout.com/downloads/io.dll
STEP 2 Create a Form with eight buttons for the Output Lines (D0 to D7), one button to turn all lines off, one button to read Input and a Label to display the value read at the Input lines.

STEP 3 Insert the following lines of code into the Unit script...
| procedure PortOut(Port : Word; Data : Byte);
stdcall; external 'io.dll'; function PortIn(Port:Word):Byte; stdcall; external 'io.dll'; |
STEP 4 Enter code for each of the Output buttons as below ...
| procedure TForm1.Button1Click(Sender:
TObject); begin PortOut(888,1); end; |
STEP 5 Enter code for the Input button as below ...
| procedure TForm1.Button3Click(Sender:
TObject); var InValue : Byte; begin InValue := PortIn(889); label1.Caption := IntToStr(InValue); { Converts InValue from Type Byte to Type String.} end; |
The full code is here if you want to download it.
|
NOTE: On some systems the addresses are: 956 and 957 rather than 888 and 889. |
STEP 6 Attach an interface, or launch Fred Bulback's "parmon.exe" and Run your program ...
