Serial Port Communications ... Made Easy!

Mark sheds light on the sometimes "Black Art" of using the HP Palmtops' not-completely standard communication port to connect to and communicate with modems, printers, and other PCs.

By Mark Scardina

During the past two years that I have provided support on the HP Handhelds Forum on CompuServe, I have read over 100,000 messages. If you were to ask what was the topic that appeared most, I would answer without hesitation Communications.

There is little doubt that Palmtop communications, whether with online services, printers, or even simply with another PC, is still considered a black art by many. Add to that HP's propensity for complicating communications with non-standard serial ports and preemptive software and you have a topic that is perfect for The HP Palmtop Paper.

The HP Palmtop Serial Cable

One of the first accessories sought by Palmtop users is the elusive serial cable. This one meter umbilical link to the outside world can be very difficult to find, thanks to the proprietary connectors residing on the right side of your HP Palmtop. HP provides a cable in their Connectivity Pack (95LX -HP F1001A; 100LX -HP F1021A) as well as marketing it as a separate but often special order item. With the introduction of the 100LX, HP discontinued the 95LX cable (HP F82222A) and created a new serial cable with a small 10-pin end to connect to the 100LX (HP F1015A). The cable comes with an adapter to convert the 10-pin end to a 4-pin plug so it can be used with the 95LX. The original style HP 95LX /48 cables cannot be converted for use on the 100LX.

The serial cable includes a 1" long by 1/2" diameter black cylindrical "ferrite core" close to the Palmtop end.

Connectivity Cable:  Graphic

 While the core's purpose is to prevent RF radiation from the HP serial port, it is of dubious value because the port does not produce significant radiation. The ferrite core is slipped over the outer insulation of the cable, not molded to it. Many users have removed the ferrite core to create a more compact cable with no discernable side effects.

The other end of the cable is a standard DB-9 female connector. The HP Palmtop side has 10 pins because there are two ground connections on that side.

HP makes a Palmtop-to-Macintosh serial cable with a mini-din connector on one end to fit into the Mac (HP F1016A). Like the PC cable, this cable is designed to directly connect to a computer. Adapters are needed to connect it to other peripherals.

DIN Connector on MAC Cable: Graphic

 Both the PC and Mac connectivity cables can be connected to switch boxes or extended by connecting them to another cable. However, the HP Palmtop's signal drive capability is not as strong as a PC's and as such, the length and quality of the cable will impact on the reliability of the connection. Generally speaking, you should not have a problem adding an additional meter to the length of your cable.

Don't Try to Make Your Own Cable

The connector that plugs into your Palmtop is an HP proprietary design and is not available as a separate part. The 2mm pin spacing is identical to that used by most IDE hard drives, and not the 0.1" spacing most commonly found in this type of connector. A connector could be fashioned from an IDE connector but implementing the strain relief would be more difficult.

Unfortunately, the difference between 2mm and 0.1" is hard to tell by the naked eye. If you use a connector with the wrong pin spacing and try to push it into the Palmtop serial port, you could break a pin.

Since list price of the HP cable is $25 and the cost of repairing a broken pin is $180, I recommend purchasing the HP cable.

Connecting to a PC

The HP Serial cable is expressly designed to connect directly to a PC or Macintosh without the need for additional adapters. The only time an adapter should be required is when your PC has a DB-25, 25Pin connector. In that case a 9-pin-to-25-pin male/female adapter will do the job. This adapter is included in the HP Adapter kit (HP F1023A) and the HP 95LX or HP 100LX Connectivity Pack.

Selecting the proper port

Selecting the proper PC serial port to connect to can be difficult. You have to consider the type of software you are running and peripherals you have hooked up to other COM ports on the PC. There is a relationship between COM1 and COM3 as well as between COM2 and COM4 on most PCs that complicates the situation. When a device on COM1 wants the CPU's (Central Processing Unit's) attention, it communicates this by sending the CPU an "interrupt" code. Unfortunately, COM1 uses the same interrupt as COM3. So if you have a mouse connected to your PC's COM1 port and your Palmtop to COM3, there would be a conflict when both devices tried to get the attention of your CPU.

It is impossible to discuss all combinations, but here are some general rules that, if followed, will allow you to make a reliable connection.

If you find yourself without an available port on your PC, you can purchase an additional two ports on a serial board at most computer stores for under $30. Some boards even let you assign these new ports to different interrupts than COM1 and COM2, thereby allowing you to avoid any interaction.

If you have this type of setup, I recommend that you connect your mouse to the COM3 or COM4 ports and reserve COM1 or COM2 for the HP Connectivity cable. This is because the connectivity software in the original 95LX Connectivity Pack and the current 100LX Connectivity Pack only work with COM1 and COM2.

Transfer speed

The other major compatibility issue is transfer speed. Serial communications can reliably occur at speeds from 300 bps to 115 Kbps between your Palmtop and a PC. However, there are many things that can reduce the actual speed at which you will ultimately communicate.

Software can talk to your serial port in two different ways: Polled and Interrupt-driven.

The polled mode has the program check several times a second to see if data has arrived. This method is used most often by file transfer programs, since the data is largely going in one direction and the receiving PC only has to read and store it. Polled mode is not often used for data communications programs because they require high speed two-way communication between two devices and the polled mode can slow this down. When a file transfer program like ZIP.COM <ON DISK ICON> or LapLink is running, it is the only program active and is only doing one thing -transferring a file in one direction. It is therefore able to achieve greater transmission speeds (up to 115K).

An example of an interrupt-driven program is a data communications program such as fastCOMM! A program like this can be printing data to the screen, checking for keystrokes, transmitting responses, etc., all while trying to receive characters. The program must be able to be notified whenever data is ready to be sent or received, and interrupt what ever it's doing to accomplish that. Using an interrupt-driven mode allows the communications program to operate at a higher speed because it knows it won't miss any data. This mode is defective in the 95LX, preventing all but a few modified communications programs from running properly. The 95LX will "lock up" after sending one character because, the hardware never tells the software that it can send another.

CPU Speed

Regardless of whether polled or interrupt-driven mode is used, a program must have time to process the data once it has received it, and before it can get more. Therefore, the speed of the CPU (Central Processing Unit) directly impacts the speed that a particular piece of software can run.

In addition, other programs running in the background demanding CPU attention will reduce your speed. For example, an efficient DOS communications program run on the 100LX with System Manager (the BUILT-IN applications) not loaded should be able to easily communicate at 38.4K bps. However, with System Manager loaded, the speed is cut in half to 19.2K bps. This appears to be improved on the latest 1.05A 100LX ROM version.

On the PC, programs such as Windows can dramatically effect a serial port's performance. Many older PC's have a maximum speed of 19.2K with Windows loaded. Programs loaded from your CONFIG.SYS and AUTOEXEC.BAT on either machine can also slow you down. Examples are Stacker, 95/100 Buddy, Diet, Clock Displays, Cursor programs, and any others that regularly require the CPU's attention. Finally some of the serial ports in older PCs were simply not able to run at full speed. Your desktop PC's owners manual should specify the serial port's capability.

If you are having serial port problems, and you are sure that the port is available and not being interfered with, the best solution is to start disabling software that may be competing for CPU attention. This should allow you to find the problem program, but realize that the problem may be caused by a combination of factors. You may need to experiment with different solutions.

Connecting to a Serial Printer

The HP Palmtops have the capability to print files to any printer that supports LaserJet, Epson FX, or IBM Proprinter emulations. Unfortunately, the lack of a parallel port makes this task far more difficult than it should be. The first step is to, once again, look at the cable.

While the serial cable makes for easy Palmtop-PC hookups, it is ill-suited for printer use. Even if you are fortunate enough to have a serial port on your printer, it is probably a female 25-pin connector with the Transmit and Receive pins reversed. Fortunately, the HP Connect/Adapter Kit (HP F1023A) comes with a printer adapter that connects to the end of your serial cable, switches the transmit and receive pins, and plugs into the female 25-pin port of the printer. (This adapter is also found in the HP 95LX and 100LX Connectivity Packs.) This single adapter replaces up to three regular ones, as you would need a null modem to reverse the Transmit and Receive, a 9-pin-25-pin one to get the right number of pins, and a gender-changer to convert to a male connector to mate with your printer.

Once connected to a serial printer port, the only things left are to ensure that the Baud rate is set to 9600 on both machines and that Software Flow Control, XON-XOFF, is enabled. Some printers do not permit both a parallel and serial connection to be powered at the same time. Therefore, you may need to disconnect the printer from your desktop PC, or turn off your PC if it and the Palmtop are connected to the same printer.

Connecting to a Parallel Printer

Parallel (Centronics) ports are the norm on most printers. To connect a Palmtop to a parallel printer you must convert the serial signal from your Palmtop to a parallel signal for your printer using a serial-to-parallel converter. These can be purchased for $30 to $100. (See Product Index, page 63.)

A serial-to-parallel converter is a small adapter with a serial port on one side and a parallel port on the other. It's best to first decide on the model of printer to which you want to connect, determine the type of parallel interface it has, and select a serial to-parallel adapter that will necessitate the fewest additional adapters. An example will help clarify this.

Most printers have a Centronics connector for parallel input. Connect a Centronics-to-DB-25-pin cable to the printer on the Centronics end. Connect the 25-pin end to a serial-to-parallel converter. Connect the 9-pin end of the converter to the HP Connectivity cable and connect the cable to the Palmtop.

A far more compact solution available for the 95LX is a serial-to parallel adapter cable available from Imaging Supplies Express. The converter has a Centronics port on one end that connects directly to the printer. A cable comes out of the converter and terminates in a 4-pin plug that connects directly to the 95LX serial port.

Another compact alternative is the converter from BSE that has a Centronics port on one end that connects directly to the printer. A 9-pin port on the other end of the converter connects directly to the HP Connectivity cable. Both converters mentioned above do not require batteries or an AC adapter as is the case with all others. (For contact information on adapters, see product information box, end of article.)

The serial-to-parallel converters mentioned in the Product Index (page 63) were designed to work with the 95LX. There are other converters available not specifically designed for the 95LX. When using one of these, you'll need to set the speed and Software Flow control on it instead of your printer. In the case of the HP 95LX you will also need to set the converter to ignore DTR and CTS/ RTS.

Printing from DOS Applications

You need to make sure that the Palmtop's serial port is on and set to the proper speed. If you are in DOS with System Manager not loaded, you can turn the port on by entering the command d:\bin\serctl /w at the DOS prompt or in a batch file from the 100LX, or just serctl /w from the 95LX. HP95CTRL <ON DISK ICON> is a utility that lets you control serial port power on the 95LX.

On the HP 100LX in System Manager, you can go into Set Up, press (MENU) Options Communications Port, and check Enable Com1 Port in DOS. You may also use my program ASERCTL.COM <ON DISK ICON> to toggle the port power on or off on the HP 100LX by pressing (ALT)-(+) or (ALT)-(-).

If you've exited System Manger, you need to set the port speed from the DOS prompt. Enter the command D:\DOS\MODE COM1:9600,E,7,2,P. This should also help in printing multiple pages. Do not use the 'p' if System Manager is loaded, as a portion of the MODE program needs to stay in memory.

Connecting to Modems

Many HP Palmtop Paper articles have discussed using modems with the HP Palmtops, therefore I will not go into the same level of detail here. There are some general principles that are worth repeating. Just as with printers, the HP serial cable is not designed to directly connect to a modem. Even modems with DB 9-pin connectors do not have the proper gender to mate with the serial cable. At the bare minimum, this means that you will need a null modem adapter to reverse the Receive and Transmit signals and a gender changer to mate with the modem. HP comes to the rescue once again in the Connect/Adapter Kit (HP F1023A) by including a 9-pin-to-9-pin M/M null modem adapter (has a picture of a phone on it).

Once the connection is made, you will need to select the proper speed. When using a modem, there are actually two communication speeds that are present. There is the speed that your Palmtop communicates with the modem, called DTE, and the speed that the modem communicates with the remote modem, called DCE. These speeds are reported when your modem makes a connection if you have the English Result Codes enabled on the modem. For example, the result of CARRIER 9600, CONNECT 19200 indicates that the modem is communicating with the other modem at 9600 bps and with your PC at 19200 bps.

You set the DTE speed in your communication program. The modems negotiate the DCE speed between themselves. A 9600 bps modem means that its maximum DCE speed is 9600 bps even though it may have a DTE speed set to 38400 bps. You might ask, why set the DTE speed to a higher speed at all. The answer is that most current modems support two specifications, MNP5 and V.42, which allow for a modem to compress data before it sends it. Up to 4 to 1 compression can be applied. Therefore, if the computer can send data to the modem at 38400 bps, the modem can compress it and send it out at 9600 bps, reducing your connect time.

In order to use a higher DTE speed, you will need to set Hardware Handshaking, RTS/CTS, to ON. This is also known as hardware flow control. Since the HP 95LX does not support Hardware Handshaking, because it has only four pins, you must set your DTE speed to be no more than the maximum DCE speed available in the modem. This means that 95LX users cannot benefit from modem compression. However, they can get the reduced connect time by compressing the file with PKZIP <ON DISK ICON> or DIET <ON DISK ICON> prior to sending it. On the 100LX, DataComm can reliably run no faster than a DTE setting of 19200 bps. An efficient DOS program like fastCOMM! will allow speeds of 38400 bps on the 100LX and 14400 bps on the 95LX.

When using DOS communications programs, the same requirements as discussed in the Printer section apply as to port power. Remember that data communications programs use the interrupt-driven mode and can suffer from the overhead of other programs that are active at the same time. On the 100LX, any DOS program launched from System Manager will suffer due to System Manager's interference with the serial port. This can be prevented by launching the program from Application Manager with an upside down exclamation mark (press (Fn) !) as the first character of the Comments field or by using APLOAD <ON DISK ICON>, AppMAN! (commercial product from ACE Technologies) or ASERCTL <ON DISK ICON>.

Conclusion

In summary, serial communications is without a doubt one of the more complex Palmtop activities, because of its requirements to perform simultaneous tasks and communicate with another device. If you frequently use serial communications in a variety of environments, you may want to get a RS-232 Tester (see Product Index, page 63). You connect it between the two devices and it will quickly allow you to determine whether you have a software, hardware, or cable problem.

Connecting the Palmtop via the serial port to PCs, Printers and Modems