[Imported] Read registers as float C++ tools


[Imported] Read registers as float C++ tools

>>Message imported from previous forum - Category:SCADAPack RTU<<
User: mchartrand, originally posted: 2018-10-18 20:17:19 Id:140
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.


Hi all,
I'm working on some program in which I need to read some float values stored in Telepace modbus addresses. I know I can use dbase(MODBUS, Register) to read a 16b register and store it as a Integer, but Is there a function to read directly from the database and obtain a 32b Float?_**


I haven't worked in the Telepace environment, but it looks like what you might want is the databaseRead() instruction.

You could then have

_float f;
INT16* wordAddr = &f;
databaseRead( MODBUS, register1, wordAddr);
databaseRead( MODBUS, register2, wordAddr+1);_

That should populate the appropriate bits of the float as needed (assuming the float is 32bits).

You'd want to test the status of each databaseRead to make sure that they both occurred ok (returned true).


Thanks for your help, I'll try it._**