View Single Post

   
  #9 (permalink)  
Old 03-20-2008, 12:41 PM
DoN. Nichols
 
Posts: n/a
Default Re: Control device using TTL level signals

On 2008-03-18, Dave <foo@coo.com> wrote:
> DoN. Nichols wrote:
>
>>> 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.

>
> Thanks for that, although I still cant see how to do this from the ecpp
> man page. There are plenty of structures defined in that man page, but I
> don't see what actually writes the data. Perhaps I am being thick!


I haven't done it (yet) but I suspect that the IOCTLs are used
to set up which pins are input and which are output (except when
connected to a scanner where they get switched to a direction
appropriate for the moment), and then you can just do plain writes to
the port with a mix of bits specifying which pins are to be high and
which to be low, and your program has to remember the status for any
pins which you are not currently changing so it gets written the same as
it was. When you read you probably only get data from the pins which
are defined as inputs, and it either returns only a default value
(perhaps zero, perhaps one) for the pins defined as outputs, or simply
lets you verify the state of the output pins on the read cycles.

> We eventually found on eBay a GPIB controlled relay (actually 6
> reed-relays in a box) so bought a couple of them for $60 the pair. Since
> GPIB is going to be used to set up some test equipment, having a GPIB
> card is not excessive for this.


O.K.

> But I would like to know how to use the parallel port.


Well ... you're going to have to do some work (or perhaps find
some perl libs for the purpose) since we have more than exhausted my own
knowledge of the matter -- mostly going by memories of how the Motorola
6820 chips were used on my earlier systems and applying it to the IOCTLs
which are present in the system. Often, BTW, you'll find a lot more
useful information by reading the header files somewhere in the
/usr/include tree. A quick find run turns up four files to examine:

================================================== ====================
23:17:47 > find /usr/include -name ecpp\* -print
/usr/include/sys/ecppio.h
/usr/include/sys/ecppreg.h
/usr/include/sys/ecppsys.h
/usr/include/sys/ecppvar.h
================================================== ====================

>> 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.

>
> Cheers. Nothing else needs to use it. I'm basically setting up a couple
> of Suns to just run the test equipment.
>
> I just spent 15 minutes trying to understand why I could not read my
> GPIB controlled DVM, only to realise I'd connected the GPIB cable on the
> Sun, but did not connect the other end to the DVM! Once that was sorted
> out, I can read the DVM ok from a simple C program.


:-)

What flavor of GPIB card -- sBus or PCI? I've got three sBus cards, but
can't afford the drivers from National Instruments. They are really in
love with those drivers -- they cost almost as much as the driver plus a
card together from them. :-)

>> 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

>
> Same here - /dev/ecpp0 but no /dev/bpp0
>
> I think I have a recollection that bpp0 is for older machines - I
> suspect my SPARC 20 has that.


I've just checked, and one of my SS-5s running Solaris 2.6 has
that one. The other was on a Sun Blade 1000 -- somewhat newer and
faster. :-)

Enjoy,
DoN.

P.S. I appear to have you killfiled in rec.crafts.metalworking, but
I can't remember why, so I wasn't sure whether to reply or not.
:-)

--
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 ---
Reply With Quote