get_modbus_inputs(iobus_list)
Features
This function reads multiple signals from the Modbus Slave unit.
Parameters
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
iobus_list | list(string) | - | Modbus input name list (set in the TP) signal type can be used only in the following cases
|
Return
Value | Description |
---|---|
int (>=0) | Multiple signals to be read at once (the value of the combination of iobus_list where the first value is LSB and the last value is MSB) |
Negative number | Failed |
Exception
Exception | Description |
---|---|
DR_Error (DR_ERROR_TYPE) | Parameter data type error occurred |
DR_Error (DR_ERROR_VALUE) | Parameter value is invalid |
DR_Error (DR_ERROR_RUNTIME) | C extension module error occurred |
DR_Error (DR_ERROR_STOP) | Program terminated forcefully |
Example
# Modbus digital I/O input signal "di1" =OFF, "di2"=ON, and "di3" =ON
res = get_modbus_inputs(iobus_list=[ "di1", "di2", "di3"])
#res expected value = 0b110 (binary number), 6 (decimal number), or 0x06 (hexadecimal number)
# Modbus digital I I/O input signal "di4" OFF and "di5" ON
res = get_modbus_inputs(["di4", "di5"])
#res expected value = 0b10 (binary number), 2 (decimal number), or 0x02 (hexadecimal number)