Yaskawa SMC–4000 User Manual

Page 50

Advertising
background image

40

SMC–4000 User Manual

When the Yaskawa controller acts as the master, the IH command is used to assign handles and connect to
its slaves. The IP address may be entered as a 4 byte number separated with commas (industry standard
uses periods) or as a 32 bit number. A port may also be specified, but if not, it will default to 502. The
protocol (TCP/IP or UDP/IP) to use must also be designated at this time, otherwise, the controller will not
connect to the slave. (Ex. IHB=151,25,255,9<179>2 This will open handle #2 and connect to the I/P
address 151.25.255.9, port 179, using TCP/IP).

An additional protocol layer is available for speaking to I/O devices. Modbus is an RS-485 protocol that
packages information in binary packets that are sent as part of a TCP/IP packet. In this protocol, each
slave has a 1 byte slave address.The SMC–4000 can use a specific slave address or default to the handle
number.

Modbus protocol has commands called function codes. The SMC–4000 supports 10 major function codes:

The SMC–4000 provides three levels of Modbus communication.

Level 1

The first level allows the user to create a raw packet and receive raw data. It uses the MBh command with
a function code of -1. The command format is:

MBh=-1,len, array[ ] where len is the number of bytes

array [ ] is the array with the data

Level 2

The second level incorporates the Modbus structure. This is necessary for sending configuration and
special commands to an I/O device. The formats vary depending on the function code that is called. For
more information, refer to Command Reference

Level 3

The third level of Modbus communication uses standard Yaskawa commands. Once the slave has been
configured, the commands that may be used are @IN[ ], @AN[ ], SB, CB, OB, and AO. For example, AO
2020,8.2 would tell I/O number 2020 to output 8.2 volts.

If a specific slave address is not necessary, the I/O number to be used can be calculated with the following:

I/O Number= (HandleNum*1000)+((Module-1)*4)+(BitNum)

Function Code

Definition

01

Read Coil Status (Read Bits)

02

Read Input Status (Read Bits)

03

Read Holding Registers (Read Words)

04

Read Input Registers (Read Words)

05

Force Single Coil (Write One Bit)

06

Preset Single Register (Write One Word)

07

Read Exception Status (Read Error Code)

15

Force Multiple Coils (Write Multiple Bits)

16

Preset Multiple Registers (Write Words)

17

Report Slave ID

Advertising