Re: LPT port, anyone ?
From: Bjørge Sæther (bjorge_at_hahaha_itte.no)
Date: 10/26/04
- Next message: Sven Pran: "Re: LPT port, anyone ?"
- Previous message: Bjørge Sæther: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: LPT port, anyone ?"
- Next in thread: L D Blake: "Re: LPT port, anyone ?"
- Reply:(deleted message) L D Blake: "Re: LPT port, anyone ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 26 Oct 2004 13:50:47 +0200
L D Blake wrote:
> On Tue, 26 Oct 2004 10:34:13 +0200, "Bjørge Sæther"
> <bjorge@hahaha_itte.no> wrote:
>
>>> OK the first thing you have to appreciate is the difference between
>>> an input and an output...
>>
>> I think I know that distinction. Parallell ports of today are
>> bidirectional. This means, you may use them for either in- or output.
>
> Yes you can... but not at the same time. The chip has to be
> *configured* for input or output... and depending on which ECP chip
> you've got in your system sometimes your only choices are ALL inputs
> or ALL outputs.
>
> You're looking at a sequence like this...
>
> Configure chip for output
> Send a string of data
> Configure chip for input
> Read a string of data
It was info on what to do to "configure"he chip that I originally was
missing. Now I've found it (I believe), but I can't make it work.
BTW, I'm not sending anything.
> There actually is a mode switch and several configuration bytes that
> have to be sent to the chip to change the direction of the pins.
I have found this...but there must be something missing...
>> Before bidirectional LPT ports were here, one used to use the output
>> lines for input simply by pulling outputs low "by brute force".
>
> All that would do is damage the chip.
>
> Before bidirectional ports one used to use the output pins to enable
> bits on a device (a switch, a sensor, whatever) and then use the ACK
> Input pin to gather the data one bit at a time.
>
> (ACK is an input pin that strobes low on a printer interface to
> signal "data received"... one can test it for 0 or 1 to gather input
> data)
The more "brave" programmers used the chip the way I described, and it will
normally not harm the chip. The LPT port is relatively high-z outputs, so
short-circuiting them won't mean a lot of current. I've seen 1mA mentioned,
which would represent some 5kohms.
>> Yes. But when I asked this question I wasn't able to read the
>> signals. Now I can, but unfortunately - not the regular data lines
>> (D0..D7).
>
> Because...
>
> 1) You haven't reconfigured the chip for input
This is of course true. The basis of my question, so to speak. But...how do
I do it ?
> 2) You don't have software running to gather and interpret the data
Oh, yes. Right now it works, but not in bidirectional mode.
>>> You will need information about the drivers and it's likely you'll
>>> have to reconfigure the port and access the data using IOControl
>>> commands... In essence you will end up writing a device driver for
>>> your sensors... Not exactly beginner level stuff.
>>
>> I wouldn't characterize me as a 'beginner', after working with
>> electronics for 10 years and programming almost as long. But
>> coupling a PC and electronic equipment is a new field to me.
>
> If you've got 10 years of electronics, how is it you don't know the
> difference between outputs and inputs?
...because there is no red flashing light indicating "input mode" or "output
mode", and all attempts of mine to solve this has failed. If you look
closely, you'll see that I have already identified this problem: I try to
put a signal into a pin that's pulled high by the chip port. I see it on my
oscilloscope.
>> It finally worked, but only in unidirectional mode. This would allow
>> for just some 5 sensors on one port. Also I didn't succeed in
>> getting a sufficient +5V supply from the port. I would need some
>> 1mA, and I guess I'll be dependent on external power.
>
> 5 sensors, with built in logic on 1ma? I doubt that... probably more
> like an Amp.
Data *** says 200uA. I haven't measured.
> What you will need is one of those wall-block power
> supplies and a 7805 regulator to keep the voltage all nice and sane.
> If the sensors are remotely located, you will most likely need one
> power supply for each sensor.
>
> Methinks your best bet is to sit down and rethink this project...
>
> In my world this would involve:
>
> a) an interface card design
> b) A power supply design
> c) parallell port device drivers to interface with the card
> d) custom software to read and interpret the data
>
> But then, with 10 years of electronics and programming, you already
> knew that, didn't you?
;-)
I chose these sensors because they seem extremely flexible and simple in
use. As long as you're not an idiot with LPT programming, like me...;-(.
They work from some 4.5 to 7 Volts, and they are told to work with cables up
to 20m. No interface card needed (a tiny 0u1 capacitor only) as long as you
can live with using parallell- or game port.
I'm gonna use the rest of the LPT lines for relay outputs and possibly fan
control (simple 2-4 bit D/A control), so that I can switch off a unit whose
temperature rises above a certain limit. It's for testing purposes, no RTL
processing system.
-- Regards, Bjørge Sæther bjorge@haha_itte.no ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq.
- Next message: Sven Pran: "Re: LPT port, anyone ?"
- Previous message: Bjørge Sæther: "Re: Try Finally..."
- In reply to:(deleted message) L D Blake: "Re: LPT port, anyone ?"
- Next in thread: L D Blake: "Re: LPT port, anyone ?"
- Reply:(deleted message) L D Blake: "Re: LPT port, anyone ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]