Communications D - 7Typical CRC-16 Calculation Program in Quick Basiccrcsum# = &HFFFF&crcshift# = &H0&crcconst# = &HA001&CLSPRINT ”*********************************************”PRINTPRINT “ CRC-16 Calculator “PRINTPRINT ”*********************************************”PRINT “If entering data in hex, precede the data with ‘&H’”PRINT “ Example: 32decimal = 20hex = &H20”PRINT ”*********************************************”PRINTINPUT “Enter the number of bytes in the message: “, maxbyteFOR bytenum = 1 TO maxbyte STEP 1PRINT “Enter byte “; bytenum; “:”:INPUT byte&byte& = byte& AND &HFF&crcsum# = (crcsum# XOR byte7) AND &HFFFF&FOR shift = 1 TO 8 STEP 1crcshift# = (INT(crcsum# / 2)) AND &H7FFF&IF crcsum# AND &H1& THENcrcsum# = crcshift# XOR crcconst#ELSEcrcsum# = crcshift#END IFNEXT shiftNEXT bytenumlower& = crcsum# AND &HFF&upper& = (INT(crcsum# / 256)) AND &HFF&PRINT “Lower byte (1st) = “, HEX$(lower&)PRINT “Upper byte (2nd) = “, HEX$(upper&)Typical CRC-16 Calculation Program in C// *buf pointer to character array that contains the characters used to calculate CRC// bufLen number of characters to calculate CRC for// *crc pointer to the array that contains the calculated CRCvoid getMBCRC(cahr *buf, int bufLen, char *crc) {unsigned long crc_0 = 0xffff; // Declare and initialize variablesunsigned long crc_1 = 0x0000;int i,j; for (i=0; i // Loop through characters of input arraycrc_0 ^= ((unsigned long)buf[i] & 0x0ff); // XOR current character with 0x00fffor (j=0;j<8;j++){ // Loop through character bitscrc_1 = (crc_0 >> 1) & 0x7fff; // Shift result right one place and storeif (crc_0 & 0x0001) // if pre-shifted value bit 0 is setcrc_0 = (crc_1 ^ 0xa001); // XOR the shifted value with 0xa001else // if pre-shifted value bit 0 is not setcrc_0 = crc_1; // set the pre-shifted value equal to the shifted value}}crc[0] = (unsigned char)((crc_0/256) & 0x00ff); // Hi bytecrc[1] = (unsigned char)((crc_0 & 0x00ff); // Lo bytereturn; }No Response MessageThe Drive disregards the command message and does not return the response message in the following cases:1. In simultaneous broadcasting of data (slave address field is 0), all slaves execute but do not respond.2. When a communication error (overrun, framing, parity, or CRC-16) is detected in the command message.3. When the slave address in the command message does not coincide with the address set in the slave.4. When the command message data length is not proper.