Here is the modbus register Map i find from CHINT

Hi professers, i am trying to read the data from DDSU666-H ( Smart metter) CHINT using modbus RTU, i only get the raw data but i don't know how to convert it to float , in the code below is about Voltage , real data is 233,4V but in the serial is like this, can some one help me to convert this one to float 233,4V, thank you so much! enter image description here

 Here is my code, i get it from modbusmaster library.

  RS485_HalfDuplex.pde - example using ModbusMaster library to communicate
  with EPSolar LS2024B controller using a half-duplex RS485 transceiver.

  This example is tested against an EPSolar LS2024B solar charge controller.
  See here for protocol specs:

  Library:: ModbusMaster
  Author:: Marius Kintel <marius at kintel dot net>

  Copyright:: 2009-2016 Doc Walker

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at


  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  See the License for the specific language governing permissions and
  limitations under the License.


#include <ModbusMaster.h>

  We're using a MAX485-compatible RS485 Transceiver.
  Rx/Tx is hooked up to the hardware serial port at 'Serial'.
  The Data Enable and Receiver Enable pins are hooked up as follows:
#define MAX485_DE      50
#define MAX485_RE_NEG  52

// instantiate ModbusMaster object
ModbusMaster node;

void preTransmission()
  digitalWrite(MAX485_RE_NEG, 1);
  digitalWrite(MAX485_DE, 1);

void postTransmission()
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);

void setup()
  pinMode(MAX485_RE_NEG, OUTPUT);
  pinMode(MAX485_DE, OUTPUT);
  // Init in receive mode
  digitalWrite(MAX485_RE_NEG, 0);
  digitalWrite(MAX485_DE, 0);

  // Modbus communication runs at 115200 baud

  // Modbus slave ID 1
  node.begin(12, Serial1);
  // Callbacks allow us to configure the RS485 transceiver correctly
void loop()
  uint8_t i, result;
  uint16_t data[2];
    uint32_t j;
    float f;
  } u;
  // Read 16 registers starting at 0x3100)
  result = node.readHoldingRegisters(0x2000, 2);
  if (result == node.ku8MBSuccess)
    for (i = 0; i < 2; i++)
      data[i] = node.getResponseBuffer(i);
    u.j = ((unsigned long)data[1] << 16 | data[0]);

  • not a question about Arduino ... it is a general programming question at best
    – jsotola
    Jan 26 at 19:16
  • please remove the picture of text and add the actusl text ... text in a picture cannot be copied for analysis
    – jsotola
    Jan 26 at 19:19
  • you mean " hi professer" text ?
    – HẢI HỒ
    Jan 27 at 13:48
  • no, the printout of the readings ... it should be text, not a picture
    – jsotola
    Jan 27 at 16:23
  • Could you share your wiring between rs485 module and ddsu please ?
    – acca rien
    Jun 21 at 20:08

1 Answer 1


Seems the data sheet does not specify the endianness. Or maybe it does, but you are not showing it. From the numbers you get, it appears that the floats come in big-endian order, whereas your code assumes little-endian.

Change the assignment of u.j as follows:

u.j = ((unsigned long)data[0] << 16 | data[1]);
  • oh,, i actually read voltage register successfully, but with the frequentcy ( 0x200E), it doesn't work , haha
    – HẢI HỒ
    Jan 27 at 13:46
  • Hello expert, why i can't read the frequency and power active register while i can read voltage and current ?
    – HẢI HỒ
    Jan 30 at 14:58
  • @HẢIHỒ: No idea. Check the documentation of your device. Jan 30 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.