Reading input to parallel port

Unconnected inputs are much more likley to read high than low; in some logic families it's almost reliable.

Some of the parallel port signals are inverted between their electrical levels on the bits accessable to software.

Reply to
cs_posting
Loading thread data ...

formatting link
formatting link

Reply to
John - kd5yi

Yes. You use a 'pull-down' resistor to gnd, and then a voltage source to overcome that.

Pullups on PC parallel ports can be as small as 1k, so I'd go for a 220 ohm to ground. However, you can measure it easily by attaching a known value resistor r to ground, and then Rpullup = r*(5/vmeasured - 1)

Then, choose a pull-down resistor that pulls it down enough to be seen as a 0 by the port input driver.

--
Regards,
  Bob Monsen

Even the greatest of creations start from small seeds.
- Unknown
Reply to
Bob Monsen

Hi,

I am trying to capture an input with a status pin on the standard IBM parallel port.

I looks like all the status pins are set high default when there's no external voltage source connected. If I measure the voltage drop across pin 13 (status 4) and pin 25 (ground) I get 5,1 V. Shouldn't it be zero?

I am using FreeBSD and if I read the value of the status pins with nothing connected I get Status: 0x7f Nothing happens if I connect a 5 V voltage source to pin 13 and pin 25.

If I short circuit pin 13 and pin 25 I get Status: 0x6f

Isn't it supposed to be the other way around or am I doing something wrong?

Best regards.

Reply to
Peter Andersen

Undriven inputs, will 'float' to levels, depending on the logic family involved. Historically, the TTL inputs used on printer ports, had a small internal current, that drove them high. If you look at the equivalent circuit for the original inputs, they have a resistance of about 4KR, between the input, and the 5v supply rail. Latter chips using CMOS logic, still emulate the original inputs. Note that the connection to pin 11, is inverted, while the other default status inputs are non-inverted, which allows a 'disconnected' status to be detected (this line is called 'Busy/Off Line' for this reason).

Best Wishes

Reply to
Roger Hamlett

I suspect it has something to do with a pull-up resistor inside the port. Is it possible to force the unconnected input-pin to logic 0 and logic 1 when a voltage source is connected (in this case +5V)?

Reply to
Peter Andersen

The status inputs on most IBM parallel ports are TTL (or derivatives thereof) and are active low. This means that an unterminated device input will float to a logical "1" unless specifically brought to a low state by external circuitry. A TTL "1" is a voltage of 2.4V or greater (up to a max of 5V).

Your port and your software are working properly.

--
Dave M
MasonDG44 at comcast dot net  (Just substitute the appropriate characters in 
the address)

Never take a laxative and a sleeping pill at the same time!!
Reply to
DaveM

I

wrong?

The printer port has rather strong pull-up resistors to VCC, so yes, it is correct that you measure 5 V on the inputs and read all ones when left open.

Meindert

Reply to
Meindert Sprang

Printer port input and outputs act like ttl , and the status pins are normally high,because older printers could just use a switch to pull the line to ground(no supply/electronics needed).

Reply to
Sjouke Burry

TTL inputs tend to float high when they are not connected. The newer chips would be made to act like the old TTL chips too. This might explain what you see.

Reply to
Chris Jones

It is working correctly. The inputs have pull-up resistors to 5V. They are designed to be pulled down by open-collector or open-drain outputs e.g.

VCC + | | .-. | | Pull-up | | Resistor '-' | Pin | 13 | |\\ Apply .-----> >------o------| >O- your | |/ 5V | here ___ |/ >----|___|----| NPN |>

10K | | === GND

View in fixed-pitch font. created by Andy´s ASCII-Circuit v1.24.140803 Beta

formatting link

Reply to
Andrew Holme

"Peter Andersen" schreef in bericht news:dla8rp$qin$ snipped-for-privacy@news.net.uni-c.dk...

Guess you'd better enlarge your knowledge about the parallel port interface. One place - amongst others - is:

formatting link
It lacks hardware details. Some more can be found at:
formatting link

Although pin description and register usage are well defined, hardware details of the inner port are not very common. One of the reasons may be that since the times of the first PC manufacturers used a variation of components to implement its funcion. An average printerports hardware was build like this:

- The datalines were TTL-outputs like LS273 or LS374. Some had smal seriesresistors in the outputlines like 22E or 33E (E for Ohm). A capacitor of about 470pF to GND was common although I often saw its space on the board left empty.

- The controllines used open collector outputs like LS06 or LS07. The had pullup resistors of let's say 4k7 and also capacitors to GND.

- The statuslines had LS14 Schmidtriggered inverters for input and low (150E) pullup resistors. Place for capacitors was often available but left empty.

It did not take long before special I/O chips took over the role of the common TTL-components but the function was assumed to remain the same. I did not always fit. I remember a parallelport chip build in CMOS that was blown whenever the PC was switched off before the printer was. Nevertheless a common parallel printerport will still be able to provide (about) the same performance the old things did.

petrus bitbyter

Reply to
petrus bitbyter

Thanks for all the replies. They were all very helpful.

Reply to
Peter Andersen

I

wrong?

No, it's working as expected. The status port is 5 bits, S7 is normally low (inverted), S6, S5, S4, & S3 are all normally high. The open circuited byte in binary would look like 01111111 , or 0x7F. The 3 least significant bits (LSB S0-S2) are not there, they will allways be high. When you grounded Pin

13 (S4) you got 01101111 or, 0x6F. To change bit S7 you need to pull it high to +5V (through a resistor - 10K should do it). To change bits S6-S3 you pull them low (to ground, negative return). Good luck.
Reply to
scada

you're doing it right.the pins are high by default, you need to connect the pins to ground to change their status.

If you want it to be the other way round you can connect them to ground using a 1K resistor and then they'd be low by default and applying +5v would change thier state.

Bye. Jasen

Reply to
Jasen Betts

Actually, that sounds about right - they're pulled up internally, so you have to pull them low to get a 0:

formatting link

Have Fun! Rich

Reply to
Rich Grise

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.