- 1st Edition
- Instrument-to-PC Interfacing Using an Enhanced Parallel Port
- Interfacing the Extended Capabilities Parallel Port
Other pins are used to send controls to the printer and get status of the printer, you can understand them by the names assigned to the pins. To use the printer port for applications other than printing, We need to know how ports are organized. Data register will hold the data of the data pins of the port.
That means, if we store a byte of data to the data register, that data will be sent to the data pins of the port. Similarly control and status registers. The following table explains how these registers are associated with ports. Table 1. Than means, If a pin has a 'low' ie. Signals with prefix 'n' are active low.
That means, Normally these pins will have low value. When it needs to send some indication, it will become high. For example, Normally nStrobe will be high, when the data is placed in the port, computer makes that pin low.
Normally, data, control and status registers will have following addresses. We need these addresses in programming later. Note: All the parallel ports do not have bidirectional capability. Earlier parallel ports had only output enabled in data pins since printers only inputs data. But latter, to make parallel port capable of communicating with other devises, bidirectional ports are introduced.
By default, data port is output port. To enable the bidirectional property of the port, we need to set the bit 5 of control register. To know the details of parallel ports available in your computer, follow this procedure:. Right click on My Computer, go to "Properties". Select the tab Hardware, Click Device manager. You will get details of LPT port. Make sure that "Use this Port enable " is selected.
Select tab recourses. In that you will get the address range of port. To start programming, you will need a D type Male connector. Its pin structures can be found in the connector as follows:. Programming the printer port in DOS:. To start programming the port, we will use DOS.
Instrument-to-PC Interfacing Using an Enhanced Parallel Port
In DOS we have commands to access the port directly. For security reason, higher versions of the windows does not allow accessing the port directly. To program the parallel port in these systems, we need to write kernel mode driver. If you want to run the same program in Windows XP, For studying you can use the technique that I have posted in this forum.
When we want to find out whether particular pin of the port is high or low, we need to input the value of corresponding register as a byte. In that, we have to find out whether the corresponding bit is high or low using bitwise operators. We can't access the pins individually. So, you need to know basic bitwise operations. To make a particular bit in a byte high without affecting other bits, write a byte with corresponding bit 1 and all other bits 0; OR it with original byte. Similarly, to make particular bit low, write a byte with corresponding bit 0 and all other bits 1; AND it with original byte.
In Turbo C, there are following functions used for accessing the port:.
As I've mentioned earlier, each port contain 8 bits or simply, 1 byte. For the DATA port, bit d7 is the most significant bit and bit d0 is the least significant.
- The Video Game Theory Reader 2;
- Empires and Barbarians: The Fall of Rome and the Birth of Europe.
- W is for Wasted (Kinsey Millhone Series, Book 23).
- Programming the Parallel Port: Interfacing the PC for Data Acquisition and Process Control;
Most of our experimentation and actual projects will use this port. Here are the corresponding pin numbers on the DB25 connector. They are commonly output-only ports but some motherboards offer bidirectional. Even if it is not bidirectional, you can also read the content of the port and you will get the last byte that was sent. I've also read something about people driving signals to this port, using it as input even when it is not set as bidirectional I haven't tried this before and I dont intend to try this on my LPT port.
If you do know the effect, please let me know. The pin numbers follow. If you try to use it as output, it will not accept the byte sent. There will be no change in its content. It cant be manipulated by software. Its address is located at H or in decimal. Pins 10, 12, 13, 15 are normaly hi and pin 11 is normally lo. The default value of this port when in SPP mode and when there is no peripheral connected is 7F in hexadecimal. If a printer or scanner is connected, its value will be 87H. This is used for feedback from the external system. I personally have not used this port but I will update this page as soon as possible.
Anyway, here are the pins and pin numbers. The software register of the control lines is accessed at address 37AH or in decimal. The default value is CCH. Using Assembly Language. You can do bit by bit manipulation. To write to a port use [ out ] and to read a port use [ in ]. Here's there syntax:. OUT port, register. IN register, port. Register must be AX or AL and port must be a number can be decimal, hex, or binary.
The port is the address e. The content of the DATA port in binary will be. Review the number system conversion. You can use the calculator program provided by Windows to check the conversion.
Just be sure that you are in scientific mode. IN AL, H. Now you can verify if what I wrote about the default value is correct but in case you get a different result, well. Remember that the DATA port can also be read. A technique called "masking" can be used to turn on or turn off each bit in the DATA port. Then we will apply the mask using AND. Now how did I get the mask value?
This current is called source current. This must be avoided. Sink current In case of a pin being in logic low state there is a minimum amount of current that the pin can absorb called sink current. It is always a good practice to use buffers for your costly logic devices for both data in and out.
Demonstration of use of Buffers in Data Output You will find port address as well as its type, usually the options are as follows SPP standard parallel port not bi- directional Bi- directional standard parallel port with bi- directional facility EPP Enhanced Parallel port ECP Extended Capabilities parallel port How to configure for Bi-directional Facility? To accomplish data in through data port you should: 1.
Interfacing the Extended Capabilities Parallel Port
Printer Hand shake used in standard parallel port Centronics Standard According to this standard , following hand shake was used: All above signaling, was done by software in which PC had to wait for a response from printer before outputting the next signal. However you can still use that data port of SPP by usual way. All above signals are generated automatically in hardware. It is an input from the printer. If it is low then it means that printer is waiting for receiving data from PC.
WRITE is also brought high. This Depends upon software. Any other input line may be used as well for this signaling. This is done automatically when processor reads the Address Register. As Wait line goes high, data is read from data liens pin 2 to 9 f. Addr Strobe is pulled high. This ends EPP read cycle. Time-out indication in EPP There is a possibility that host PC starts a write cycle but never receives acknowledgement from printer when no printer is attatched. In order to avoid this a Watchdog timer scheme is used it is described as follows.
In addition it has following enhancements. This scheme helps to transmit a single byte if a long string of this same byte is required to be transmitted. For example with Fax, copier and printer in a single machine containing these 3. You just clipped your first slide! Clipping is a handy way to collect important slides you want to go back to later. Now customize the name of a clipboard to store your clips.