Modbus types and utility procedures.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | MODBUS_ACCESS_NONE | = | 0 |
No access (invalid). |
integer, | public, | parameter | :: | MODBUS_ACCESS_READ | = | 1 |
Read access. |
integer, | public, | parameter | :: | MODBUS_ACCESS_WRITE | = | 2 |
Write access. |
integer, | public, | parameter | :: | MODBUS_TYPE_NONE | = | 0 |
None (invalid). |
integer, | public, | parameter | :: | MODBUS_TYPE_INT16 | = | 1 |
Signed 2-byte integer. |
integer, | public, | parameter | :: | MODBUS_TYPE_INT32 | = | 2 |
Signed 2-byte integer. |
integer, | public, | parameter | :: | MODBUS_TYPE_UINT16 | = | 3 |
Unsigned 2-byte integer. |
integer, | public, | parameter | :: | MODBUS_TYPE_UINT32 | = | 4 |
Unsigned 4-byte integer. |
integer, | public, | parameter | :: | MODBUS_TYPE_FLOAT | = | 5 |
4-byte float. |
integer, | public, | parameter | :: | MODBUS_TYPE_LAST | = | 5 |
Never use this. |
integer, | public, | parameter | :: | MODBUS_TYPE_DEFAULT | = | MODBUS_TYPE_INT16 |
Default number type. |
integer, | public, | parameter | :: | MODBUS_ORDER_NONE | = | 0 |
None (integer or invalid). |
integer, | public, | parameter | :: | MODBUS_ORDER_ABCD | = | 1 |
ABCD byte order. |
integer, | public, | parameter | :: | MODBUS_ORDER_BADC | = | 2 |
BADC byte order. |
integer, | public, | parameter | :: | MODBUS_ORDER_CDAB | = | 3 |
CDBA byte order. |
integer, | public, | parameter | :: | MODBUS_ORDER_DCBA | = | 4 |
DCBA byte order. |
integer, | public, | parameter | :: | MODBUS_ACCESS_NAME_LEN | = | 5 |
Max. access name length. |
integer, | public, | parameter | :: | MODBUS_ORDER_NAME_LEN | = | 4 |
Max. byte order name length. |
integer, | public, | parameter | :: | MODBUS_TYPE_NAME_LEN | = | 6 |
Max. number type name length. |
integer, | public, | parameter | :: | MODBUS_REGISTER_NAME_LEN | = | RESPONSE_NAME_LEN | |
integer, | public, | parameter | :: | MODBUS_REGISTER_UNIT_LEN | = | RESPONSE_UNIT_LEN | |
character(len=*), | public, | parameter | :: | MODBUS_TYPE_NAMES(MODBUS_TYPE_NONE:MODBUS_TYPE_LAST) | = | [character(len=MODBUS_TYPE_NAME_LEN)::'none', 'int16', 'int32', 'uint16', 'uint32', 'float'] |
Modbus number type names. |
Modbus register value type. Changes to this derived type must be
regarded in module dm_lua
. Only integer values can be written to a
Modbus register. Any value read from a Modbus register must be
stored separately from this derived type.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=MODBUS_REGISTER_NAME_LEN), | public | :: | name | = | ' ' |
Register name. |
|
character(len=MODBUS_REGISTER_UNIT_LEN), | public | :: | unit | = | ' ' |
Register value unit. |
|
integer, | public | :: | access | = | MODBUS_ACCESS_NONE |
Read or write access. |
|
integer, | public | :: | slave | = | 0 |
Slave id. |
|
integer, | public | :: | address | = | 0 |
Register address. |
|
integer, | public | :: | type | = | MODBUS_TYPE_INT16 |
Number type. |
|
integer, | public | :: | order | = | MODBUS_ORDER_NONE |
Byte order of float. |
|
integer, | public | :: | value | = | 0 |
Register value to write. |
Returns access enumerator from string. Returns MODBUS_ACCESS_NONE
on error.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name |
Input string. |
Returns .true.
if access is a valid enumerator.
MODBUS_ACCESS_NONE
is invalid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | access |
Modbus access enumerator. |
Returns byte order named parameter associated with given string.
For example, the result will be MODBUS_ORDER_ACBD
if name
is
ABCD
(case-insensitive). Returns MODBUS_ORDER_NONE
if the string
is invalid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name |
Input string. |
Returns .true.
if argument is a valid float byte order enumerator.
MODBUS_ORDER_NONE
is not a valid byte order.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | order |
Modbus byte order enumerator. |
Returns .true.
if Modbus register type is valid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(modbus_register_type), | intent(in) | :: | register |
Modbus register type. |
Returns .true.
if the given Modbus number type is valid.
MODBUS_TYPE_NONE
is invalid.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | type |
Modbus number type. |
Returns Modbus number type from given name. If name
is invalid,
MODBUS_TYPE_NONE
is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name |
Modbus type name. |
Parses string for the following Modbus parameters and returns the
values in register
:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string |
Input string. |
||
type(modbus_register_type), | intent(out) | :: | register |
Modbus I/O type. |
||
integer, | intent(out), | optional | :: | error |
Error code. |
Outputs Modbus register type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(modbus_register_type), | intent(inout) | :: | register |
Modbus register type. |
||
integer, | intent(in), | optional | :: | unit |
File unit. |