icom - Program to Control ICOM Receivers and Transceivers


Synopsis

icom [-r radio] [-c channel] [-m mode] [-o offset] [-g frequency] [-d] [-k] [-f file]

Description

This program can be used to control ICOM radio receivers and transceivers with the CI-V option. Most recent ICOM radios already have this option; older radios can be converted with an appropriate adapter mounted inside the radio. The program implements a virtual radio with from 32 to 101 channels corresponding to the memory channels implemented in the particular radio model. Each channel can hold a frequency, mode and, in some radios, a transmit duplex offset (VHF/UHF FM radios only). Most radios support USB, LSB, AM, CW and RTTY modes. Some radios support narrow/wide filters and some support FM modes as well. Additional features that can be controlled on some radios are antenna selection, scan control and tuning step.

The program implements a virtual radio with a bank of memory channels and two VFOs, one corresponding to the main receiver and the other corresponding to the secondary receiver in some radios. The radio is controlled by commands entered from the keyboard or keypad. In these commands, the command name and arguments are case-insensitive. The main VFO frequency, mode and offset is controlled directly by the program. The secondary VFO is controlled by loading from, or exchanging contents with, the main VFO. Commands are provided to select other memory channels and to write the current VFO data to a memory channel.

The program can be controlled in three ways: batch mode, keyboard mode, and keypad mode. In keyboard mode, commands and arguments are entered from the main keyboard following the "icom>" prompt, one command per line, and the complete command set is available. In batch mode, the same commands and arguments are read from the file specified as an option in the command line that starts the program. In keypad mode, commands and arguments are entered from the numeric keypad following the ">" prompt. In this mode, most routine keystrokes use the numeric keypad to enter arguments, and the arguments are followed by a single character representing the command name.

Options on the command line that starts the program can be used to select the radio model and set the frequency and mode. Using a suitably crafted crontab file, it is possible to tune a radio to different frequencies used by a shortwave broadcaster throughout the day, for example. With the minimuf program (available in a separate distribution), it is possible to build shell scripts that predict the most likely frequencies and tune the radio as well.

The program knows about the following radios and modes. New radios can be added to the name[] vector defined in the radio.c file.

Name  Description      ID  Modes
--------------------------------------------------------
271   VHF Transceiver  20  LSB, USB, CW, FM
275   VHF Transceiver  10  LSB, USB, CW, FM
375   VHF Transceiver  12  LSB, USB, CW, FM
471   UHF Transceiver  22  LSB, USB, CW, FM
475   UHF Transceiver  14  LSB, USB, CW, FM
575   VHF Transceiver  16  LSB, USB, CW, FM
725   HF Transceiver   04  LSB, USB, CW, AM, *FM
735   HF Transceiver   28  LSB, USB, CW, AM, *FM
751   HF Transceiver   1c  LSB, USB, CW, AM, *FM
761   HF Transceiver   1e  LSB, USB, CW+, RTTY+, AM+, FM
775   HF Transceiver   46  LSB+, USB+, CW+, RTTY+, AM+, FM
781   HF Transceiver   26  LSB+, USB+, CW+, RTTY+, AM+, FM
1271  UHF Transceiver  24  LSB, USB, CW, FM
R71A  HF Receiver      1a  LSB, USB, CW, RTTY, AM, *FM
R72A  HF Receiver      32  USB, LSB, CW+, RTTY+, AM+, *FM
R7000 VHF/UHF Receiver 08  USB, AM, FM+

Notes: Those radios marked *FM require an optional accessory to receive FM. A plus sign (+) following a mode indicates filters can be selected for wide (w suffix) or narrow (n suffix). Not all radios support all filter combinations. For the R7000, USB selects the radio SSB mode, FMw the radio FM (wideband-FM) mode and FM selects the radio FMn (narrowband-FM) mode. The upper/lower sideband is selected by a switch on the back of the radio. This list has been confirmed only for the 271, 761, 775, R71A, R72A and R7000 radios.

Operation

Most commands and command line options take arguments, although many arguments can be defaulted. Arguments specified as frequency are in fixed-point format in MHz, if less than 1000, and in kHz otherwise. Arguments specified as offset are in fixed-point format in kHz. Arguments specified as step are in integer format in Hz. Arguments specified as mode, take names listed in the above table for the various radios. Note that these names are used consistently; that is, the narrowband FM mode on the 271 corresponds to the narrowband FM mode on an R7000, in spite of the fact the radio controls are labelled differently. Arguments specified as channel refer to any valid memory channel number available in the particular radio. A channel number specified as '.' means the currently selected channel and '$' the highest channel available.

The program exits when command line options are processed and the command line includes any option other than -r, - i or -f. This is designed for use in shell scripts where all functions can be completed using only command line options. Keyboard mode is signalled by the prefix icom>, while keypad mode is signalled by the prefix >. Keyboard and batch commands are terminated by a Enter key on either the keyboard or numeric keypad. Keypad commands are terminated by a special character depending on the command.

A radio must be selected before any command which controls the radio. This can be done using the radio command in either keyboard or batch modes and the -r command line option. The radio cannot be selected in the keypad mode. The radio command can be used at any time to reselect a different radio. The chan command selects the memory channel to use and displays the frequency, mode (and transmit duplex offset where available) stored in that channel. The freq command sets the VFO frequency and optional mode, but does not actually write the memory channel. Likewise, the mode command sets the mode without affecting the frequency. For VHF/UHF radios, the duplex command sets the transmit duplex offset; however, at least with the 271, there appears no obvious means to set the sign of this offset. The write command writes the frequency, mode and offset information to the memory channel, destroying its prior contents. The clear command clears the memory channel for those radios that support it. For those radios that have a secondary (SUB) receiver, e.g., 775, the split command sets the transmit offset, but this cannot be stored in a memory channel.

Most ICOM HF radios tune in 10-Hz steps, while VHF/UHF radios tune in 100-Hz steps for USB/LSB and 15 kHz for AM/FM. The step command can be used to change the default tuning step. Some ICOM radios do not compensate the LO when the mode is changed and the BFO shifted to adjust the passband. This has the effect of detuning the radio by an amount up to 3 kHz, depending on mode. With these radios, the freq command can be used with optional mode argument, in which case the program rewrites the frequency after the mode is set. In the case of transceivers with general-coverage receivers, care should be given to the setting of the GENE-HAM switch. If in the HAM position, it is not possible to change to a frequency outside the ham bands. Since the setting of this switch is saved along with the frequency and mode in a channel and apparently cannot be changed using radio commands, the setting may have to be done manually.

The keyboard mode can be very awkward when searching a band for signals, since a new freq command must be used every time the frequency is changed. The keypad command puts the program in keypad mode and changes the prompt string to ">". In this mode, arguments such as frequency, tuning step, etc., can be entered directly from the keypad. Of course, the keypad must be in Num Lock mode for this to work properly. In keypad mode, the arguments are given first followed by a single character which identifies the command and terminates input.

The easiest way to tune the radio is using the +, -, ENTER, . and digit keys. The frequency is entered directly using the . and digit keys and terminated with the ENTER key. The + and - keys tune up and down the default tuning step selected by the keypad s command; or, if a number is entered prior to the + or - key, that number in Hz replaces the default just for that command. If the ENTER key is pressed with no preceding digits, the current frequency, mode and offset are displayed. With a little practice, it is easy to scan a band (say with 1-kHz steps in USB) looking for signals and, when one is found, change to 100-Hz steps to move closer and then to 10-Hz steps for the final adjustment. With more practice, the final adjustment can be reached with fewer keystrokes by specifying a step in Hz preceding the + or - keys.

When using this program to operate more than one radio that covers the same frequency bands and modes, it may be useful to use a standard set of files, which could be loaded into any of the radios directly from the file. The program includes the capability to save and restore a block of memory channels to and from a file using the save and restore commands. This allows channel blocks to be created by other programs and copied from one radio to another, for example. The information saved in the file includes the frequency, mode and offset. The program can also execute a list of commands stored in a file and interpreted in batch mode. However, it often happens that individual radios need slightly different frequency settings to receive the same frequency transmission, especially when narrow filters are in use. A common example is when selecting from a standard set of frequencies using the minimuf program (described elsewhere) and a Unix cron to automatically tune the radio(s) throughout the day. The keyboard offset command and -o command line option preset a constant frequency offset value to be added to subsequent frequency values as they are transmitted to the radio. Usually, the offset is characteristic of the radio, as the result of BFO frequency error, for example, and can be calibrated manually in advance.

Batch mode is designed for cases where a number of radios are to be cloned or programmed with memory channel data produced by another program. In principle, a Unix shell script could search an archive for the current VOA transmission schedules and transmitter locations, another program determine the propagation model and best frequencies for the receiver location and current time of day, and then program the radio(s) with the results.

Interface Details

The program communicates with one or more radios using the CI-V broadcast bus and serial asynchronous protocol. The CT-17 level converter can be used to interface the CI-V voltage levels (TTL) to EIA (RS-232) levels, or a homebrew unit can be made from the MAX232 IC plus a handful of capacitors. The CT-17 supports up to four radios, but there is no inherent protocol limitation to this number. The CI-V uses active- low drivers with resistor pullups, so multiple radios can be connected to the same wire.

Messages are exchanged in the form of frames beginning with two preamble bytes (0xfe) and ending with one end of message byte (0xfd). In order to handle the older radios, the control program operates at 1200 bps; however, it can be compiled to operate at higher speeds. Each radio model is assigned a unique identifier byte, which can be changed if necessary. The control program sends a frame with that identifier and expects a reply, either containing data or a single ACK (0xfb) or NAK (0xfa). Most functions implemented by the control program require an exchange of several frames.

It has been the experience that some radios can occasionally fail to respond to a command or respond with a mangled frame. Therefore, the control program includes a good deal of error-recovery code and uses timeouts and retransmissions as necessary. Since the CI-V bus uses a broadcast architecture, every octet transmitted by the control program is read back and checked. If the readback fails or no reply is received after three retransmissions, the operation fails and an error message is displayed.

Command Line Options

Following is a list of recognized command line options. Note that, in the case of multiple options, they should be in the order -r, -c, -m, -o, -g, -d, -k and -f.

-r name
Select the radio with identifier name. See above for a list of radio names and modes currently supported.

-c channel
Select the memory channel channel and set the radio frequency, mode and offset to its contents.

-m mode
Set the radio mode to mode. See above for a list of mode names valid for various radios. The mode names are specific to each radio type; not all radios support the same modes.

-o offset
Set the frequency offset for the following -g option to offset kHz.

-g frequency
Set the radio frequency to frequency in MHz if less than 1000 and in kHz otherwise.

-d
Display the current radio frequency, mode and offset. This is designed for use in shell scripts to confirm or log the results.

-k
Begin program operation in keypad mode.

-f filename
Read commands from the file filename.

Keyboard and Batch Commands

Following is a list of commands recognized in keyboard and batch modes. Note that the radio command must be given before any command, other than debug or quit. Other than this, there are no restrictions on the order of these commands. The commands recognized in batch mode are any that are recognized in keyboard mode, except the pad command, which puts the program in keypad mode.

ant [ antenna ]
Select the antenna number antenna. If antenna is missing, use antenna number 1.

chan [ channel ]
Select the memory channel channel and set the main VFO frequency, mode and offset to its contents. If channel is missing, use the value 1. This is the same function as the keypad c command and the channel selection buttons or knobs on the radio.

clear [ channel ]
Clear the memory channel channel. If channel is missing, use the current memory channel. This is the same function as the keypad x command and the CLEAR button on the radio.

debug level
Set the debug level. A level of 0 disables debugging, 1 enables CI-V protocol diagnostics; a level of 2 turns on the packet trace.

down [ step ]
Shift the current frequency down step Hz. If step is missing, use the latest value specified in the tune keyboard command or keypad t command. This is the same function as the keypad - command.

duplex [ offset ]
Set the transmit duplex offset for ICOM VHF/UHF transceivers to offset kHz. It is not clear how to set the +-DUPLEX switch.

equal
Set the secondary VFO frequency to the main VFO frequency. This is the same function as the keypad = command and the EQUAL button on the radio. Note: This command works only in split or watch modes.

freq frequency [ mode ]
Set the operating frequency to frequency, adjusted for the offset selected by the offset command, and optional mode. Note: In some ICOM radios it is not possible to set the frequency of the last channel less than that of the next-to-last channel. Presumably, this is to avoid abusing the internal scan feature of the radio.

mode [ mode ]
Set the operating mode to mode. See above for a list of mode names valid for various radios. The mode names are specific to each radio type; not all radios support the same modes.

offset [ offset ]
Set the frequency offset for following freq commands to offset kHz.

quit
Exit the program and return control to the shell.

radio [ name ]
Select the radio for further commands and displays the radio description and upper and lower band limits. This must be the first command in keyboard or batch modes. If name is missing, the description and band limits of the current selection are displayed.

restore file [ first ] [ last ]
Restore the block of memory channels numbered from first to last, inclusive, from the named file, or until the end of file. If last is missing, restore only the channel number first. If both first and last are missing, restore all memory channels from channel 1 to the highest channel number, or until the end of file.

save file [ first ] [ last ]
Save the block of memory channels numbered from first to last, inclusive, to the named file. If last is missing, save only the channel number first. If both first and last are missing, save all memory channels from channel 1 to the highest channel number. Note that cleared memory channels are not saved.

split [ split ]
Set the secondary (SUB) VFO frequency to split kHz from the main VFO frequency. The transmitter will send on the secondary VFO frequency; the receiver will continue to listen on the main VFO frequency. This is the same function as the keypad s command.

step [ step ]
Set the default frequency tuning step used by the up and down keyboard commands and + and - keypad commands to step. If step is missing, use the standard tuning step of the radio. This is the same function as the keypad s command.

swap
Exchange the secondary (SUB) VFO frequency and the main VFO frequency. This is the same function as the keypad swap command and the CHANGE button on the radio. Note: This command works only in split or watch modes.

up [ step ]
Shift the current frequency up step Hz. If step is missing, use the latest value specified in the keyboard tune command or keypad t command. This is the same function as the keypad + command.

watch [ON | OFF]
Set the dual watch function ON or OFF. If missing, set the function OFF.

write [ channel ]
Write the current frequency, mode and offset to memory channel channel. If channel is missing, use the current memory channel. This is the same function as the keypad w command and the WRITE button on the radio.

Keypad Commands

Following is a list of commands recognized in keypad mode. There are no restrictions on the order of these commands.

#
Erase the current keypad input as if it had never been entered.

[step]+
Shift the current frequency up step Hz. If step is missing, use the latest value specified in the keyboard tune command or keypad t command. This is the same function as the keyboard up command.

[step]-
Shift the current frequency down step Hz. If step is missing, use the latest value specified in the keyboard tune command or keypad t command. This is the same function as the keyboard down command.

/
Exchange the secondary (SUB) VFO frequency and the main VFO frequency. This is the same function as the keyboard swap command and the CHANGE button on the radio. Note: This command works only in split or watch modes.

=
Set the secondary (SUB) VFO frequency to the main VFO frequency. This is the same function as the keyboard equal command and the EQUAL button on the radio. Note: This command works only in split or watch modes.

a
Select the antenna number antenna. If antenna is missing, use antenna number 1.

[channel]c
Select the memory channel channel and set the main VFO frequency, mode and offset to its contents. If channel is missing, use the value 1. This is the same function as the chan keyboard command and the channel selection buttons or knobs on the radio.

[frequency]f
Set the current frequency to frequency. The Enter key on the keypad or keyboard can be used as a shortcut for the f keyboard key. If frequency is missing, the current frequency, mode and offset are displayed.

m
Toggle the antenna selection sequentially through the modes USB, LSB, RTTY, AM and FM using standard filters.

q
Exit keypad mode and return to keyboard mode.

[split]s
Set the secondary (SUB) VFO frequency to split kHz from the main VFO frequency. The transmitter will send on the secondary VFO frequency; the VFO will continue to listen on the main VFO frequency. This is the same function as the keyboard split command.

[step]t
Set the default frequency tuning step used by the up and down keyboard commands and + and - keypad commands to step. If step is missing, use the standard tuning step of the radio. This is the same function as the keyboard step command.

[channel]w
Write the current frequency, mode and offset to memory channel channel. If channel is missing, use the current memory channel. This is the same function as the keyboard write command and the WRITE button on the radio.

[channel]x
Clear the memory channel channel. If channel is missing, use the current memory channel. This is the same function as the keyboard clear command and the CLEAR button on the radio.

History

Written by David L. Mills, W3HCF; this update 25 September 1996.

Bugs

This is a work in progress. Many idiosyncrasies of various ICOM radios remain to be discovered.


David L. Mills (mills@udel.edu)