7 modbus protocol errors – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 238

Advertising
background image

Modbus Slave (Server)

Modbus Master (Client)

2.2 Send data to the server

//initialize data array

for i=0:coilsNum-1

staticArr[i]=i%4

end for

if(client.isOpen())

//write data array

retval

=client.

writeMultipleCoils(

1, &staticArr, coilsNum )

//check results

if(

!retval

)

TRACE(“Error

%!!!”,retval)

end

if

if( !client.writeSingleCoil( coilsNum-1, 1 )

TRACE(“Error!!!”)

end if

end if

3. Stop server

server.shutdownServer()

3. Disconnect from server

client.closeProtocol()

12.7 MODBUS Protocol Errors

Error

code

Error message

Possible error reason

0xffff Invalid data size or

Index out of range

The size of the storage buffer is out of range or the index
value is less then 1

0 Operation

was

successful

Indicates no error

1

Illegal argument error A parameter passed to the function is invalid or out of range

2

Illegal state error

Called in a wrong state; returned by all functions if the
protocol has not yet been opened successfully

3

Evaluation expired

This version of the library is a function limited evaluation
version and has now expired

4

No data table
configured

Slave has been started without adding a data table. A data
table must be added by either calling addDataTable or
passing it as a constructor argument.

5

Slave address 0 illegal
for serial protocols

A slave address or unit ID of 0 is used as broadcast address
for ASCII and RTU protocol and is, therefore, illegal

64

I/O error class

Errors of this class signal a problem in conjunction with the
I/O system

65

I/O error

The underlying I/O system reported an error

66

Port or socket open
error

The TCP/IP socket or the serial port could not be opened. In
the case of a serial port, it indicates that the serial port does
not exist on the system.

Maestro

Software Manual

Ethernet/IP Communication

MAN-MASSW (Ver. Q)

12-18

Advertising