crc16 supplied code

Your code is correct. You just aren't passing the correct parameters to it.