Uses linux, ports;
// Program based on:
http://www.linuxdoc.org/HOWTO/mini/IO-Port-Programming-9.html
Const
BASEPORT = $0378; // Normally it is LPT1
begin
// Get access to the ports: $0378..$037A
if not (ioperm(BASEPORT, 3, 1)) then Halt(1);
// Set the data signals (D0-7) of the port to all low (0)
Port[$378] := 0;
// Read the port of data. It must read the previous value, in this case
a zero.
Writeln(Port[$378]);
// We don't need the ports anymore.
if not (ioperm(BASEPORT, 3, 0)) then Halt(1);
// Important note:
// Bit 5 of the control port ($37A) selects the direction (In or Out) of
the port of data.
end."Under LINUX, your program must be run as root, or the IOPerm call..." In the documentation it must go "and" instead of "or".
|-----------------------------|
| Luis R. Hilario |
| http://www.luisdigital.2y.net |
|-----------------------------|
