Silicon ChipPC Parallel Port Wizard - October 2002 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: It's good news week, every week... / Comet chasing has its ups and downs
  4. Feature: 3D TV In Your Own Home by Barrie Smith
  5. Project: Speed Controller For Universal Motors by John Clarke
  6. Feature: 6+ Megapixel SLR Cameras by Ross tester
  7. Project: PC Parallel Port Wizard by Trent Jackson
  8. Project: "Whistle & Point" Cable Tracer by Jim Rowe
  9. Product Showcase
  10. Project: Build An AVR ISP Serial Programmer by Stephen Davies & Peter Smith
  11. Weblink
  12. Vintage Radio: Radio Corporation WS122 army transceiver by Rodney Champness
  13. Book Store
  14. Notes & Errata
  15. Back Issues
  16. Market Centre
  17. Advertising Index
  18. Outer Back Cover

This is only a preview of the October 2002 issue of Silicon Chip.

You can view 28 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • 3D TV In Your Own Home (October 2002)
  • 3D Movies On Your Own Camcorder (November 2002)
Items relevant to "Speed Controller For Universal Motors":
  • 5A Universal Motor Speed Controller PCB pattern (PDF download) [10110021] (Free)
  • Panel artwork for the 5A Universal Motor Speed Controller (PDF download) (Free)
Items relevant to "PC Parallel Port Wizard":
  • Software for the PC Parallel Port Wizard (Free)
  • PC Parallel Port Wizard PCB pattern (PDF download) [07210021] (Free)
  • Panel artwork for the PC Parallel Port Wizard (PDF download) (Free)
Items relevant to ""Whistle & Point" Cable Tracer":
  • Panel artwork for the "Whistle & Point" Cable Tracer (PDF download) (Free)
Items relevant to "Build An AVR ISP Serial Programmer":
  • AT90S1200/AT90S2312 firmware and source code for the AVR ISP Programmer (Software, Free)
  • AVR ISP Serial Programmer PCB pattern (PDF download) [07110021] (Free)
  • Panel artwork for the AVR ISP Serial Programmer (PDF download) (Free)

Purchase a printed copy of this issue for $10.00.

PC PARALLEL PORT WIZARD Want to know more about the parallel port on your PC? Maybe you’re thinking of buying a second-hand notebook PC. Or perhaps you would like a visual indicator to demonstrate that your printer port responds to software commands. If so, the PC Parallel Port Wizard is just for you! by Trent Jackson www.siliconchip.com.au October 2002  39 G etting stuck with a fault in the parallel port of today’s computers can be a pain. Wouldn’t it be nice to have a simple port tester to check it out. Before you pick up that bargain at the flea market or swap-fest, plug in this Wizard and it will tell you if everything is as it should be. But the Parallel Port Wizard is more than a port testing device. It’s also a learning aid. And it’s cheap and simple to build. It’s a combination of some DOS software and a handful of com- mon components - but it enables you to test and analyse every I/O pin in a standard parallel printer port. That might not sound very exciting - until you get stuck with a fault. Oh, and before we go too much further we should state what the Parallel Port Wizard will not do. While it will test every I/O line on the port as an output, to drive a LED, it will not do any input tests. To do that, you would at least need an array of switches to pull the inputs high or low and you would certainly need more complicated software than is presented here. However, the simple approach can be easily justified. Provided each I/O line functions properly as an output, it is reasonable to assume that it will generally work on data input as well. So whether your expertise runs to advanced motherboard repairs or just a mere mortal looking to solve a parallel port problem, this Parallel Port Wizard can be a very convenient item. +5V 100nF +5V 100nF 10F PARALLEL PRINTER PORT 2 3 4 5 6 7 8 9 DATA B0 3 DATA B1 5 DATA B2 7 DATA B3 9 DATA B4 3 DATA B5 5 DATA B6 7 DATA B7 9 8x 10k 4 2 5 3 11, 12 11 10 1 14 16 17 BUSY/READY ACKNOWLEDGE 1 15 18-25 IC2c IC2d 4 6 10 180 180 180 180 K  K  K  K  K  K  LED2 A LED3 A LED4 A 11 16 IC1e LED5 A IC1f 14 12 15 A LED7 A LED8 A IC2e 12 IC2f 14 15 (NOT USED) 8 100 1 14 11 4,5 IC3b 9 14 12 2,3 D2 1N4004 13 K OFF/ON 7 D1 1N4004 100 A S1b A REG1 7805 K IN +5V OUT COM 9V BATTERY 100 330 100F 10F 100nF S1a A LED9 POWER GND SC PC PARALLEL PORT WIZARD 40  Silicon Chip  K LEDS 2002 (NOT USED) 8 LED6 11 SELECT ERROR  A 13 IC4b 4x 10k 13 IC2b 2 180 K 100nF LED1 100 10 SELECT IN IC2a 10 180  16 7 INITIALISE IC1d 6 180 K IC1,2: 4049 IC4a STROBE AUTO FEED IC1c 4 180 IC3,4: 4002 100 PAPER END IC1b 2 9, 10 IC3a 12 IC1a 100nF 1N4004 A K K A COM IN 7805 OUT www.siliconchip.com.au Larger-than-life view of the PC Parallel Port Wizard with top cover removed. The 26-way IDC cabledoesn’t emerge from the middle of the case as it appears here; rather it takes a 90° kink then another to emerge from the cutout which can clearly be seen above the battery. This gives some strain relief to the IDC plug, preventing it from being pulled out. It will analyse every I/O line and give a pass/fail via the software. The parallel printer port The parallel printer port on a standard IBM compatible computer consists of 25 pins, usually arranged in a “D” configuration (see Fig.1). 17 of these pins are I/O (input/output), while the remaining eight are ground pins. Of the 17 I/O pins, eight (pins 2-9) are grouped as an 8-bit output section, another four (pins 1, 14, 16 and 17) are a 4-bit section while the remaining five pins (pins 10-13 & 15) make up a 5-bit input section. So the parallel port is broken down into three sections and each particular section has its own unique address. This is shown in the port mapping 13 12 11 10 9 8 7 6 5 4 3 2 1 25 24 23 22 21 20 19 18 17 16 15 14 PARALLEL PRINTER PORT ON PC (FEMALE 25-PIN D CONNECTOR) Fig.2: Pinning of a parallel printer port connector on a standard PC, looking from the outside. www.siliconchip.com.au table (Table 1). I’m not suggesting that it can’t be As mentioned above, the software done via Windows, but I believe that has been developed to run under the for this sort of function DOS is still by PARALLELfar PRINTER PORT TECHNICAL DATA TABLE MAP the better way. DOS environment. Using Windows to control devices Hardware via a port is bad enough but testing a port properly via the Windows enviAll of the hardware is mounted on ronment is quite difficult. a small, single-sided PC board, coded PIN NO ADDRESS BIT VALUE INVERTED 2 3 4 5 6 7 8 9 1 14 16 17 10 11 12 13 15 BASE 0 1 2 3 4 5 6 7 0 1 2 3 6 7 5 4 3 1 2 4 8 16 32 64 128 1 2 4 8 64 128 32 16 8 NO NO NO NO NO NO NO NO YES YES NO YES NO YES NO NO NO BASE + 2 BASE + 1 GENERAL USAGE PRINTER USAGE 8-bit Output Data 8-bit Output Data 4-bit Output Data Strobe Auto Feed Initialize Select In Acknowledge Busy Paper End Select Out Error 5-bit Input Data Table 1: the parallel printer port pin assignments and usages. Common BASE addresses are: &H378, &H278, &H3BC. These addresses are in hexadecimal. To simplify things, bit values are shown decimal Common BASE addresses are: &H378, &H278, in &H3BC. These addresses are in hexadecimal. To simplify things, the bit values are shown in decimal..................................................................... October 2002  41 07110021 and measuring 116 x 92mm. The circuit operation is relatively straight forward. It uses only four low cost CMOS ICs and a few other bits and (CABLE TO PRINTER PORT) 10k 10k 100 100F 10k 10k 100 9V BATTERY HOLDER 100 IDC 26-WAY HEADER + 12001270 1N4001 – pieces to do the job. It’s all powered by a single, on-board 9V battery. Every pin on the parallel printer port goes somewhere. As stated before, IC3 4002 100 10k 10k 10k 10k 10k 10k 10k 10k + 100nF 1 100 IC4 4002 100nF 1 10F + 180 180 180 180 330 100nF 100nF 180 + 1 100nF 180 10F IC2 4049 1 180 IN4001 IC1 4049 180 REG1 7805 S1 DPDT LED9 LED1 LED2 LED3 LED4 LED5 LED6 LED7 LED8 Above is the complete project – PC board component overlay and external wiring – reproduced at 1:1 scale. Below is a straight-on photograph of the same thing: between the drawing and photo you should be able to work out how it all goes together. every pin on the port under goes a test (minus the ground pins, of course). I have deliberately used CMOS ICs in this project, because as far as I’m concerned, if a parallel port can’t supply enough line voltage to drive a CMOS gate, then it is probably suspect. CMOS logic devices require at least 73% of VCC for a valid logic high, that’s only about 3.5V for a 5V supply rail. Parts List – Parallel Printer Port Wizard 1 PC board, coded 07110021, 116 x 92mm 1 small ABS case 140 x 110 x 35mm (Jaycar HB-5970 or equivalent) 1 front panel artwork sticker 134 x 30mm 1 miniature DPDT Switch (S1) 1 26-way PC-mounting IDC male header socket 1 26-way IDC female plug 1 25-way D25 male IDC Plug 1 9V PC-mounting battery holder ( Jaycar PH-9235 or equivalent) 1 9V alkaline battery 1 1.5m length 26-way IDE ribbon cable 1 200mm length hookup wire 4 small square rubber feet 2 PC stakes 4 6 x 3mm self-tapping screws 1 5mm M3 screw & nut 3 6mm M2 screws & nuts 9 5mm LED bezels Tinned copper wire (links) Semiconductors 2 4049 CMOS hex buffered inverters (IC1 & 2) 2 4002 CMOS dual quad input NOR gates (IC3 & 4) 1 7805 5 volt regulator (IC5) 8 5mm red LEDs (LED 1 - 8) 1 5mm green LED (LED 9) 2 1N4004 silicon power diodes (D1 & 2) Capacitors 1 100µF 16VW electrolytic 2 10µF 16VW electrolytic 5 100nFMKT polyester (code 104 or 100n) Resistors (1%, 0.25W) 12 10kΩ 5 100Ω 8 180Ω 1 300Ω 42  Silicon Chip www.siliconchip.com.au 07210021 Same-size PC board artwork for those who want to make their own. How it works Referring back to the schematic, you will see four quad-input NOR gates (IC3a, IC3b, IC4a & IC4b). These gates are basically used to return data to the input side of the port. Remember that there are 12 output pins but only 5 input pins on the port, hence the use of four NOR gates. All five of the input pins on the port are pulled high via internal resistors, so you could regard these pins as being Active low (it really just depends on how you set up the software and hardware. With a NOR gate, any high logic level on any of its input pins will result in a logic low at its output pin. It’s the same as an OR gate, except it’s inverted. The 10kΩ pull-down resistors on all the output lines are there for two reasons. Firstly, they ensure that none of the inputs to the logic circuitry are left floating when disconnected from your PC. Secondly, they also apply a small load to the output lines, to ensure that they are still capable of driving the data feedback NOR gates while under load. IC1 & IC2 are both 4049 buffer inverters. These buffers drive a string of eight LEDs, controlled via (D0 - D7) on the port. The 180Ω series resistors limit the current the LED current to around 20mA. www.siliconchip.com.au A double-pole switch controls both power and port grounding to the circuit. Switching of the port ground to the main circuitry has been included so that the circuit doesn’t consume any power from the port when various data lines are high and the battery voltage is not applied. If this switch was omitted, you would see the LEDs faintly light up with no power applied. This is due to current mirroring within CMOS devices. Construction As everything except the power switch mounts on the PC board, con- struction should be a snap even for the beginner. Start with the lowest profile components first (resistors and diodes), followed by the links. We normally use resistor lead offcuts for the links but some on this board are a tad long, so you’ll need some lengths of tinned copper wire. Two PC stakes are used to solder to the switch. Four stakes are shown in our photos but two of these were used in development and are not required. Next, mount the five MKT and two electrolytic capacitors. The MKTs aren’t polarised but the electros are, so put them in the right way. Follow these with the 5V regulator (you’ll need to bend its legs down by 90°) and the four ICs. Whether you use sockets or not is entirely up to you: generally, they’re not worth the trouble with low-cost chips. Either way, make sure you get the IC polarity right. Now mount the 9V battery holder. It both solders and screws to the PC board. Then install the male IDC plug. Apart from the switch and LEDs, it’s now almost finished. First, though, you’ll need to drill ten holes in the front panel for the nine LEDs and the power switch. Photocopy the front panel artwork and use it as a template. The LED leads must also be bent over at 90° to enable them to poke through the front panel. Make sure they are all bent the same way AND the right way – LEDs are polarised! Glue the front panel artwork (or a photocopy) onto the panel and drill the holes out. And don’t forget the little cut-out in the back panel. LED bezels are not essential - but they do hide any The ppwiz.exe software, downloadable from www.siliconchip.com.au October 2002  43 This front panel artwork can also be used as a drilling template. Photocopy it, stick it on the front panel – and drill out the ‘X’s! ragged or rough edges around the holes. Fit the switch to the front panel and solder its two lower pins to the PC stakes. The two upper switch pins solder to the back of the PC board where shown. Finally, screw in the PC board, plug in your IDC cable and take it out the rear panel (don’t forget the double bend!) and now it IS all finished. Using the PPP Wizard As stated elsewehre in this article, the Parallel Port Wizard and its software operates under MS-DOS. That means you either have to boot the computer with a DOS disk or if you have a Win 9x or Win Me machine, operate it under a DOS (command prompt) box. In either case, checking the parallel port is child’s play. You simply plug the wizard in to the parallel port, turn it on and run the PPWIZ.exe program. All instructions are on screen. The F1 key allows you to change the Putting the port to use Would you like to be able to control external devices with your PC? The existing parallel port in your PC offers a simple hardware interface that can be wired up to just about any external device with a little ingenuity. And it’s easy to program, too! The PPPWiz hardware and software provides a means of learning the basics of parallel port operation. With this knowledge, you can then begin to control the port (and your external circuits) from within your own programs. In the following examples, we show how to read and write data from the parallel port using QBASIC. We’ve used QBASIC because it’s easy to follow if you’re new to programming. For the most part, data is read from and written to the parallel port in byte-wide (8-bit) chunks. To access the port (read and write data), the programmer needs to know its “address”. Just as with disk drives, keyboards, serial ports, etc, the parallel port occupies a unique address in the processor’s (CPUs) input/output (I/O) address space. For example, the address of the first parallel port (LPT1) in most PCs is 378 or 278. Thus the parallel port is said to be “I/O mapped” and is accessed in QBASIC using the “INP” and “OUT” instructions. Too easy! Note that these numbers are in hexadecimal format. In QBASIC, hexadecimal numbers must be prefixed with “&H”. Here’s an example: OUT &H378, 0 ‘write data value ‘0’ to I/O port ‘378’. The data output side of the port consists of an 8-bit latch (or “register”). Therefore, data written with the OUT instruction remains on the port data pins (pins 2 - 9) until the next 44  Silicon Chip base port address, the F2 automatically searches for the base port address, the F3 key starts the automated checking procedure while the F4 key exits from the program (see the screen grab below). The 8-bit pin status is mirrored by the front-panel LEDs on the Wizard. While this is of limited use in the port checking procedure, it becomes very useful when you want to experiment with the port. SC Have fun! OUT. To drive all eight pins high (near 5V) we would use: OUT &H378, &HFF ‘write data value ‘FF’ to I/O port ‘378’. With the PPPWiz connected, this instruction will turn all LEDs on. To read the digital levels present on the port “status” pins, use “INP” instead: PortValue = INP (&H379) ‘read data from I/O port ‘379’. In this example, the digital levels of the “status” pins (pins 10 - 13 & 15) are read and stored in the variable “PortValue”. Displaying the result is easy: PortValue = INP (&H379) ‘read data from I/O port ‘379’. PRINT PortValue ‘display the value on-screen A parallel port occupies eight consecutive addresses in I/O address space. The first address (the output port) is referred to as the “base” address. Therefore, when a parallel port is said to have an address of 378, this implies that it occupies addresses 378 through to 37F. Table 1 gives specific details about addresses and pin assignments as they relate to the standard parallel port (SPP). Parallel ports fitted to most Pentium-class PCs can also operate in EPP (Enhanced Parallel Port) and ECP (Extended Capabilities Port) mode. These modes use additional addresses and signals not covered in this article. A wealth of PC parallel port technical information and project ideas is available on the Internet. Start at www.lvr.com/parport.htm QBASIC was supplied with all versions of DOS and Windows up to (but not including) Windows 2000. It is also freely available on the Internet. To learn more about QBASIC programming, go to www.qbasic.com www.siliconchip.com.au