Paralllel port (db25) comnector

Source: Internet
Author: User

Something about parallel interfaces.

 

This is about paralllel port (db25) comnector.

 

Introduction

Hi there, I was searching the web for a way to allow me to control electrical appliances using PC and I found it here. here is a circuit (figure 1) for using the printer port of a PC, for control application using software and some interface hardware. the interface circuit along with the given software can be used with the printer port of any PC for controlling up to eight equipments.

The interface circuit shown in Figure 1 is drawn for only one device, being controlled by D0 bit at pin 2 of the 25-pin parallel port. identical circuits for the remaining data bits D1 through D7 (available at pins 3 through 9) have to be similarly wired. the use of opto-coupler ensures complete isolation of the PC from the relay driver circuitry.

 

 

 

Background

Parallel port is a simple and inexpensive tool for building computer controlled devices and projects. the simplicity and accuracy of programming makes parallel port popular in electronics hobbyist world. the parallel port is often used in computer controlled robots, Atmel/PIC programmers, Home Automation ,... etc... here is a simple tutorial on parallel port interfacing and programming, with some examples.

Everybody knows what is parallel port, where it can be found, and for what it is being used. the primary use of parallel port is to connect printers to the computer and is specifically designed for this purpose. thus it is often called as printer port or centronics port (this name came from a popular printer manufacturing company 'centronics 'which devised some standards for parallel port ). you can see the parallel port connector in the rear panel of your PC. it is a 25 pin female (db25) connector (to which printer is connected ). on almost all the PCs only one parallel port is present, but you can add more by buying and inserting ISA/PCI parallel port cards.

 

 

Parallel Port Modes

The IEEE 1284 standard which has been published in 1994 defines five modes of data transfer for parallel port. They are:

  1. Compatibility mode
  2. Nibble Mode
  3. Byte mode
  4. EPP
  5. ECP
Hardware

The pin outs of db25 connector is shown in the picture below:

 

 

 

The lines in db25 connector are divided into three groups, they are:

  1. Data lines (Data Bus)
  2. Control lines
  3. Status lines

As the name refers, data is transferred over data lines. control lines are used to control the peripheral, and of course, the peripheral returns status signals back to the computer through status lines. these lines are connected to data, control and status registers internally. the details of parallel port signal lines are given below:

Pin no (db25) Signal name Direction Register-bit Inverted
1 Nstrobe Out Control-0 Yes
2 Data0 In/out Data-0 No
3 Data1 In/out Data-1 No
4 Data2 In/out Data-2 No
5 Data3 In/out Data-3 No
6 Data4 In/out Data-4 No
7 Data5 In/out Data-5 No
8 Data6 In/out Data-6 No
9 Data7 In/out Data-7 No
10 Nack In Status-6 No
11 Busy In Status-7 Yes
12 Paper-out In Status-5 No
13 Select In Status-4 No
14 Linefeed Out Control-1 Yes
15 Nerror In Status-3 No
16 Ninitialize Out Control-2 No
17 Nselect-printer Out Control-3 Yes
18-25 Ground - - -
Parallel Port registers

As you know, the data, control and status lines are connected to there corresponding registers inside the computer. so, by manipulating these registers in program, one can easily read or write to parallel port with programming versions like 'C' and basic.

The registers found in a standard parallel port are:

  1. Data Register
  2. Status Register
  3. Control Register

As their names specify, data register is connected to data lines, control register is connected to control lines and Status Register is connected to status lines. (here the word connection does not mean that there is some physical connection between data/control/status lines. the registers are already ally connected to the corresponding lines .) so, whatever you write to these registers will appear in the corresponding lines as voltages. of course, you can measure it with a multimeter. and whatever you give to parallel port as voltages can be read from these registers (with some restrictions ). for example, if we write '1' to data register, the line data0 will be driven to + 5 V. just like this, we can programmatically turn on and off any of the data lines and control lines.

Where these registers are?

In an ibm pc, these registers are Io mapped and will have an unique address. we have to find these addresses to work with the parallel port. for a typical PC, the base address of LPT1 is 0x378 and of lpt2 is 0x278. the data register resides at this base address, Status Register at base address + 1 and the control register is at base address + 2. so, once we have the base address, we can calculate the address of each register in this manner. the table below shows the register addresses of LPT1 and lpt2.

Register LPT1 Lpt2
Data Register (baseaddress + 0) Zero X 378 Zero X 278
Status Register (baseaddress + 1) Zero x 379 Zero x 279
Control Register (baseaddress + 2) 0x37a 0x27a

 

 

 

 

 

// ------------------------------ May.07.. 2009 ------------------------------
// -------------------- Masturbate by sealplusplus ---------------------
// ---------- World is shit .. General George Smith Patton said ----

The parallel port has five standard modes.
Specifically, it is a parallel port, with a tight relationship between the inside and the line. Because it is a data transmission and control operation. There are three types of cables.
1: Data Cable.
2: control line.
3: Status line.

Because it is a parallel port, 8 bits can be transferred at a time. 8 and data cable.
Control Line 4 and status line 4.

Online voltage (+/-) and register status (1/0 ). Register does not know whether it is the ax/BX/CX/dx of the CPU or the memory area of the program. There is no difference in actual programming. It is nothing more than about register and variables, however, the online voltage is not in real-time connection with the register status. It has something to do with programming, because if the status changes after several CPU times, you only need to access the variable, but if it is not real-time, you can also use functions or other methods to read (wait for reflection and then read the register status ).
The above is my personal understanding, which may lead to mistakes. In principle, everyone learns together.

 

 

Add: Read it carefully and find that the address is not the CPU register.

 

UseInpout32.dll(OrHwinterface. ocx) For Win 98/NT/2000/XP. This dll has the following features:

  1. Works seamless with all versions of Windows (WIN 98, NT, 2000 and XP)
  2. Using a kernel mode driver embedded in the DLL
  3. No special software or driver installation required
  4. Driver will be automatically installed and configured automatically when the DLL is loaded
  5. No special APIs required, only two functionsInp32AndOut32.
  6. Can be easily used with VC ++ and VB or C #.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.