### 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 that depends on the radio model. Other than this, there are no restrictions on the order of these commands. Note that several commands shown on the `?` help billboard, but not documented here, have not been tested.

A command line consists of a string of keyword/argument subcommands executed in order from left to right. Subcommands take on zero, one or more arguments. If the subcommand is the last one on the command line and with no arguments, the general behavior is to display some program or internal radio value. In general, a question mark ? argument invokes a context-sensitive help menu giving all the valid arguments. If one or two arguments, the general behavior is to set some program or internal radio value. Due to variations in the many ICOM radio models, not all the values work in all radios. In such cases use of an unsupported value results in a "radio doesn't do that" message.

Following are the basic commands to control the radio, select the operating mode and control various basic functions. The command parser is designed for easy access to the most often used functions, such as changing the frequency or mode. When processing the next subcommand in the command line, the parser first looks up the function in the help menu and executes it if found. Next, it determines if the token is a valid frequency and sets the radio frequency if it is. Numbers below 1000 are interpreted in MHz, while those above 1000 are interpreted in kHz. If not a valid frequency, the parser looks up the mode in the help menu and sets it if found. If not found, the parser ignores it and displays an error message.

#### Program Commands

`radio [ name ]`
  Select and initialize the name radio listed on the help menu and display its capabilities, including the upper and lower band limits, number of memory banks and number of memory channels per bank. This must be the first command in keyboard or batch modes. Upon selection the program inspects the radio to set various default options and reads the first memory channel. Note that some ICOM transceivers support noncontiguous band limits, such as .03-200 MHz and 400-470 MHz for the 7000. The band limits displayed depend on which frequency range is active when the radio is selected. If no radios have been selected and no name is present, scan the CI-V bus for all known radios and select any and all that are present. This is useful when multiple radios are in use and for testing. If a radio has been selected and no name is present, display the capabilities of the current selection.
`quit`
  Exit the program and return control to the shell.
`include` file
  Read commands from file until the end of file. Files can be nested up to 20 levels.
`pad`
  Switch to keypad mode.
`trace` function
  Select the CI-V bus trace function from the list on the help menu. The `trace all` command displays each CI-V command and response in hex, with prefix `T:` for packets to the radio and `R:` for packets from the radio.
`dump`
  Dump the current VFO frequency, mode, duplex and tone settings in hex. Dump related channel data, including the dial step and programmed dial step for the R8500 receiver.
`verbose on | off ]`
  Select the verbose mode from the list on the help menu.

#### Basic Control Commands

`mode` [ mode ]
  Select one of the mode/filter combinations listed on the help menu. If no argument is given, report the current selection. For most radio models the mode selection includes a filter selection of wide, medium and narrow.
`duplex` [ offset ]
  Set the offset of the transmit duplex offset register. Modern transceivers have duplex offset registers for HF, 50 MHz, 144 MHz and 420 MHz bands. In order to read and write these registers, the frequency must be first set within the correct band.
`bank` [ bank [ name ] ]
  Set the current bank number and optional bank name. If no arguments are present, report the current bank number and name. So far as known, this works only on the R8500.
`tx`
  Place the transceiver in the transmit configuration.
`rx`
  Place the transceiver in the receive configuration.
`ptt [ on | off ]`
  With no argument the status of the transceiver is reported as `on` if transmitting and `off` otherwise. With one argument the transmitter is switched on or off.
`utc`
  Set the transceiver year, date and time to the current Universal Coordinated Time (UTC) of the host operating system. The 7000 and 7800 can set the year, date and time. The 756 can set the time, but not the year and date.

#### Memory Management Commands

The following commands are used to read, write and empty (clear) memory channels and transfer memory contents to and from frequency (text) files. They take the argument range defining a single channel or range of channels that might be in the same or different banks. The channel notation used is represented `b.c`, where `b` is the bank number and `c` the channel number. For radios without banks, including the 706G and 756, the bank number is not used. A range of channels is represented by `b1.c1:b2.c2`. When spanning different banks, channels wrap from the last channel in one bank to the first channel in the next higher bank and vice versa. In addition, the channels wrap from the last channel in the radio to the first channel and vice versa. Numbering always goes from the first channel to the second channel number in either direction as indicated.

Various defaults apply in order to simplify operation. For instance, a `chan`, `write` or `empty` command with no arguments applies to the last selected bank and channel. When multiple banks are available, a channel number with no bank number applies to the last selected bank. The dollar sign $ replacing a bank or channel number applies to the entire range of banks or channels. For instance, a `$:$` represents the entire contents of the memory array.

Additional subcommands can appear on these commands when certain features are selected and available. These include the `name`, `split`, `tone`, `tsql`, `dtcs` and, in the R8500, `atten`, `step`, `pstep` and `scan`. These subcommands are useful when channels are read from the radio, written to a file or read from a file.

`save` range file
  Save the block of memory channels in range to file. Note that empty memory channels are not saved.
`restore` range file
  Restore the block of memory channels in range from file. If range is the single character *, restore the channels using the bank and channel number on each line of the file. Otherwise, renumber the channels as indicated by range.
`chan` [ range ]
  Read the block of memory channels in range.
`write` [ range ]
  Write the block of memory channels in range. Include the frequency, mode and other data available in the radio.
`empty` [ range ]
  Empty (clear) the block of memory channels in range. If range is missing, empty the last channel selected.

#### Switches, Controls and Meters

These commands are used to inspect and change the various switches, controls and meters available in the radio. As each radio is different, not all commands work with all radios. By convention, a subcommand with no argument displays a menu of all functions that work with the particular radio, while a subcommand with one argument ? displays a help menu of all arguments along with a short description of the function.

`set` [ switch [ value ] ]
  Display or set internal radio switches. A `set` with one argument switch displays the current value of that switch, but does not change its value. A `set` with two arguments switch and value sets the designated switch to the given value. Most switches take on names of only off or on, but some like `agc` and `break` can take on multiple values.
`ctl` [ control [ value ] ]
  Display or set internal radio controls. A `ctl` with one argument control displays the current value of that control, but does not change its value. A `ctl` with two arguments control and value sets the designated control to the given value. Note that those controls involving frequency take signed values over the range -128 to 127 inclusive, while others not involving frequency take values over the range 0 to 255 inclusive.
`meter` [ meter ]
  Display the internal radio meters. A `meter` with one argument meter displays the current value of that meter. The displayed values for most meters take on values in the range 0 to 255 inclusive. However, the signal (S) meter is calibrated in S units and dB above S9.

#### VFO and Memory Channel Operation

Modern ICOM transceivers have two VFOs, called VFO A (or main VFO) and VFO B (or sub VFO). VFO A is ordinarily used for transmitting and receiving, but in split mode VFO A is used for receiving and VFO B for transmitting. A `vfo swap` command interchanges the contents of VFO A and VFO B. On the 706G and 7000 a `vfo a` command shows VFO A on the main display and VFO B on the sub display. A `vfo b` command shows VFO B on the main display and VFO A on the sub display. A `vfo btoa` command copies the contents of VFO B to VFO A. The 706G and 7000 can't do any of the other `vfo` commands.

On the 756 the main display is at the top in large bright font, while the sub display is at the bottom in small dim font. Ordinarily, updates from the panel controls and this program go to VFO A. A `split sub` command switches updates to VFO B, while a `split main` command switches back to the main VFO. A `vfo equal` command copies the contents of the main VFO to the sub VFO. The `vfo watch` and `vfo nowatch` turn the dual-watch function on and off.

ICOM transceivers can be switched to operate in either VFO or MEMO mode. In VFO mode the main display shows the frequency, mode and associated memory channel number. The frequency, mode, filter selection and other data can be changed by front panel controls and this program. The current VFO contents can be saved in a memory channel and recalled later. In VFO mode selecting a memory channel does not automatically transfer the contents to the VFO; however, this program does this with the `read` and `restore` commands.

In MEMO mode the memory channels are used directly. A `read` command automatically transfers the memory channel contents to the main VFO. While the VFO and MEMO modes can be selected by front panel controls, there are no explicit means to do this with the CI-V command set. Ordinarily, and to support memory channel operations like `write` and `empty`, MEMO mode is required. However, once one of the VFO subcommands is used, the radio switches to VFO mode. There appears no way with CI-V commands to switch back to MEMO mode.

`split` offset | subcommand
  If offset is present and a valid floating-point number preceded by a "+" or "-", set the transmit frequency offset to the value in kHz and turn the split function on. If no "+" or "-", set the transmit frequency directly in MHz and turn the split function on. If subcommand is present, execute one of the subcommands listed on the help menu.
`swap`
  If VFO A is selected, switch to VFO B. Further frequency and mode settings apply to VFO B. If VFO B is selected, switch to VFO A. Further frequency and mode settings apply to VFO A. This is the same function as the `split swap` subcommand and is most useful in keypad mode.
`vfo` subcommand
  Execute one of the subcommands listed on the help menu.

#### Radio Control and Status Commands

Various transceivers and receivers have idiosyncratic means to control the preamps and attentuators. In the R8500 the attentuator and tuning step information are saved along with the frequency and mode in a memory channel. In modern transceivers the preamp and attenuator values selected for each band are saved in nonvolatile registers for each band separately.

These commands are used to set and display various internal functions such as AGC time constant, antenna selection, etc. By convention, a command with no argument displays a menu of all subcommands that work with the particular radio, while a command with one argument ? displays a help menu of all subcommands along with a short description of the function.

`agc` time_constant
  Select one of the AGC time constants listed on the help menu. Some radios do not support this command. For the R8500 use the `set agcfast` or `set agcslow` commands. In FM modes all radios use the fast setting and cannot be overridden by command.
`ant` [ antenna ]
  Select one of the antennas listed on the help menu. In some radios like the 756, one of two antennas can be selected for transmitting and receiving and a third for receiving only.
`atten` [ dB ]
  Select one of the attenuator dB listed on the help menu. Not all radios support all dB values shown; the 706G supports only 0 and 20 dB, the 7000 only 0 and 12 dB, the 756nand 775 only 0, 6, 12, and 18 dB and the R8500 0, 10, 20 and 30 dB.
`preamp` [ function ]
  Select one of the preamp functions listed on the help menu. The 706G and 7000 support one preamp, the 756 two preamps and R8500 no preamps.
`break` [ function ]>
  Select one of the break functions listed on the help menu.
`key` channel [ text ]
  Select the CW memory channel channel. If no text argument is present, report the current contents; otherwise replace the contents with the text.
`say [ code ]`
  Select one of the announce functions listed on the help menu. If no argument is given, announce the S-meter reading, frequency and mode.

#### Tuning Rate and Step Commands

These commands set the radio dial tuning step and the variable tuning steps used in keypad mode. The `dial` and `scan` functions are provided by the radio, while the `rate` and `step` commands provide software control for the keypad tuning functions.

`dial` [ code ]
  Select one of the main dial tuning step listed on the help menu. If no argument is given, report the current selection. While most radios support only the values listed, the R8500 supports programmed steps between 0.5 kHz and 199.5 kHz in steps of 0.5 kHz.
`scan` [ code ]
  Select the scan mode, where the argument corresponds to a member on the help menu. These have not been tested.
`band` [ lowfreq ] [ highfreq ]
  Set the low and high band edges for step-scanning. If stepped above the high band edge, the frequency is set to the low band edge. If stepped below the low band edge, the frequency is set to the high band edge.
`rate [ rate ]`
  Set the initial tuning rate used in keypad mode by the `LEFT` and `RIGHT` keyboard arrow keys.to a value between 0 and 12 corresponding to rates from 1 Hz in increasing 1-2.5-5 multiples to the maximum 5 MHz. Whether or not the argument is present, report the current frequency, mode, rate and step values.
`step` [ step ]
  Set the tuning step used in keypad mode by the `UP` and `DOWN` keyboard arrow keys. The step value does not have to conform to the steps available with the `dial` command and can be any value as long as the resulting frequency is valid for the radio.

#### Tone Commands

Modern ICOM transceivers include provisions for repeater tone and tone squelch (CTSS), and digital tone squelch (DTCS) functions used to access repeaters. At the moment, the only radio verified to support all three tone functions is the 7000. The 756 supports only the tone and tone squelch functions. The 706G tone functions cannot be programmed via CI-V commands.

The CTSS uses discrete analog frequencies in the range 67.0-254.1 Hz as shown by the `tone ?` and `tsql ?` commands. The DTCS uses discrete digital codes 023-754, as shown by the `dtcs ?` command. The DTCS codes are augmented by `-NN`, where the first `N` ndicates normal transmit polarity and the second `N` indicates normal receive polarity. The `N` for normal polarity can be replaced by `R` for reverse polarity.

All three of the following commands work the same way. A command with no arguments reports the tone status (on or off) and tone code. An argument `on` turns the function on and argument `off` turns it off. An argument matching one of the help menu selections sets that tone code and turns the function on.

`tone on | off |` frequency
  Turn the repeater tone function on or off or select the frequency from the list on the help menu.
`tsql on | off |` frequency
  Turn the tone squelch function on or off or select the frequency from the list on the help menu.
`dtcs on | off |` code
  Turn the digital tone squelch function on or off or select the code from the list on the help menu.

#### Frequency Compensation Commands

These commands can provide software compensation for VFO and BFO frequency errors. Older radios generate LO frequencies from a single VFO synthesizer and generate BFO frequencies using a VCXO separately for each mode. Modern radios generate all LO and BFO frequencies from a single VFO synthesizer. The `vfocomp` command corrects for the VFO frequency error, while the `bfocomp` command corrects for the BFO frequency error in each mode.

Where all frequencies are synthesized from a common VFO, the calibration procedure is simple using a single WWV/H frequency. With keyboard commands, tune to the highest available WWV/H frequency in USB mode and note the beat note of the 500/600-Hz modulation tone, then switch to LSB mode and note the beat note. Use the `vfocomp` command to set the VFO compensation and retune the radio to implement it. Repeat as necessary until the beat notes are the same. Using this technique, it is readily possible to compensate within 0.1 PPM.

When the BFO frequencies are synthesized by a VCXO separately for each mode a different technique is necessary involving two WWV/H frequencies. As before, tune to the highest available frequency in USB mode and note the beat note. Then, retune to the lowest available WWV/H frequency and note the beat note. Use the `vfocomp` command to set the VFO compensation and retune the radio to implement it. Repeat as necessary between the highest and lowest frequencies until the beat notes are the same. This completes the VFO compensation.

The BFO compensation must be done for each mode separately, although usually only the USB and LSB modes are required. Using any available WWV/H frequency, note the difference between the 500/600-Hz modulation tones in AM mode and either USB or LSB mode. Adjust the USB and LSB BFO compensation so all three beat notes are the same.

`vfocomp` [ offset ]
  If the argument offset is present, set the VFO frequency correction to the value specified in PPM. If not, display the current frequency and value.
`bfocomp` [ offset ]
  If the argument offset is present, set the BFO frequency correction to the value specified in Hz for the current mode. If not, display the current frequency and value.