3. General command structure
All commands to and from the rig have a fixed frame, variable length format as follows (one box is one byte).
The general framing structure applies to all CI-V messages, from computer to rig and vice versa. It contains commands of various length (one, two or three bytes), with or without data (null up to 50+ bytes). The only exception to this frame format is the collision detect signal (see bottom of page).
Each frame starts with two $FE values and ends with one $FD value. The definition of the CI-V protocol does not allow these byte values to show up within the frame.
Each message must contain a to-adress (destination) and a from-adress (source). More on adressing issues in the next chapter.
The following message contains a single byte command without data. Other commands can be longer, up to three bytes. The Icom manual calls these additional bytes subcommands.
The next message shows a command with data. The length of the data (how many bytes follow) depends on the command and varies from one to more than 200 bytes.
Many (not all) commands can be issued with or without data. The effect is this:
- Sending a command with data sets the value
- Sending the same command without data reads the value
Responses from the rig
Good or No-Good response
Most commands yield a response, either the data which was requested (e.g. a memory contents) or are responded simply by the rig with a Ok or NG (Not Good) response. Only two commands ($00, $01) yield no response at all (see command table).
The Ok response (indicating success) and NG response (indicating an error) have the following format:
A NG response is usually the result of a command not understood by the rig. Specific reasons for a NG response are:
- Frequency out of range (not supported by rig)
- Memory number out of range
- Command not implemented
- Mem to VFO transfer command $0A on an empty channel
The actual byte values of $FB for Ok and $FA for Not-Good can be easily memorized: 'FB' is a common abbreviation in CW code meaning fine business, or all ok. $FA could be interpreted as FAilure.
Response with data
Be aware that responses can vary in length depending on the value returned. For example when a decimal value of zero to 255 can be returned it is represented in either one or two bytes as BCD data. Values below 100 would use only one byte, values from 100 to 255 two bytes.
Example: Response to read S-meter value, the current value is 253.
Example: Response to read S-meter value, the current value is 85.
Collisions on the bus
Due to the single-wire nature of the CI-V bus, collisions can occur. This happens when two or more rigs (or rig and controller) try to to send a message at the same time. This condition is rare, but can happen. Once a collision is detected by either party on the bus the collision detect signal is sent by the device detecting the collision:
Again due to the nature of the single-wire bus a sending device immediately receives the echo of the message sent. This can be used as a mechanism to detect collision, when the received data is not the same as the data sent. In this case the sending device must abort transmitting the message and send the 'jammer' code as above. After detecting silence on the bus the aborted message shall be repeated.
For a device currently not actively sending a message but receiving the jammer code, no action needs to be taken, it can just wait for the re-transmission of the failed message.