© Norsat International Inc.
(“Norsat”) All Rights Reserved
2022-04-04 908236 Rev C
20
device’s RS-485 address will be ignored. Non-addressed commands will also be ignored by devices with
an RS-485 address between 0 and 6 (inclusive).
Addressed Commands (and their corresponding responses) also include a CRC character immediately
before the terminating <CR> and <LF>. This unsigned 8-bit CRC character can be any value between 0
and 255 (inclusive) and is calculated using the portion of the command string or response string that
precedes the CRC.
The following C code can be used to calculate the CRC:
unsigned char GetCRC(char * szAddressAndCommand)
{
const unsigned char crcTable[16] =
{
0x00, 0x1C, 0x38, 0x24, 0x70, 0x6C, 0x48, 0x54,
0xE0, 0xFC, 0xD8, 0xC4, 0x90, 0x8C, 0xA8, 0xB4
};
unsigned char crc = 0x00;
int numChars = 0;
int i = 0;
if (NULL != szAddressAndCommand)
{
numChars = strlen(szAddressAndCommand);
for (i = 0; i < numChars; i++)
{
crc = ((crc >> 4) & 0x0F) ^
crcTable[(crc & 0x0F)] ^
crcTable[(szAddressAndCommand[i] & 0x0F)];
crc = ((newCRC >> 4) & x0F) ^
crcTable[(crc & x0F)] ^
crcTable[((szAddressAndCommand[i] >> 4) & x0F)];
}
}
return crc;
}
Command Response
The CLI operates on a c response paradigm. Each time a command is entered, a response will
be displayed.
If the device’s RS-485 address is between 0 and 6 (inclusive), the response format will be:
<CR><LF><response><CRC><CR><LF>
If the device’s RS-485 address is 7, the response format is:
<CR><LF><response><CR><LF>