Relay-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site winfree.UUCP Path: winfree!hplabs!hao!nbires!seismo!husc6!think!nike!cit-vax!ll-xn!caip!clyde!burl!ulysses!bellcore!petrus!ka9q!karn From: karn@ka9q.bellcore.com (Phil Karn) Newsgroups: net.ham-radio Subject: Controlling ICOM Radios with an IBM PC Message-ID: <147@ka9q.bellcore.com> Date: 21 Aug 86 07:24:19 GMT Date-Received: 25 Aug 86 02:02:23 GMT Organization: Bell Communications Research, Inc Lines: 144 Controlling ICOM Radios with an IBM-PC This article consists of two parts. Part 1 documents how I connected my ICOM IC-271A and IC-471A radios to the parallel printer port on my MIT (Made-in-Taiwan) PC clone. Part 2 consists of C source to subroutines that can be called by programs running on the PC. Before you warm up your soldering iron, I highly recommend that you get and read a copy of the article "Computer Control of Icom R71, 271, 471 and 751 Radios" by Richard Bisbey, NG6Q, that appeared in the April 1986 Ham Radio on page 47. In it he describes how to install the EX-309 computer interface and how it operates. Richard has clearly been probing around the innards of ICOM radios for some time and has discovered some useful "tricks" that circumvent various misfeatures in the radio. I found the article to be extremely useful; the skimpy documentation provided by ICOM would have required much more trial-and-error experimentation. Reading the Printer Just about everybody with an IBM-PC has more parallel printer ports than they need. They're simple, so manufacturers of add-on multifunction cards like to toss them in "for free". Since the ICOM EX-309 computer interface requires a parallel connection, it seems like those extra printer ports ought to be useful for something. They are, but there's a glitch. A PC printer port is output only (who needs to read data from a printer?) You *can* control an ICOM radio with an output-only port, but you can't read information back from the radio. Fortunately, it is very easy to modify a garden-variety PC printer port (both clones and Real IBM) to allow both input and output, and the modification shouldn't even affect normal operation. You only need to cut one trace and to add one jumper. The secret to this easy mod is that 1) the standard printer interface uses a 74LS374 to drive the output connector, and 2) an input buffer to read back the state of the output pins is already provided. (Why the designer thought a programmer would want to read back the state of a write-only printer data port is beyond me, but I'm happy just the same that they put it in. Perhaps it was only meant for testing purposes). According to the IBM Options and Adapters Technical Reference, the '374 is U41 on the monochrome/printer adapter, U18 on the AT Serial/Parallel adapter and U4 on the plain Printer Adapter. (Check your schematics if you have a clone). It's an 8-bit latch with tri-state outputs. In the original design, OE/ (pin 1) is grounded, always enabling the outputs. If you liberate this pin from ground and connect it instead to a spare output bit that just happens to be available on the 74LS174 hex D latch that drives the miscellaneous printer control lines, you can disable the '374 by setting this bit. This keeps it from interfering when you read data back from the radio. The '174 is U39 on the monochrome board, U4 on the AT Serial/ Parallel card, and U7 on the plain Printer Adapter. Note that the '174 pin numbering may be different from board to board, but the pin you want is the one that latches BD5 from the data bus. On the monochrome card and "plain" printer adapter this is pin 15, while it's pin 10 on the AT Serial/Parallel card. Note also that while on the IBM cards the input to this unused latch is already connected, it is left unconnected on some clone cards (such as mine). It must be jumpered to BD5 on the data bus. As long as software leaves this control bit alone, the printer port will still function normally. I.e., the default power-up state of the data port is "output" mode. Once you've modified your printer port (and verified that it still works) the more tedious part of the job must be done. The problem is that there's no standard connector pinout for parallel ports (analogous to RS-232 for serial ports), so you need to build an adapter plug that shuffles the pins between the ICOM and the PC. The connector on the PC is a DB-25, the same plug used for RS-232. Various computer accessory suppliers (such as Inmac) supply solderless "wire-your-own-null-modem" RS232 adapter kits that make this very convenient. You get male and female DB25 connector shells, a plastic case that snaps together, and a supply of wires with male and female pins that snap into the connector shells. You can thus easily permute the pins any way you want. There's only one proper way to connect the 8 data bits (unless you like shuffling bits around in software) but the connections for the various strobe and ack signals are somewhat arbitrary. However, you're probably best off using the assignment I chose, since that will allow you to run my software without having to modify it. Adapter Wiring Here's the wiring I used in my adapter. I assume that you'll use a male DB-25 on the computer end of the 24-pin ribbon cable going to the EX-309 connectors. Note that the EX-309 uses a 24-pin GPIB-style connector, so make sure you install the DB-25 on the ICOM bus cable correctly; pin 1 of the DB-25 should connect to pin 1 on the EX-309's connector. Note also that because of the different pin layouts on the two connectors, pins 1-12 on the DB-25 correspond to pins 1-12 on the EX-309, BUT pins 14-25 on the DB-25 correspond to pins 13-24 on the EX-309. Pin 13 on the DB-25 is unused. Printer Pin Printer Function Icom DB25 pin Icom Function 2 Data bit 0 1 Data bit 0 3 Data bit 1 2 Data bit 1 4 Data bit 2 3 Data bit 2 5 Data bit 3 4 Data bit 3 6 Data bit 4 5 Data bit 4 7 Data bit 5 6 Data bit 5 8 Data bit 6 7 Data bit 6 9 Data bit 7 8 Data bit 7 17 SLCTIN 9 RP 1 STROBE 10 SRQ/ 14 AUTO FDXT 22 (21 at radio) WP 10 ACK 23 (22 at radio) DAV/ 18-25(any) GND 25 (24 at radio) GND Programming Info Once you've wired the adapter, the various ICOM signals appear as follows. (This assumes the base addressing used for the monochrome adapter/printer port; adjust if your port is at a different address). Note that some of the ICOM bus lines are negative true, and others are positive true. Some (but not all) of the printer port's control and status lines are inverted as well. This has already been taken into account here. (The choice of bit assignments was in part made so that the radios would see an idle interface when the printer port is left in its uninitialized, power-up state). 3BCH (read/write): the 8-bit data bus. The direction of data flow is controlled by bit 5 in port 3BEH. 3BDH (read only): Bit 6 (i.e., mask 40h) is the DAV bit, active low (a zero bit corresponds to the ICOM saying that Data is AVailable). 3BEH (write only): Bit 0 (01H) controls the SRQ line to the radio, active high (setting this bit to a one tells the radio that Service is ReQuested). Bit 1 (02H) is the WP (Write Pulse), active low. Note that this bit should be kept high when the interface is idle, although it will not have any effect as long as SRQ is inactive. Bit 3 (08H) is the RP (Read Pulse), active low. This bit should also be kept high when the interface is idle. Bit 4 (10H) is the IRQ (Interrupt ReQuest enable) bit that allows the ACK input pin to cause an interrupt. Since DAV is connected to the ACK input, this makes it possible to make the computer-to-radio protocol interrupt driven. This isn't usually worth it, though. Bit 5 (20H) controls the direction (input/output) of the 8-bit data port. (This was the bit we had to wire up on the interface card). Clearing this bit puts the data port in output (computer -> radio) mode; setting it allows the computer to read data from the radio. Part 2 of this article will list the C sources for driving the radios. Phil Karn, KA9Q 21 August, 1986