Communicating with Multiple Devices

The DMC-2100/2200 is capable of supporting multiple masters and slaves. The masters may be multiple PC's that send commands to the controller. The slaves are typically peripheral I/O devices that receive commands from the controller.

NOTE: The term "Master" is equivalent to the internet "client". The term "Slave" is equivalent to the internet "server".

An Ethernet handle is a communication resource within a device. The DMC-2100/2200 can have a maximum of 6 Ethernet handles open at any time. When using TCP/IP, each master or slave uses an individual Ethernet handle. In UDP/IP, one handle may be used for all the masters, but each slave uses one. (Pings and ARPs do not occupy handles.) If all 6 handles are in use and a 7th master tries to connect, it will be sent a "reset packet" that generates the appropriate error in its windows application.

NOTE: There are a number of ways to reset the controller. Hardware reset (push reset button or power down controller) and software resets (through Ethernet or RS232 by entering RS). The only reset that will not cause the controller to disconnect is a software reset via the Ethernet.

When the Galil 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 signed 32 bit number. A port number may also be specified, but if it is not, it will default to 1000. 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 IP 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 DMC-2100/2200 can use a specific slave address or default to the handle number. The port number for Modbus is 502.

The Modbus protocol has a set of commands called function codes. The DMC-2100/2200 supports the

10 major function codes:

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

The DMC-2100/2200 provides three levels of Modbus communication. 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 format of the command is

8 Chapter 4 Communication

DMC-2X00

Page 63
Image 63
Galil DMC-2X00 user manual Communicating with Multiple Devices