Просмотр исходного кода

Documentation of modbus get float functions

Stéphane Raimbault 10 лет назад
Родитель
Сommit
17be598866

+ 3 - 3
doc/modbus_get_float.txt

@@ -17,9 +17,9 @@ replaced by *modbus_get_float_dcba()*.
 DESCRIPTION
 -----------
 The *modbus_get_float()* function shall get a float from 4 bytes in Modbus
-format (ABCD order). The _src_ array must be pointer on two 16 bits values, for
-example, if the first word is set to 0x4465 and the second to 0x229a, the float
-value will be 916.540649.
+format (DCBA byte order). The _src_ array must be a pointer on two 16 bits
+values, for example, if the first word is set to 0x4465 and the second to
+0x229a, the float value will be 916.540649.
 
 
 RETURN VALUE

+ 39 - 0
doc/modbus_get_float_abcd.txt

@@ -0,0 +1,39 @@
+modbus_get_float_abcd(3)
+========================
+
+
+NAME
+----
+modbus_get_float_abcd - get a float value from 2 registers in ABCD byte order
+
+
+SYNOPSIS
+--------
+*float modbus_get_float_abcd(const uint16_t *'src');*
+
+
+DESCRIPTION
+-----------
+The *modbus_get_float_abcd()* function shall get a float from 4 bytes in usual
+Modbus format. The _src_ array must be a pointer on two 16 bits values, for
+example, if the first word is set to 0x0020 and the second to 0xF147, the float
+value will be read as 123456.0.
+
+
+RETURN VALUE
+------------
+The function shall return a float.
+
+
+SEE ALSO
+--------
+linkmb:modbus_set_float_abcd[3]
+linkmb:modbus_get_float_dcba[3]
+linkmb:modbus_get_float_badc[3]
+linkmb:modbus_get_float_cdab[3]
+
+
+AUTHORS
+-------
+The libmodbus documentation was written by Stéphane Raimbault
+<stephane.raimbault@gmail.com>

+ 40 - 0
doc/modbus_get_float_badc.txt

@@ -0,0 +1,40 @@
+modbus_get_float_badc(3)
+========================
+
+
+NAME
+----
+modbus_get_float_badc - get a float value from 2 registers in BADC byte order
+
+
+SYNOPSIS
+--------
+*float modbus_get_float_badc(const uint16_t *'src');*
+
+
+DESCRIPTION
+-----------
+
+The *modbus_get_float_badc()* function shall get a float from 4 bytes with
+swapped bytes (BADC instead of ABCD). The _src_ array must be a pointer on two
+16 bits values, for example, if the first word is set to 0x2000 and the second
+to 0x47F1, the float value will be read as 123456.0.
+
+
+RETURN VALUE
+------------
+The function shall return a float.
+
+
+SEE ALSO
+--------
+linkmb:modbus_set_float_badc[3]
+linkmb:modbus_get_float_abcd[3]
+linkmb:modbus_get_float_dcba[3]
+linkmb:modbus_get_float_cdab[3]
+
+
+AUTHORS
+-------
+The libmodbus documentation was written by Stéphane Raimbault
+<stephane.raimbault@gmail.com>

+ 39 - 0
doc/modbus_get_float_cdab.txt

@@ -0,0 +1,39 @@
+modbus_get_float_cdab(3)
+========================
+
+
+NAME
+----
+modbus_get_float_cdab - get a float value from 2 registers in CDAB byte order
+
+
+SYNOPSIS
+--------
+*float modbus_get_float_cdab(const uint16_t *'src');*
+
+
+DESCRIPTION
+-----------
+The *modbus_get_float_cdab()* function shall get a float from 4 bytes with
+swapped words (CDAB order instead of ABCD). The _src_ array must be a pointer on
+two 16 bits values, for example, if the first word is set to F147 and the second
+to 0x0020, the float value will be read as 123456.0.
+
+
+RETURN VALUE
+------------
+The function shall return a float.
+
+
+SEE ALSO
+--------
+linkmb:modbus_set_float_cdab[3]
+linkmb:modbus_get_float_abcd[3]
+linkmb:modbus_get_float_dcba[3]
+linkmb:modbus_get_float_badc[3]
+
+
+AUTHORS
+-------
+The libmodbus documentation was written by Stéphane Raimbault
+<stephane.raimbault@gmail.com>

+ 6 - 3
doc/modbus_get_float_dcba.txt

@@ -15,9 +15,9 @@ SYNOPSIS
 DESCRIPTION
 -----------
 The *modbus_get_float_dcba()* function shall get a float from 4 bytes in
-inversed Modbus format (DCBA order instead of ABCD). The _src_ array must be
-pointer on two 16 bits values, for example, if the first word is set to 0x9a22
-and the second to 0x6544, the float value read will be 916.540649.
+inversed Modbus format (DCBA order instead of ABCD). The _src_ array must be a
+pointer on two 16 bits values, for example, if the first word is set to 0x47F1
+and the second to 0x2000, the float value will be read as 123456.0.
 
 
 RETURN VALUE
@@ -28,6 +28,9 @@ The function shall return a float.
 SEE ALSO
 --------
 linkmb:modbus_set_float_dcba[3]
+linkmb:modbus_get_float_abcd[3]
+linkmb:modbus_get_float_badc[3]
+linkmb:modbus_get_float_cdab[3]
 
 
 AUTHORS

+ 3 - 3
src/modbus-data.c

@@ -114,7 +114,7 @@ float modbus_get_float_abcd(const uint16_t *src)
     return f;
 }
 
-/* Get a float from 4 bytes (Modbus) with byte and word swap conversion (DCBA) */
+/* Get a float from 4 bytes (Modbus) in inversed format (DCBA) */
 float modbus_get_float_dcba(const uint16_t *src)
 {
     float f;
@@ -126,7 +126,7 @@ float modbus_get_float_dcba(const uint16_t *src)
     return f;
 }
 
-/* Get a float from 4 bytes (Modbus) with byte swap conversion (BADC) */
+/* Get a float from 4 bytes (Modbus) with swapped bytes (BADC) */
 float modbus_get_float_badc(const uint16_t *src)
 {
     float f;
@@ -138,7 +138,7 @@ float modbus_get_float_badc(const uint16_t *src)
     return f;
 }
 
-/* Get a float from 4 bytes (Modbus) in the format CDAB */
+/* Get a float from 4 bytes (Modbus) with swapped words (CDAB) */
 float modbus_get_float_cdab(const uint16_t *src)
 {
     float f;