Below is the source code of the function I used (open source) : (from Modbus master C ...
cboard.cprogramming.com