Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Another life of the LPT port. Part 1. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Computers

Comments on the article Comments on the article

I did not expect that my first article (azbukavb.narod.ru/teorie/LPT.htm) would arouse such interest among programmers and electronics engineers, because I received a lot of letters with questions and continue to receive them to this day, although it has been almost three years since the article was written. In addition, a number of inaccuracies were made in the first article. All this prompted me to write a more detailed article on this topic, in which I will try to answer most of the questions of dear readers and correct those inaccuracies that were made in the first article. Let the readers of the first article not take offense at me, but we will again consider in detail each contact and bit of our LPT port. In the first part of the article, the theory will be considered, in the second and subsequent (if any) we will consider electronic devices that can be "picked up" to this port.

Ø In the text you will meet the generally accepted abbreviation for writing numbers.

o For example, 10102 - two in the subscript indicates that the number 5 represented in binary,

Ø 12410 - ten in the subscript, indicates that the number 124 decimal.

It's like that...just in case

As practice has shown, all programs correctly written and supplemented with the appropriate libraries (vbio32.dll, inpout32.dll, dlportio.dll, etc.) work on most computers with operating systems of the Windows family. I tested all my programs (Visual Basic5.0, 6.0) on Win95, 98, Me, 2000, XP HE, XP Prof and even DOS6.22 (QBasic) - everything works fine. In DOS, no libraries are needed at all, everything works there anyway. Immediately make a reservation that vbio32.dll and inpout32.dll WILL NOT WORK UNDER Win2000, but they will work quite calmly under Win95, 98, Me.

By the way, you can take any of these libraries at sano2000.narod.ru/index.html. I wanted to try dlportio.dll and am currently working with this library. And finally, before writing programs, you must correctly declare the library you are using.

Ø For inpout32.dll

Private Declare Function Inp Lib "inpout32.dll" Alias ​​"Inp32" (ByVal PortAddress As Integer) As Integer

Private Declare Sub Out Lib "inpout32.dll" Alias ​​"Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

Ø For dlportio.dll

Private Declare Function DlPortReadPortUchar Lib "dlportio.dll" (ByVal Port As Long) As Byte

Private Declare Sub DlPortWritePortUchar Lib "dlportio.dll" (ByVal Port As Long, ByVal Value As Byte)

What is the difference Private from Public I will not write.

The parallel port for communicating with a printer (or other device) has a base address of &H378 (LPT1), &H278 (LPT2), &H3BC (LPT3). In this article, we will consider only LPT1. The address space for this port is in the range &H378-&H37F.

· Address &H378 called basic and serves to write (read, but more on that later) data to the port, on the D0-D7 line.

· Address &H379 (basic+1) designed to read status bits from a device connected to the LPT port (printer, scanner, etc.)

· Address &H37A (basic+2) is used to write the control bits of the device connected to the LPT port (printer, scanner, etc.).

In the tables below, the contacts and signals of each of the addresses are "decoded"

Another life of LPT port

Another life of LPT port

Another life of LPT port

Contacts 18-25 - "ground" (common, GND,GROUND, etc.)

Consider programming each of the addresses.

· Base address &H378(LPT1) allows you to write data to a port on the line D0-D7 in the range from 0 to 255.

· We write the number 69 to the port
The code is next. For those who use
inpout32.dll dlportio.dll DOS
Out&H378, 69 DlPortWritePortUchar &H378, 69 OUT&H378, 69

*************************************************** *************************************************** *****

· Address &H379 is used to read status bits.

· Read the state of the port at address &H379

Ø  When reading address &H379 it must be remembered that the first three bits are not used and always have a log value. "1", and the 7th bit is inverted. As a result, if all pins 15, 13, 12, 10, 11 are grounded, then when reading information, you will get 1 + 2 + 4 on the first three bits (which are not used) and on the 7th bit (pin 11- inverse, which means that when a ground fault occurs, there will be a log. "1") +128 total 135. We should not forget about this. In the second part of the article, we will dwell on this in more detail.
The code is next. For those who use
inpout32.dll dlportio.dll DOS
Dim A as Integer A = Inp(&H379) Dim A as Integer DlPortReadPortUchar(&H379) DEFINT A-ZA=INP(&H379)

*************************************************** *************************************************** *****

· Address &H37A is used to write control bits.

· Recording the signalSTROBE (control bit 0)
The code is next. For those who use
inpout32.dll dlportio.dll DOS
Out&H37A, 10 DlPortWritePortUchar &H37A, 10 OUT&H37A, 10

Why 10? Let's look at the table.
(-StrOBE) 20 (-AUTO) 21 (INIT) 22 (-SELECT IN) 23 (Signals) bits
Pin 1 Pin 14 Pin 16 Pin 17  
0 1 0 1 01012
0 2 0 8 0+2+0+8=10

signals STROBE, CAR, SELECT IN - inverse, which means that in order to get a logical "1" at the output of connector pins 14, 17, 1, you need to apply a logical "0" to these bits, i.e. Give one thing, get the opposite. Signal INIT direct (not inverse), so the logical "1" on pin 16 will appear when we apply a logical "1" to this bit, i.e. what is given is what is received.

Let's try to get on pins 1,17 - a low level of the signal "0", and on pins 14 and 16 a high level of the signal "1", i.e. at the output of contacts 1,14,16,17 there will be 0 1 1 0 (610).

On the null bit(-STROBE) we give "1" (on contact 1 there will be "0"), on first bit(-CAR) we give "0" (on contact 14 there will be "1"), on second bit(INIT) we give "1" (on contact 1 there will be "1") and, finally, on third bit(-SELECT IN) we give "1" (on contact 17 there will be "0"), i.e. we wrote down the number 37 at &H1011A2, is 1310. So, in order to get 6 at the output, you need to apply 13.

For convenience, I give a table with all possible combinations of numbers from 0 to 15

Applied signal Received signal
Decimal (-StrOBE) 20 (-AUTO) 21 (INIT) 22 (-SELECT IN) 23 contact 1 contact 14 contact 16 contact 17 Decimal
  1 2 4 8 1 2 4 8  
0 0 0 0 0 1 1 0 1 11
1 1 0 0 0 0 1 0 1 10
2 0 1 0 0 1 0 0 1 9
3 1 1 0 0 0 0 0 1 8
4 0 0 1 0 1 1 1 1 15
5 1 0 1 0 0 1 1 1 14
6 0 1 1 0 1 0 1 1 13
7 1 1 1 0 0 0 1 1 12
8 0 0 0 1 1 1 0 0 3
9 1 0 0 1 0 1 0 0 2
10 0 1 0 1 1 0 0 0 1
11 1 1 0 1 0 0 0 0 0
12 0 0 1 1 1 1 1 0 7
13 1 0 1 1 0 1 1 0 6
14 0 1 1 1 1 0 1 0 5
15 1 1 1 1 0 0 1 0 4

And finally, the last part of this article. If your computer supports the EPP standard, then the fourth bit at the address &H37A you will be able to enable an interrupt (for LPT1 it is IRQ7) from the printer, just don't ask me what it is, I don't know anything about interrupts anyway. But the fifth bit is 1101012, for example, giving the number 4310, you set the D0-D7 bus to RECEPTION data. In this case, all digits (contacts 2-9) take the value of logical "1". To apply a logical "0" to the desired contact, it is necessary to close it through a resistance of 240 - 360 Ohms to the "ground". Thus, through the LPT port of the computer, we get a standard device with 12 output signals and 5 input signals, and when the port is switched to EPP mode, we get 4 output signals and 13 input signals.

Mode SPP (12 outputs and 5 inputs)   Mode EPP (4 inputs and 13 outputs)
Signal Direction   Signal Direction
D0 Log out   D0 Sign In
D1 Log out   D1 Sign In
D2 Log out   D2 Sign In
D3 Log out   D3 Sign In
D4 Log out   D4 Sign In
D5 Log out   D5 Sign In
D6 Log out   D6 Sign In
D7 Log out   D7 Sign In
ERROR Sign In   ERROR Sign In
SELECT Sign In   SELECT Sign In
PAPER END Sign In   PAPER END Sign In
ACK Sign In   ACK Sign In
-BUSY Sign In   -BUSY Sign In
-strOBE Log out   -strOBE Log out
-CAR Log out   -CAR Log out
INIT Log out   INIT Log out
-SELECT IN Log out   -SELECT IN Log out

Author: Alexey Klyushnikov, Ivanovo; Publication: cxem.net

See other articles Section Computers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Artificial leather for touch emulation 15.04.2024

In a modern technology world where distance is becoming increasingly commonplace, maintaining connection and a sense of closeness is important. Recent developments in artificial skin by German scientists from Saarland University represent a new era in virtual interactions. German researchers from Saarland University have developed ultra-thin films that can transmit the sensation of touch over a distance. This cutting-edge technology provides new opportunities for virtual communication, especially for those who find themselves far from their loved ones. The ultra-thin films developed by the researchers, just 50 micrometers thick, can be integrated into textiles and worn like a second skin. These films act as sensors that recognize tactile signals from mom or dad, and as actuators that transmit these movements to the baby. Parents' touch to the fabric activates sensors that react to pressure and deform the ultra-thin film. This ... >>

Petgugu Global cat litter 15.04.2024

Taking care of pets can often be a challenge, especially when it comes to keeping your home clean. A new interesting solution from the Petgugu Global startup has been presented, which will make life easier for cat owners and help them keep their home perfectly clean and tidy. Startup Petgugu Global has unveiled a unique cat toilet that can automatically flush feces, keeping your home clean and fresh. This innovative device is equipped with various smart sensors that monitor your pet's toilet activity and activate to automatically clean after use. The device connects to the sewer system and ensures efficient waste removal without the need for intervention from the owner. Additionally, the toilet has a large flushable storage capacity, making it ideal for multi-cat households. The Petgugu cat litter bowl is designed for use with water-soluble litters and offers a range of additional ... >>

The attractiveness of caring men 14.04.2024

The stereotype that women prefer "bad boys" has long been widespread. However, recent research conducted by British scientists from Monash University offers a new perspective on this issue. They looked at how women responded to men's emotional responsibility and willingness to help others. The study's findings could change our understanding of what makes men attractive to women. A study conducted by scientists from Monash University leads to new findings about men's attractiveness to women. In the experiment, women were shown photographs of men with brief stories about their behavior in various situations, including their reaction to an encounter with a homeless person. Some of the men ignored the homeless man, while others helped him, such as buying him food. A study found that men who showed empathy and kindness were more attractive to women compared to men who showed empathy and kindness. ... >>

Random news from the Archive

Cause of scars revealed 08.12.2019

Scars at the site of wounds are formed by connective tissue - when the wound heals, fibroblast cells come into it and fill it with connective tissue proteins - collagen, etc. They help stop bleeding, keep infection out of the wound and perform a number of other useful functions, without which the wound could not live normally. But where the “scarring” cells themselves come from has not yet been completely clear. This could be recognized by the activity of genes in fibroblasts, and judging by the genetic activity, "scarring" fibroblasts come to the wound either from the skin or from the fascia.

Fascia are called connective tissue membranes that cover organs, vessels, nerves and form original cases for muscles - these cases support and nourish them. And, as it turned out, fibroblasts come from the fascia into the wounds. Researchers at the Helmholtz Center in Munich used a range of methods to find out which connective tissue cells form the scar.

In particular, a program of cell suicide was launched in different groups of cells, and when the fascia fibroblasts were destroyed in this way, the wound did not heal for a long time or a bad scar formed in it - because the skin fibroblasts, if they participated in this, could not do all the necessary work. In other experiments, a special film was implanted under the skin of the experimental animals, which did not let the cells rising from the fascia in the depths of the body pass - and again, the wounds on top of this film remained non-healing.

The fasciae have special groups of fibroblasts that sit next to each other and around which there is already a ready-made intercellular matrix of connective tissue proteins for wound healing. And if earlier it was believed that connective tissue is made from scratch by fibroblasts that came to the wound, now it has become clear that everything is going a little differently: many cellular-molecular "patches" come into the wound at once - micropieces of the scar, which gradually fold into a large scar.

Now it remains to be seen what signals control these "scar detachments" that sit in the fasciae. It is known that scarring is sometimes too active, so that the connective tissue begins to crowd other tissues so much that it begins to harm. If we know what the appearance of scars depends on - and with the data obtained we will know this more precisely - then it will be possible to effectively prevent the pathological growth of connective tissue.

Other interesting news:

▪ Aluminum batteries are better than lithium-ion

▪ Digital multimeter with Bluetooth and NFC

▪ New Zealand launches first space rocket

▪ Fog windshield

▪ Noise vs Noise

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Calls and audio simulators. Article selection

▪ article Art and culture. Crosswordist's Handbook

▪ article What is Cerebral Palsy? Detailed answer

▪ article Decrees, letters, orders, instructions on labor protection. Directory

▪ article Powders for washing. Simple recipes and tips

▪ article Voltage level deviation LED indicator. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024