Parallel Port Complete: Programming, Interfacing, & Using the PC’s Parallel Printer Port - Softcover

Axelson, Jan

  • 3.54 out of 5 stars
    13 ratings by Goodreads
 
9780965081917: Parallel Port Complete: Programming, Interfacing, & Using the PC’s Parallel Printer Port

Synopsis

This detailed guide for programmers, developers, and computer enthusiasts shows how to get the most from parallel port in any application or project. The Visual-Basic code and circuit designs include examples that use the new enhanced (EPP) and expanded (EPC) modes.

"synopsis" may belong to another edition of this title.

About the Author

Jan Axelson writes about computer programming and electronic technology. Jan's books include USB Embedded Hosts, USB Complete, Serial Port Complete, and USB Mass Storage. Jan's articles have appeared in Circuit Cellar, EDN, Embedded Systems Programming, and Nuts & Volts.

Excerpt. © Reprinted by permission. All rights reserved.

From Chapter 11, Modes for Data Transfer:

Detecting an ECP

In testing a port, you might think that the first step would be to test for an SPP, and work your way up from there. But if the port is an ECP, and it happens to be in its internal SPP mode, the port will fail the PS/2 (bidirectional) test. For this reason, the TestPort routine in Listing 4-4 begins by testing for an ECP.

An ECP has several additional registers. One of these, the extended control register (ECR) at base address + 402h, is useful in detecting an ECP.

Microsoft's ECP document recommends a test for detecting an ECP. First, read the port's ECR at and verify that bit 0 (FIFO empty) =1 and bit 1 (FIFO full) =0. These bits should be distinct from bits 0 and 1 in the port's Control register (at base address + 2). You can verify this by toggling one of the bits in the Control register, and verifying that the corresponding bit in the ECR doesn't change. A further test is to write 34h to the ECR and read it back. Bits 0 and 1 in the ECR are read-only, so if you read 35h, you almost certainly have an ECP.

If an ECP exists, you can read and set the port's internal ECP mode in bits 5, 6, and 7 of the ECR. In Listing 4-4, a combo box enables users to select an ECP mode when a port is ECP. Chapter 15 has more on reading, setting, and using the ECP's modes.

From Chapter 7, Output Applications:

Solid-state Relays

Another way to switch power to a load is to use a solid-state relay, which offers an easy-to-use, optoisolated switch in a single package. Figure 7-7A shows an example.

In a typical solid-state DC relay, applying a voltage across the control inputs causes current to flow in an LED enclosed in the package. The LED switches on a photodiode, which applies a control voltage to a MOSFET's gate, switching the MOSFET on. The result is a low resistance across the switch terminals, which effectively closes the switch and allows current to flow. Removing the control voltage turns off the LED and opens the switch.

Solid-state relays are rated for use with a variety of load voltages and currents. Because the switch is optoisolated, there need be no electrical connection at all between the control signal and the circuits being switched.

Solid-state relays have an on resistance of anywhere from a few ohms to several hundred ohms. Types rated for higher voltages tend to have higher on resistances. Solid-state relays also have small leakage currents, typically a microampere or so, that flow through the switch even when off. This leakage current isn't a problem in most applications.

There are solid-state relays for switching AC loads as well. These provide a simple and safe way to use a logic signal to switch line voltage to a load. Inside the relay, the switch itself is usually an SCR or TRIAC. Zero-voltage switches minimize noise by switching only when the AC voltage is near zero.

"About this title" may belong to another edition of this title.

Other Popular Editions of the Same Title

9788187972020: Parallel Port Complete

Featured Edition

ISBN 10:  8187972025 ISBN 13:  9788187972020
Publisher: Penram Intl Pubs (india)pvt. Ld ...
Softcover