does someone know how to read parallel data from the parallel port (LPT)?
I was told that there is a way to do so.
The purpose is simulating a parallel printer to read data from a medical
device that only supports printer output.
Thank you very much (in advance),
Hanjo
--------------------------------------------------------------------------------
__ __ _________ Hansjoerg Toepfer Tel.: +49-203-3792583
/ / / / /__ ___/ University of Duisburg FAX : +49-203-370439
/ /_/ / / / FB 9 / DV (Data Processing)
/ __ / / / Bismarckstr. 81
/ / / / / / D-4100 Duisburg 1, Germany
/_/ /_/ /_/ e-mail: toe...@du9ds4.fb9dv.uni-duisburg.de
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
__ __ _________ Hansjoerg Toepfer Tel.: +49-203-3792583
/ / / / /__ ___/ University of Duisburg FAX : +49-203-370439
/ /_/ / / / FB 9 / DV (Data Processing)
You won't be able to read it using an LPT port, directly. The LPT port
has less than 8 input bits, and therefore can't read a byte at a time,
which is how the medical device will be sending it to the printer.
You might be able to hack together some kind of cable to read and handshake
the data using a pair of LPT ports, but this would be highly non-standard,
to put it mildly. The better alternative would be to get a parallel
to serial converter widget, and read the data on a COM: port.
Email me if you need more detailed explanation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rod Nussbaumer, Programmer/Technologist Bitnet: BOMR@TRIUMFER
TRIUMF --- University of British Columbia, Internet: bo...@erich.triumf.ca
Vancouver, BC, Canada. Phone: (604)222-1047 ext 510
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>In article <toepfer.729527935@du9ds4>, toe...@du9ds4.fb9dv.uni-duisburg.de (Hansjoerg Toepfer) writes...
>>
>>Hello,
>>
>>does someone know how to read parallel data from the parallel port (LPT)?
>>I was told that there is a way to do so.
>>The purpose is simulating a parallel printer to read data from a medical
>>device that only supports printer output.
>You won't be able to read it using an LPT port, directly. The LPT port
>has less than 8 input bits, and therefore can't read a byte at a time,
>which is how the medical device will be sending it to the printer.
>You might be able to hack together some kind of cable to read and handshake
>the data using a pair of LPT ports, but this would be highly non-standard,
>to put it mildly. The better alternative would be to get a parallel
>to serial converter widget, and read the data on a COM: port.
>Email me if you need more detailed explanation.
Beg pardon, but any PC parallel port including the original IBM brand
port works just fine as an input device by simply applying the data
to the data bits and reading the port.
Here is a message I sent to someone who asked via email awhile back.
It shows how to do it.
John
> I noticed that you have some experience with directly controlling the
>parallel ports and wondered if you could give me some advice. My project is to
>control an ADC and a high-speed UART through a laptop's parallel port. I need
>to write and read bytes through this port and plan to get around the 5-input
>limit by address-selecting one nibble at a time using a '244 dual-quad-buffer.
>My problem is that I can only get the biosprint() functions to work (but they
>won't let me access the control pins) and the outportb() functions don't seem
>to work at all with 0x3bc-0x3be. I've even tried to disable() interrupts but
>with no success. All of my references say this should work, and without being
>able to manipulate the control pins for address-decoding functions, my project
>becomes quite a bit more complicated. Any suggestions?
Yep. Forget about trying to use the control pins. Simply put your data
on the data pins and read the BASE port. It is poorly documented
that the port is bi-directional because the original input circuitry
was for diagnoistic purposes. Your data source must be capable of
sinking an LS394's output but that's no problem because this chip
sources very little current is not harmed in the least by being pulled
down.
The easiest way to do the interface AND protect your port is to hook
opto-isolators up so the output transistor sinks the bit to ground
and your input fires the LED. The LS394 provides enough pullup so
nothing else is needed.
The procedure is to write a 1 to whatever bits you want to read from
and then read from the port. Writing a 1 brings the input up so it
can be sunk low by your driving device. Just write out an 0xFF to
bring 'em all high. If you need this to be interrupt driven, simply
derive a "data ready" signal from your hardware and connect it to the
*ACK line. Be aware that many boards do not latch this line so you'll
have to assert the line until your routine reads it. You can use the
*STROBE line to send an ack to your hardware. I wouldn't mess with
interrupt driven if you need any speed at all. Polling is a LOT
faster.
There are several pieces of code I've written you need to make experimenting
easier. One is port11. This is an interactive program that allows you
to read and write any arbitrary port, toggle bits while monitoring
the port in real time and a bunch of other stuff. It is on simtel or you
can get it from my mail file server here. The second piece of code is
lp which is a driver for a parallel port that looks like a bios function
except that it is implemented as function calls instead of interrupts.
I wrote these for an 80186-based network printer adaptor product my
company used to sell.
Lastly, you need fit, the driver software for the automotive fuel
injection tester featured in the first edition of my magazine. This
program fires injectors and reads a flow meter using various bits
on the parallel port. Wait a few days to get FIT because I'm about to
make a new version available. lp and FIT are only available from
my file server at the moment.
To access the file server, send mail to list...@dixie.com. In the
body of the message include the following:
index
get fit.zip
get lp.zoo
get port11.zip
All these come with Borland C source, of course.
BTW, there are a lot of "experts" that will tell you old parallel
ports are not bi-directional. Bullsh*t. The original IBM brand parallel
port I have here works just fine. If any parallel port is truly pc
compatable, it will run bi-directional with absolutely NO problems.
John
--
John De Armond, WD4OQC |Interested in high performance mobility?
Performance Engineering Magazine(TM) | Interested in high tech and computers?
Marietta, Ga | Send ur snail-mail address to
j...@dixie.com | per...@dixie.com for a free sample mag
Need Usenet public Access in Atlanta? Write Me for info on Dixie.com.