On 2008-03-18, Dave <foo@coo.com> wrote:
> Cydrome Leader wrote:
[ ... ]
>> sure. why not? Parallel is parallel, and can drive a transitor or even
>> better, an optoisolator, then your load.
>
> The issue is how do I program the parallel port to give the outputs I
> want? On a PC running DOS it was only necessary to write a byte of data
> at whatever the IO port for LPT1 or LPT2 were. But on a multi-user
> operating system like Solaris, it is certainly not going to be as easy -
> no non-root user is going to be able to do it and it might not be too
> easy for root to do (I have root access, so whether it needs root or not
> is irrelevant to me, but I have no idea how to write the code to do this).
>
> Anyone know what would be involved to write to the parallel port so I
> can set the outputs to some precise values I want and keep them there
> until I want to change them?
man bpp
man ecpp
Verify which is supported on your system.
and pay particular attention to the IOCTLs documented.
And as long as nothing else has to use that port, chown it to
belong to a process which your program runs as and you won't have to run
it as root.
Note that it will be a symlink to another /devices entry and
that will be the one which you will have to chown. Actually, by
default, mine is crw-rw-rw- so if you only need to access it, and don't
have to worry about others trying to access it and conflict with what
you are doing, you don't need to change anything.
FWWI Mine has /dev/ecpp0 and does not have /dev/bpp0
> My guess is that this will be very difficult to do, but I don't know.
Not that hard, once you learn to use IOCTLs.
> If anyone has any suggestions to how to get some TTL level signals from
> a Sun I would be intersted. The Sun will have a GPIB board in it too,
> but I cant find any cheap GPIB controlled switches.
You could also pick up one of the older serial port chips
(separate I/O buses and status bits) and send characters to it to set
particular bits high or low. If you need a lot of them, use the 8 bits
and decode them into 128 addresses and a bit for "set high" or "set
low".
Enjoy,
DoN.
--
Email: <dnichols@d-and-d.com> | Voice (all times): (703) 938-4564
(too) near Washington D.C. |
http://www.d-and-d.com/dnichols/DoN.html
--- Black Holes are where God is dividing by zero ---