dm_modbus_register_parse Subroutine

public pure elemental subroutine dm_modbus_register_parse(string, register, error)

Parses string for the following Modbus parameters and returns the values in register:

Parameter Type Description
access string Read from or write to register (read, write).
slave integer Slave id.
address integer Register address.
type string Register type (int16, int32, uint16, uint32, float).
order string Byte order ('none,abcd,badc,cdab,dcba`).
scale integer Scale denominator (only for reading).
value integer Integer value (only for writing).

Key and value are separated by character =, parameter fields by character ,. The parsing of parameter keys and values is case-insensitive, i.e., INT16 equals int16 and ABCD equals abcd.

A string of parameters to read a register value as 2-byte signed integer and scale it by 1/10:

access=read,slave=10,address=40050,scale=10

A string of parameters to read a float value in ABCD byte order:

access=read,slave=10,address=40060,type=float,order=abcd

A string of parameters to write value 10 to register 30050:

access=write,slave=10,address=30050,value=10,type=int16

The routine returns the following error codes in argument error:

  • E_EMPTY if the string is empty.
  • E_FORMAT if the string format is invalid.
  • E_TYPE if a parameter value type is invalid.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string

Input string.

type(modbus_register_type), intent(out) :: register

Modbus register type.

integer, intent(out), optional :: error

Error code.


Calls

proc~~dm_modbus_register_parse~~CallsGraph proc~dm_modbus_register_parse dm_modbus_register_parse interface~dm_lower dm_lower proc~dm_modbus_register_parse->interface~dm_lower interface~dm_string_to dm_string_to proc~dm_modbus_register_parse->interface~dm_string_to proc~dm_is_error dm_is_error proc~dm_modbus_register_parse->proc~dm_is_error proc~dm_modbus_access_from_name dm_modbus_access_from_name proc~dm_modbus_register_parse->proc~dm_modbus_access_from_name proc~dm_modbus_access_is_valid dm_modbus_access_is_valid proc~dm_modbus_register_parse->proc~dm_modbus_access_is_valid proc~dm_modbus_order_from_name dm_modbus_order_from_name proc~dm_modbus_register_parse->proc~dm_modbus_order_from_name proc~dm_modbus_type_from_name dm_modbus_type_from_name proc~dm_modbus_register_parse->proc~dm_modbus_type_from_name proc~dm_string_split dm_string_split proc~dm_modbus_register_parse->proc~dm_string_split proc~dm_string_lower dm_string_lower interface~dm_lower->proc~dm_string_lower interface~dm_to_lower dm_to_lower proc~dm_modbus_access_from_name->interface~dm_to_lower proc~dm_modbus_order_from_name->interface~dm_to_lower proc~dm_modbus_type_from_name->interface~dm_to_lower proc~dm_string_to_lower dm_string_to_lower interface~dm_to_lower->proc~dm_string_to_lower