Commit 17be59886612e1ab28b35d84c1548587555c1ea3
1 parent
08ed259f
Documentation of modbus get float functions
Showing
6 changed files
with
130 additions
and
9 deletions
doc/modbus_get_float.txt
| ... | ... | @@ -17,9 +17,9 @@ replaced by *modbus_get_float_dcba()*. |
| 17 | 17 | DESCRIPTION |
| 18 | 18 | ----------- |
| 19 | 19 | The *modbus_get_float()* function shall get a float from 4 bytes in Modbus |
| 20 | -format (ABCD order). The _src_ array must be pointer on two 16 bits values, for | |
| 21 | -example, if the first word is set to 0x4465 and the second to 0x229a, the float | |
| 22 | -value will be 916.540649. | |
| 20 | +format (DCBA byte order). The _src_ array must be a pointer on two 16 bits | |
| 21 | +values, for example, if the first word is set to 0x4465 and the second to | |
| 22 | +0x229a, the float value will be 916.540649. | |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | RETURN VALUE | ... | ... |
doc/modbus_get_float_abcd.txt
0 → 100644
| 1 | +modbus_get_float_abcd(3) | |
| 2 | +======================== | |
| 3 | + | |
| 4 | + | |
| 5 | +NAME | |
| 6 | +---- | |
| 7 | +modbus_get_float_abcd - get a float value from 2 registers in ABCD byte order | |
| 8 | + | |
| 9 | + | |
| 10 | +SYNOPSIS | |
| 11 | +-------- | |
| 12 | +*float modbus_get_float_abcd(const uint16_t *'src');* | |
| 13 | + | |
| 14 | + | |
| 15 | +DESCRIPTION | |
| 16 | +----------- | |
| 17 | +The *modbus_get_float_abcd()* function shall get a float from 4 bytes in usual | |
| 18 | +Modbus format. The _src_ array must be a pointer on two 16 bits values, for | |
| 19 | +example, if the first word is set to 0x0020 and the second to 0xF147, the float | |
| 20 | +value will be read as 123456.0. | |
| 21 | + | |
| 22 | + | |
| 23 | +RETURN VALUE | |
| 24 | +------------ | |
| 25 | +The function shall return a float. | |
| 26 | + | |
| 27 | + | |
| 28 | +SEE ALSO | |
| 29 | +-------- | |
| 30 | +linkmb:modbus_set_float_abcd[3] | |
| 31 | +linkmb:modbus_get_float_dcba[3] | |
| 32 | +linkmb:modbus_get_float_badc[3] | |
| 33 | +linkmb:modbus_get_float_cdab[3] | |
| 34 | + | |
| 35 | + | |
| 36 | +AUTHORS | |
| 37 | +------- | |
| 38 | +The libmodbus documentation was written by Stéphane Raimbault | |
| 39 | +<stephane.raimbault@gmail.com> | ... | ... |
doc/modbus_get_float_badc.txt
0 → 100644
| 1 | +modbus_get_float_badc(3) | |
| 2 | +======================== | |
| 3 | + | |
| 4 | + | |
| 5 | +NAME | |
| 6 | +---- | |
| 7 | +modbus_get_float_badc - get a float value from 2 registers in BADC byte order | |
| 8 | + | |
| 9 | + | |
| 10 | +SYNOPSIS | |
| 11 | +-------- | |
| 12 | +*float modbus_get_float_badc(const uint16_t *'src');* | |
| 13 | + | |
| 14 | + | |
| 15 | +DESCRIPTION | |
| 16 | +----------- | |
| 17 | + | |
| 18 | +The *modbus_get_float_badc()* function shall get a float from 4 bytes with | |
| 19 | +swapped bytes (BADC instead of ABCD). The _src_ array must be a pointer on two | |
| 20 | +16 bits values, for example, if the first word is set to 0x2000 and the second | |
| 21 | +to 0x47F1, the float value will be read as 123456.0. | |
| 22 | + | |
| 23 | + | |
| 24 | +RETURN VALUE | |
| 25 | +------------ | |
| 26 | +The function shall return a float. | |
| 27 | + | |
| 28 | + | |
| 29 | +SEE ALSO | |
| 30 | +-------- | |
| 31 | +linkmb:modbus_set_float_badc[3] | |
| 32 | +linkmb:modbus_get_float_abcd[3] | |
| 33 | +linkmb:modbus_get_float_dcba[3] | |
| 34 | +linkmb:modbus_get_float_cdab[3] | |
| 35 | + | |
| 36 | + | |
| 37 | +AUTHORS | |
| 38 | +------- | |
| 39 | +The libmodbus documentation was written by Stéphane Raimbault | |
| 40 | +<stephane.raimbault@gmail.com> | ... | ... |
doc/modbus_get_float_cdab.txt
0 → 100644
| 1 | +modbus_get_float_cdab(3) | |
| 2 | +======================== | |
| 3 | + | |
| 4 | + | |
| 5 | +NAME | |
| 6 | +---- | |
| 7 | +modbus_get_float_cdab - get a float value from 2 registers in CDAB byte order | |
| 8 | + | |
| 9 | + | |
| 10 | +SYNOPSIS | |
| 11 | +-------- | |
| 12 | +*float modbus_get_float_cdab(const uint16_t *'src');* | |
| 13 | + | |
| 14 | + | |
| 15 | +DESCRIPTION | |
| 16 | +----------- | |
| 17 | +The *modbus_get_float_cdab()* function shall get a float from 4 bytes with | |
| 18 | +swapped words (CDAB order instead of ABCD). The _src_ array must be a pointer on | |
| 19 | +two 16 bits values, for example, if the first word is set to F147 and the second | |
| 20 | +to 0x0020, the float value will be read as 123456.0. | |
| 21 | + | |
| 22 | + | |
| 23 | +RETURN VALUE | |
| 24 | +------------ | |
| 25 | +The function shall return a float. | |
| 26 | + | |
| 27 | + | |
| 28 | +SEE ALSO | |
| 29 | +-------- | |
| 30 | +linkmb:modbus_set_float_cdab[3] | |
| 31 | +linkmb:modbus_get_float_abcd[3] | |
| 32 | +linkmb:modbus_get_float_dcba[3] | |
| 33 | +linkmb:modbus_get_float_badc[3] | |
| 34 | + | |
| 35 | + | |
| 36 | +AUTHORS | |
| 37 | +------- | |
| 38 | +The libmodbus documentation was written by Stéphane Raimbault | |
| 39 | +<stephane.raimbault@gmail.com> | ... | ... |
doc/modbus_get_float_dcba.txt
| ... | ... | @@ -15,9 +15,9 @@ SYNOPSIS |
| 15 | 15 | DESCRIPTION |
| 16 | 16 | ----------- |
| 17 | 17 | The *modbus_get_float_dcba()* function shall get a float from 4 bytes in |
| 18 | -inversed Modbus format (DCBA order instead of ABCD). The _src_ array must be | |
| 19 | -pointer on two 16 bits values, for example, if the first word is set to 0x9a22 | |
| 20 | -and the second to 0x6544, the float value read will be 916.540649. | |
| 18 | +inversed Modbus format (DCBA order instead of ABCD). The _src_ array must be a | |
| 19 | +pointer on two 16 bits values, for example, if the first word is set to 0x47F1 | |
| 20 | +and the second to 0x2000, the float value will be read as 123456.0. | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | RETURN VALUE |
| ... | ... | @@ -28,6 +28,9 @@ The function shall return a float. |
| 28 | 28 | SEE ALSO |
| 29 | 29 | -------- |
| 30 | 30 | linkmb:modbus_set_float_dcba[3] |
| 31 | +linkmb:modbus_get_float_abcd[3] | |
| 32 | +linkmb:modbus_get_float_badc[3] | |
| 33 | +linkmb:modbus_get_float_cdab[3] | |
| 31 | 34 | |
| 32 | 35 | |
| 33 | 36 | AUTHORS | ... | ... |
src/modbus-data.c
| ... | ... | @@ -114,7 +114,7 @@ float modbus_get_float_abcd(const uint16_t *src) |
| 114 | 114 | return f; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -/* Get a float from 4 bytes (Modbus) with byte and word swap conversion (DCBA) */ | |
| 117 | +/* Get a float from 4 bytes (Modbus) in inversed format (DCBA) */ | |
| 118 | 118 | float modbus_get_float_dcba(const uint16_t *src) |
| 119 | 119 | { |
| 120 | 120 | float f; |
| ... | ... | @@ -126,7 +126,7 @@ float modbus_get_float_dcba(const uint16_t *src) |
| 126 | 126 | return f; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | -/* Get a float from 4 bytes (Modbus) with byte swap conversion (BADC) */ | |
| 129 | +/* Get a float from 4 bytes (Modbus) with swapped bytes (BADC) */ | |
| 130 | 130 | float modbus_get_float_badc(const uint16_t *src) |
| 131 | 131 | { |
| 132 | 132 | float f; |
| ... | ... | @@ -138,7 +138,7 @@ float modbus_get_float_badc(const uint16_t *src) |
| 138 | 138 | return f; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -/* Get a float from 4 bytes (Modbus) in the format CDAB */ | |
| 141 | +/* Get a float from 4 bytes (Modbus) with swapped words (CDAB) */ | |
| 142 | 142 | float modbus_get_float_cdab(const uint16_t *src) |
| 143 | 143 | { |
| 144 | 144 | float f; | ... | ... |