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).
0xFE | 0xFE | to-adr | fm-adr | ... | 0xFD |
Each frame starts with two 0xFE values and ends with one 0xFD value. The definition of the CI-V protocol does not allow these (and other) byte values to show up within the frame.
0xFE | 0xFE | to-adr | fm-adr | ... | 0xFD |
Each message must contain a to-adress (destination) and a from-adress (source). More on adressing issues in the next chapter.
0xFE | 0xFE | to-adr | fm-adr | ... | 0xFD |
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.
0xFE | 0xFE | to-adr | fm-adr | cmd | 0xFD |
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.
0xFE | 0xFE | to-adr | fm-adr | cmd | data | data | data | data | data | 0xFD |
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:
0xFE | 0xFE | to-adr | fm-adr | 0xFB | 0xFD |
0xFE | 0xFE | to-adr | fm-adr | 0xFA | 0xFD |
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 0xFB for Ok and 0xFA for Not-Good can be easily memorized: ‘FB’ is a common abbreviation in CW code meaning fine business, or all ok. 0xFA 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 (binary coded decimal) data. Values below 100 would use only one byte, values from 100 to 255 two bytes.
Example: Response to read S-meter value, the value returned is 253.
0xFE | 0xFE | 0xE0 | 0x4A | 0x15 | 0x02 | 0x02 | 0x53 | 0xFD |
Example: Response to read S-meter value, the value returned is 85.
0xFE | 0xFE | 0xE0 | 0x4A | 0x15 | 0x02 | 0x85 | 0xFD |
Collisions on the bus
Due to the single-wire nature of the classic CI-V bus interface, collisions can occur. This happens when two or more devices 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:
0xFC | 0xFC | 0xFC | 0xFC | 0xFC |
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, a collision has occured. 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.