m4MIoReadFieldbusIo
IO-Function: Read data from a fieldbus slave.
Description
This function reads scalar or array data from fieldbus I/Os.
Note: Read the introduction in Fundamentals of MLPI Programming carefully to avoid unexpected results of this function as the IO access is shared with the target PLC.
Syntax
[data] = ...
m4MIoReadFieldbusIo(connection, masterName, slaveAddress, ...
area, dataType, offset)
[data, result] = ...
m4MIoReadFieldbusIo(connection, masterName, slaveAddress, ...
area, dataType, offset)
[data] = ...
m4MIoReadFieldbusIo(connection, masterName, slaveAddress, ...
area, dataType, offset, numElements)
[data, result] = ...
m4MIoReadFieldbusIo(connection, masterName, slaveAddress, ...
area, dataType, offset, numElements)
Input Arguments
connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.
masterName defines the name of the fieldbus master. The argument must be a 1xL char array.
slaveAddress defines the address of the fieldbus slave. The argument must be a 1xL char array.
memArea defines if the data is read from the fieldbus input or output area. The argument must be a scalar MlpiIoFieldbusArea enumeration.
dataType defines the data type of the output argument data. The argument must be a scalar MlpiType enumeration.
offset defines the offset within the I/O range of the fieldbus slave. If the type of data is logical, the offset is a bit-offset. Otherwise the offset is a byte-offset. The argument must be a scalar uint32 value.
Optional Input Arguments
numElements defines the number of elements that shall be read. The argument must be a scalar uint32 value. The optional argument is to read an array of elements from the fieldbus slave.
Output Arguments
data contains the values read from the fieldbus slave. The argument is scalar if no input argument numElements is provided. The argument is a Mx1 matrix. The number M is equal to numElements if there are enough elements to read from the fieldbus slave. If the function was not able to read the specified number of elements, M will be smaller accordingly. The data type of this argument will be as specified by the input argument dataType.
result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.
Example Files
Here you will find instructions to use the examples.
The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:
See also
Reference to mlpiCore
This function maps to the mlpiCore function: Read fieldbus I/O
Copyright
Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0