beautypg.com

ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 225

background image

Parameters:

coilAddress – coil (discrete output) address (range: 1 - 65536)

Returns: Content of selected coil (range: 0-1)

Example:

masterObj.readCoil(10)

Function using

For command interpreter only

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

MODBUS function code 01.
Reads the status of the contiguous discrete outputs (coils, 0:00000 table). Up to
2000 coils.

Parameters:

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

iStaticArray – static integer array which will contain the data read

num - number of contiguous coils to be read (range: 1-2000)

Returns: 0 on success or error code.

Example:

masterObj.readCoils(10, ::iStaticArray , 40)

3. intVal = writeSingleCoil(int coilAddress, int val)

writeSingleCoil(, int val)

MODBUS function code 05. Sets a single discrete output variable (coils, 0:00000 table) to
either ON or OFF.

Parameters:

coilAddress – coil (discrete output) address (range: 1 - 65536)

val – new coli value (0 or 1)

Returns:.

0 on success or error code

Example:

masterObj.writeSingleCoil(10, 1)

Maestro

Software Manual

Ethernet/IP Communication

MAN-MASSW (Ver. Q)

12-5