STM/Modbus/Baremetal/UART_RS485_Modbus_Slave/Source/Modbus/Slave/Modbus_Slave.c
void AppendCRCtoMBRegister(unsigned char packtop)//crc is calculated from slave id to last data byte
{
	unsigned short crcvalue = 0;
	crcvalue = CRC16(data_in, packtop);
	data_in[packtop] = (unsigned char) (crcvalue);//lower byte at higher register
	data_in[packtop + 1] = (unsigned char) (crcvalue >> 8);	//higher byte at lower register
	ResponseFrameSize = packtop + 2;
}
/*************** Append CRC ***************/
//C function to append CRC to Slave Modbus response PDU

Append CRC
C function to append CRC to Slave Modbus response PDU
Append CRC C function to append CRC to Slave Modbus response PDU
void AppendCRCtoMBRegister(unsigned char packtop)
{
	unsigned short crcvalue = 0;
	crcvalue = CRC16(data_in, packtop);
	data_in[packtop] = (unsigned char) (crcvalue);
	data_in[packtop + 1] = (unsigned char) (crcvalue >> 8);	
	ResponseFrameSize = packtop + 2;
}
void AppendCRCtoMBRegister ( unsigned char packtop ) { unsigned short crcvalue = 0 ; crcvalue = CRC16 ( data_in , packtop ) ; data_in [ packtop ] = ( unsigned char ) ( crcvalue ) ; data_in [ packtop + 1 ] = ( unsigned char ) ( crcvalue >> 8 ) ; ResponseFrameSize = packtop + 2 ; }
Append CRC
C function to append CRC to Slave Modbus response PDU
Append CRC C function to append CRC to Slave Modbus response PDU
//crc is calculated from slave id to last data byte
 //lower byte at higher register
 //higher byte at lower register
