I am using Nodemcu for coding purpose. I need method of read data in correct format. I have connected modbus output to nodeMCU .
I could able to read response from salve device . only need to do typecast result.
the output i used to 32bit floating type. How can i convert these value to float type
when i change the value to unsigned Decimal showing properly . But i need to display value in 32 bit floating point
example code
// Define one address for reading
#define address 1
// Define the number of bits to read
#define bitQty 70
void setup()
{
Serial.begin(9600);
// Initialize Modbus communication baud rate
node.begin(9600);
}
void loop()
{
int result = node.readHoldingRegisters(address, bitQty);
data[0] = (float) node.getResponseBuffer(0);
data[1] = (float)node.getResponseBuffer(1);
data[2] = (float)node.getResponseBuffer(2);
data[3] = (float) node.getResponseBuffer(3);
data[4] = (float) node.getResponseBuffer(4);
data[5] = (float)node.getResponseBuffer(5);
for (int i = 0; i < 100; i++)
{
//data[i] = node.getResponseBuffer(i);
Serial.println(data[i]);
}
Serial.println("............");
}
The modbus library its using might be giving 8 bit register value. if we writing our own code i could save my value like in format #3 then combine and display parameter.But here library developed by 3rd party & its working well.only
in this format
uint16_t getResponseBuffer(uint8_t);
I wanted to get result in
float format.So that i could display my result like atleast in modscan32 format
that means i need to change the library then?? double getResponseBuffer(float);
Is there any library which give out output in floating point