beautypg.com

3 modbus master object 16-bit access functions – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 227

background image

Returns: 0 on success or error code.

Example:

masterObj.readDiscreteInputs(1, ::iStaticArray, 10)

12.3.3

MODBUS Master Object 16-bit Access Functions

For Modicon Register Table 4:00000 (Holding Registers) and Table 3:00000 (Input
Registers)

1. readHoldingRegister(int address)

MODBUS function code 03. Reads the content of a single output register
(holding registers, 4:00000 table).

Parameters:

address – output register (holding register) address (range: 1 - 65536)

Returns: output register value (range: 0 - 65536).

Example:

masterObj.readHoldingRegister(1)

Function using

For command interpreter only

2. int retVal = readHoldingRegisters(int startAddress, int ::iStaticArray , int num)

MODBUS function code 03. Reads the content of the output registers (holding
registers, 4:00000 table). Up to 125 registers.

Parameters:

startAddress – start register address (range: 1 - 65536)

iStaticArray – static integer array which will contain the data read

num - number of registers to be read (range: 1-125)

Returns: 0 on success or error code.

Example:

masterObj.readHoldingRegisters(1, ::iStaticArray, 3)

Maestro

Software Manual

Ethernet/IP Communication

MAN-MASSW (Ver. Q)

12-7