Direct control of parallel port data lines

Polytropon freebsd at edvax.de
Sat Apr 4 18:47:50 UTC 2020


For an "external relay control unit", I need to activate
certain lines of the parallel port. I wish to address
the 8 output lines of the port. How is this done on
FreeBSD?

On DOS (not that DOS, the other one), it was quite simple.
Depending on which parallel port you wanted to address, you
simply needed to put the correct byte to a port whose
address would be assigned to the parallel port you wanted
to address (usually 0x378, 2nd one was 0x3BC, 3rd 0x278).
In ye olde Borland C, you would then do:

	outportb(portnum, databyte);

The "composition" of the databyte was easy: You could
control each of the 8 output lines of the port by
having their corresponding bit set or cleared, so for
example 1 | 2 | 8 | 256 would be bits (and therefore
activated lines) 1, 2, 4, and 8.

The rule was simple: line n -> bit 2^n; And for the
pins of the port: line n -> pin n+1 (D0 - D7).

To each of the 8 lines, a 2 x 7400 + SF123 + relay unit
was attached, and you could then control anything with
the relays. (By cascading, you could get more than 8
output lines.)

All this is a memory artifact from more than 30 years
ago... it needs to be reactivated... ;-)

Because Borland C here of course required "#include <dos.h>",
it doesn't work on FreeBSD.

What's the correct in FreeBSD equivalent here?

If possible, I want to use C for this task. I checked
"man ppc" and "man ppi", but I don't find their content
convincing, probably not what I'm looking for.

What am I _actually_ looking for?



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list