beautypg.com

ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 228

background image

3. int retVal = writeSingleRegister(int address, int val)

MODBUS function code 06. Writes a value into a single output register
(holding register, 4:00000 table).

Parameters:

reference – register address (range: 1 - 65536)

val – new register value

Returns:. 0 on success or error code.

Example:

masterObj.writeSingleRegister(4, 10)

4. int retVal = writeMultipleRegisters(int startAddress, int ::iStaticArray , int num)

MODBUS function code 16. Writes values into a sequence of output registers
(holding registers, 4:00000 table). Up to 100 registers.

Parameters:

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

iStaticArray – static integer array which contains the data to be sent

num - number of registers to be written (range: 1-100)

Returns: 0 on success or error code.

Example:

masterObj.writeMultipleRegisters(5, ::iStaticArray, 8)

5. int retVal = maskWriteRegister(int address, int andMask,

int orMask)

MODBUS function code 22. Masks bits according to an AND & an OR mask
into a single output register (holding register, 4:00000 table). Masking is done
as follows: Result = (Current Contents AND And_Mask) OR (Or_Mask AND
(NOT And_Mask))
.

Parameters:

address – register address (range: 1 - 65536)

andMask – mask to be applied as a logic AND to the register

orMask - mask to be applied as a logic OR to the register

Returns: 0 on success or error code.

Example:

masterObj.maskWriteRegister(i, andMask, orMask)

Maestro

Software Manual

Ethernet/IP Communication

MAN-MASSW (Ver. Q)

12-8