Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 21 of 60

DL205 PLC User Manual, Volume 1 of 2, pages 201 to 210

Pages 201 to 210 of 598

The original document is the PDF (12 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the AutomationDirect D2-04TD1, AutomationDirect D2-08TD2, AutomationDirect D2-16ND3-2, AutomationDirect D2-32ND3, Konnect-It D2-04TD1, Koyo D2-04TD1, Konnect-It D2-08TD2, Koyo D2-08TD2, and 5 more models

Page 201

Chapter 4: System Design and Configuration

Network Slave Operation This section describes how other devices on a network can communicate with a CPU port that you have configured as a DirectNET slave (DL240/250–1/260) or Modbus slave (DL250–1, DL260). A Modbus host must use the Modbus RTU protocol to communicate with the DL250–1 or DL260 as a slave. The host software must send a Modbus function code and Modbus address to specify a PLC memory location the DL250–1 or DL260 comprehends. The DirectNET host uses normal I/O addresses to access applicable DL205 CPU and system. No CPU ladder logic is required to support either Modbus slave or DirectNET slave operation.

1 2 3 Modbus Function Codes Supported 4

The Modbus function code determines whether the access is a read or a write, and whether to access a single data point or a group of them. The DL250–1 and DL260 support the Modbus 5 function codes described below.

6 Modbus Function Code Function DL205 Data Types Available 7 8 9 Determining the Modbus Address There are typically two ways that most host software conventions allow you to specify a PLC 10 memory location. These are: • By specifying the Modbus data type and address 11 • By specifying a Modbus address only. 12 If Your Host Software Requires the Data Type and Address Many Host software packages allow you to specify the Modbus data type and the Modbus address that correspond to the PLC memory location. This is the easiest method, but not all 13 packages allow you to do it this way. The actual equation used to calculate the address depends on the type of PLC data you are 14 using. The PLC memory types are split into two categories for this purpose. • Discrete – X, SP, Y, C, S, T (contacts), CT (contacts) A • Word – V, Timer current value, Counter current value In either case, you basically convert the PLC octal address to decimal and add the appropriate B Modbus address (if required). The table on the following page shows the exact equation used for each group of data. C NOTE: For information about the Modbus protocol see www.Modbus.org and select Technical Resources. For more information about the DirectNET protocol, order our DirectNET User Manual, DA-DNET-M, or D download the manual free from our website: www.automationdirect.com. Select Manuals/Docs>Online

230 240 250-1 260

230 240

250-1 260

01 02 05 15 03, 04 06 16

Read a group of coils Read a group of inputs Set / Reset a single coil (slave only) Set / Reset a group of coils Read a value from one or more registers Write a value into a single register (slave only) Write a value into a group of registers

Y, C, T, CT X, SP Y, C, T, CT Y, C, T, CT V V V

User Manuals>Misc.>DA-DNET-M

DL205 User Manual, 4th Edition, Rev. D

4-35

Page 202

Chapter 4: System Design and Configuration DL250–1 Memory

Modbus Address

QTY (Dec.) PLC Range (Octal) Range (Decimal) Modbus Data Type Type 1 For Discrete Data Types ............. Convert PLC Addr. to Dec. + Start of Range + Data Type 2 3 4 5 For Word Data Types .............................. Convert PLC Addr. to Dec. + Data Type 6 7 8 Modbus Address Modbus Data Type DL260 Memory Type QTY (Dec.) PLC Range (Octal) Range (Decimal) 9 For Discrete Data Types ............. Convert PLC Addr. to Dec. + Start of Range + Data Type 10 11 12 13 For Word Data Types ............................. Convert PLC Addr. to Dec. + Data Type 14 A B C D Inputs (X)

512

Special Relays (SP)

512

512 1024 256 128 1024

X0 – X777 SP0 – SP137 SP320 – SP717 Y0 – Y777 C0 – C1777 T0 – T377 CT0 – CT177 S0 – S1777

2048 3072 3280 2048 3072 6144 6400 5120

Outputs (Y) Control Relays (C) Timer Contacts (T) Counter Contacts (CT) Stage Status Bits (S)

Timer Current Values (V) Counter Current Values (V) V-Memory, system (V)

256 128 3072 4096 256

V0 – V377 V1000 – V1177 V1400 – V7377 V10000 – V17777 V7400 – V7777

0 – 255 512 – 639 768 – 3839 4096 – 8191 3480 – 3735

Inputs (X) Remote Inputs (GX) Special Relays (SP) Outputs (Y) Remote Outputs (GY) Control Relays (C) Timer Contacts (T) Counter Contacts (CT) Stage Status Bits (S)

1024 2048 512 1024 2048 2048 256 256 1024

X0 – X1777 GX0 – GX3777 SP0 – SP777 Y0 – Y777 GY0 – GY3777 C0 – C377 T0 – T177 CT0 – CT177 S0 – S777

2048 – 3071 3840 – 18431 3072 – 3583 2048 – 3071 18432 – 20479 3072 – 5159 6144 – 6399 6400 – 6655 5120 – 6143

Input Input Input Coil Coil Coil Coil Coil Coil

Timer Current Values (V) Counter Current Values (V)

256 256

0 – 255 512 – 767

Input Register Input Register

V-Memory, user data (V)

14.6K

1024 – 2047

Holding Register

V-Memory, system (V)

256 1024

V0 – V177 V1000 – V1177 V400 – V777 V1400 – V7377 V10000 – V35777 V7400 – V7777 V36000 – V37777

3480 – 4095 15360 – 16383

Holding Register

V-Memory, user data (V)

4-36

DL205 User Manual, 4th Edition, Rev. D

– – – – – – – –

2560 3167 3535 2560 4095 6399 6527 6143

Input Input Coil Coil Coil Coil Coil

Input Register Input Register

Holding Register Holding Register

Page 203

Chapter 4: System Design and Configuration The following examples show how to generate the Modbus address and data type for hosts which require this format. Example 1: V2100 PLC Address (Dec.) + Data Type Find the Modbus address for User V2100 = 1088 decimal V location V2100. 1088 + Hold. Reg. = Holding Reg. 1089

1 2 1. Find V memory in the table. 3 2. Convert V2100 into decimal (1089). 3. Use the Modbus data type from the table. 4 5 Example 2: Y20 PLC Addr. (Dec) + Start Addr. + Data Type Find the Modbus address for output Y20. 6 Y20 = 16 decimal 1. Find Y outputs in the table. 2. Convert Y20 into decimal (16). 16 + 2049 + Coil = 7 Coil 2065 3. Add the starting address for the range (2049). 4. Use the Modbus data type from the table. 8 9 PLC Address (Dec.) + Data Type Example 3: T10 Current Value 10 Find the Modbus address to obtain the current T10 = 8 decimal value from Timer T10. 8 + Input Reg. = Input Reg. 9 11 1. Timer Current Values in the table. 2. Convert T10 into decimal (8). 12 3. Use the Modbus data type from the table. 13 Example 4: C54 PLC Addr. (Dec) + Start Addr. +Data Type 14 Find the Modbus address for Control C54 = 44 decimal Relay C54. 44 + 3073 + Coil = Coil 3117 A 1. Find Control Relays in the table. 2. Convert C54 into decimal (44). B 3. Add the starting address for the range (3073). 4. Use the Modbus data type from the C table. D Timer Current Values (V) Counter Current Values (V) V Memory, user data (V)

128 128 1024

V0 - V177 V1000 - V1177 V2000 - -V3777

0 - 127 512 - 639 1024 - 2047

Input Register Input Register Holding Register

Outputs (Y) Control Relays (CR)

320 256

Y0 – Y477 C0 – C377

2049 – 2367 3072 - 3551

Coil Coil

Timer Current Values (V) Counter Current Values (V)

128 128

V0 – V177 V1000 – V1177

0 – 128 512 – 639

Input Register Input Register

Outputs (Y) Control Relays (C)

320 256

Y0 – Y477 C0 – C377

2048 - 2367 3073 – 3551

Coil Coil

DL205 User Manual, 4th Edition, Rev. D

4-37

Page 204

Chapter 4: System Design and Configuration

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 4-38

If Your Modbus Host Software Requires an Address ONLY Some host software does not allow you to specify the Modbus data type and address. Instead, you specify an address only. This method requires another step to determine the address, but it is not difficult. Basically, Modbus separates the data types by address ranges as well. So this means an address alone can actually describe the type of data and location. This is often referred to as “adding the offset.” One important thing to remember here is that two different addressing modes may be available in your host software package. These are: • 484 Mode • 584/984 Mode

We recommend that you use the 584/984 addressing mode if your host software allows you to choose. This is because the 584/984 mode allows access to a higher number of memory locations within each data type. If your software only supports 484 mode, then there may be some PLC memory locations that will be unavailable. The actual equation used to calculate the address depends on the type of PLC data you are using. The PLC memory types are split into two categories for this purpose. • Discrete – X, GX, SP, Y, R, S, T, CT (contacts), C (contacts) • Word – V, Timer current value, Counter current value

In either case, you basically convert the PLC octal address to decimal and add the appropriate Modbus addresses (as required). The table below shows the exact equation used for each group of data. Discrete Data Types Range PLC Range (Octal) Address (484 Mode)

Address Range (584/984 Mode) Modbus Data Type

Inputs (X) Special Relays (SP)

GX0 – GX1746 GX1747 – GX3777 X0 – X1777 SP0 – SP777

1001 – 1999 -------

10001 11000 12049 13073

– – – –

10999 12048 13072 13584

Input Input Input Input

Global Outputs (GY) Outputs (Y) Control Relays (C) Timer Contacts (T) Counter Contacts (CT) Stage Status Bits (S)

GY0 – GY3777 Y0 – Y1777 C0 – C3777 T0 – T377 CT0 – CT377 S0 – S1777

1 2049 3073 6145 6401 5121

1 2049 3073 6145 6401 5121

– – – – – –

2048 3072 5120 6400 6656 6144

Output Output Output Output Output Output

DL260 Memory Type Global Inputs (GX)

DL205 User Manual, 4th Edition, Rev. D

– – – – – –

2048 3072 5120 6400 6656 6144

Page 205

Chapter 4: System Design and Configuration Word Data Types

1 2 3 4 *Modbus: Function 04 5 The DL-250 supports function 04 read input register (Address 30001). To use function 04, put the number ‘4’ into the most significant position (4xxx) when defining the number of 6 bytes to read. Four digits must be entered for the instruction to work properly with this mode. 7 The maximum constant possible is 4128. This 8 is due to the 128 maximum number of Bytes LD that the RX/WX instruction can allow. The K101 9 value of 4 in the most significant position of the word will cause the RX to use function 04 LD (30001 range). 10 K4128 LDA 11 O4000 12 RX V0 13 Refer to your PLC user manual for the correct memory size of your PLC. Some of the addresses 14 shown above might not pertain to your particular CPU. For an automated Modbus/Koyo address conversion utility, search and download the file A modbus_conversion.xls from the www.automationdirect.com website. B C D Registers

V-Memory (Timers) V-Memory (Counters)

V-Memory (Data Words)

PLC Range (Octal) V0 V1000 V1200 V1400 V1747 V2000 V10000

– – – – – – –

V377 V1177 V1377 V1746 V1777 V7377 V17777

Input/Holding (484 Mode)*

Input/Holding (585/984 Mode)*

3001/4001 3513/4513 3641/4641 3769/4769 -------

30001/40001 30513/40513 30641/40641 30769/40769 31000/41000 41025 44097

DL205 User Manual, 4th Edition, Rev. D

4-39

Page 206

Chapter 4: System Design and Configuration

Example 1: V2100 584/984 Mode

PLC Address (Dec.) + Mode Address Find the Modbus address for User V location V2100. V2100 = 1088 decimal 1. Find V memory in the table 2. Convert V2100 into decimal (1088). 1088 + 40001 = 41089 3. the Modbus starting address for the mode (40001).

1 2 For Word Data Types... PLC Address (Dec.) + Appropriate Mode Address 3 4 PLC Addr. (Dec.) + Start Address Example 2: Y20 584/984 Mode + Mode Find the Modbus address for output Y20. Y20 = 16 decimal 5 1. Find Y outputs in the table. 16 + 2048 + 1 = 2. Convert Y20 into decimal (16). 3. Add the starting address for the range (2048). 6 4. Add the Modbus address for the mode (1). 7 8 Example 3: T10 Current Value 484 Mode PLC Address (Dec.) + Mode Address Find the Modbus address to obtain the TA10 = 8 decimal 9 current value from Timer T10. 8 + 3001 = 1. Find Timer Current Values in the table. 10 2. Convert T10 into decimal (8). 3. Add the Modbus starting address for the mode (3001). 11 For Word Data Types... PLC Address (Dec.) + Appropriate Mode Address 12 Example 4: C54 584/984 Mode 13 PLC Addr. (Dec.) + Start Address + Find the Modbus address for Control Relay Mode C54. C54 = 44 decimal 14 1. Find Control Relays in the table. 44 + 3072 + 1 = 2. Convert C54 into decimal (44). 3. Add the starting address for the range (3072). A 4. Add the Modbus address for the mode (1). B C Determining the DirectNET Address D Addressing the memory types for DirectNET slaves is very easy. Use the ordinary native Timer Current Value (V) Counter Current Value (V) V Memory, User Data (V)

128 128 1024

V0 - V177 V1000 - V1177 V2000 - V3777

0 - 127 512 - 639 1024 - 2047

3001 3001 4001

30001 30001 40001

Input Register Input Register Hold Register

2065

Outputs (Y) Control Relays (CR) Timer Contacts (T)

320 256 128

Y0 - Y477 C0 - C377 T0 - T177

2048 - 2367 3072 - 3551 6144 - 6271

1 1 1

1 1 1

Coil Coil Coil

3009

Timer Current Value (V) Counter Current Value (V) V Memory, User Data (V)

128 128 1024

V0 - V177 V1000 - V1177 V2000 - V3777

0 - 127 512 - 639 1024 - 2047

3001 3001 4001

30001 30001 40001

Input Register Input Register Hold Register

3117

Outputs (Y) Control Relays (CR) Timer Contacts (T)

320 256 128

Y0 - Y477 C0 - C377 T0 - T177

2048 - 2367 3072 - 3551 6144 - 6271

1 1 1

1 1 1

Coil Coil Coil

230 240

250-1 260

4-40 address of the slave device itself. To access a slave PLC’s memory address V2000 via DirectNET, for example, the network master will request V2000 from the slave.

DL205 User Manual, 4th Edition, Rev. D

Page 207

Chapter 4: System Design and Configuration

Network Master Operation

230 240 250-1 260

1 2 3 4 Master 5 Slave #1 Slave #2 Slave #3 6 7 8 When using the DL250–1 or DL260 CPU 9 as the master station, you use simple RLL Master instructions to initiate the requests. The WX instruction initiates network write 10 operations, and the RX instruction initiates network read operations. Before executing Slave 11 either the WX or RX commands, we will need to load data related to the read or write WX (write) operation onto the CPU’s accumulator 12 stack. When the WX or RX instruction RX (read) executes, it uses the information on the stack 13 combined with data in the instruction box Network to completely define the task, which goes to the port. 14 The following step-by-step procedure will provide the information necessary to set up your ladder program to receive data from a network slave. A B C D This section describes how the DL250–1 and DL260 can communicate on a Modbus or DirectNET network as a master. For Modbus networks, it uses the Modbus RTU protocol, which must be interpreted by all the slaves on the network. Both Modbus and DirectNET are single master/multiple slave networks. The master is the only member of the network that can initiate requests on the network. This section teaches you how to design the required ladder logic for network master operation.

Modbus RTU Protocol, or DirectNET

DL205 User Manual, 4th Edition, Rev. D

4-41

Page 208

Chapter 4: System Design and Configuration

Step 1: Identify Master Port # and Slave #

F

1

0

1

1 Slave Address (BCD) CPU bottom port (BCD) 2 Internal port (hex) 3 4 5 1 2 8 Step 2: Load Number of Bytes to Transfer The second Load (LD) instruction determines 6 the number of bytes which will be transferred # of bytes to transfer between the master and slave in the subsequent WX or RX instruction. The value to be loaded is 7 in BCD format (decimal), from 1 to 128 bytes. The number of bytes specified also depends on 8 the type of data you want to obtain. For example, the DL205 Input points can be accessed by V-memory locations or as X input locations. However, if you only want X0 – X27, you’ll have 9 to use the X input data type because the V-memory locations can only be accessed in 2-byte increments. The following table shows the byte ranges for the various types of DirectLOGIC™ products. 10 Bits per unit Bytes 11 V-memory DL205/405 Memory T / C current value (X, SP) 12 Inputs Outputs (Y, C, Stage, T/C bits) Pad Memory 13 Scratch Diagnostic Status 14 DL305 Memory Bits per unit Bytes Data registers A T / C accumulator internal relays, shift register bits, B I/O, T/C bits, stage bits Scratch Pad Memory C Diagnostic Status(5 word R/W) D The first Load (LD) instruction identifies the communications port number on the network master (DL250-1/260) and the address of the slave station. This instruction can address up to 99 Modbus slaves, or 90 DirectNET slaves. The format of the word is shown to the right. The “F1” in the upper byte indicates the use of the bottom port of the DL250-1/260 PLC, port number 2. The lower byte contains the slave address number in BCD (01 to 99).

LD KF101

LD K128

4-42

DL205 User Manual, 4th Edition, Rev. D

16 16 8 8 8 8

2 2 1 1 1 1

8 16

1 2

1

1

8 16

2 10

Page 209

Chapter 4: System Design and Configuration

Step 3: Specify Master Memory Area

4

0

6

0

0

(octal)

1 Starting address of 2 master transfer area 3 4 V40600 MSB LSB 5 15 0 V40601 MSB LSB 6 15 0 7 NOTE: Since V-memory words are always 16 bits, you may not always use the whole word. For example, if you only specify 3 bytes and you are reading Y outputs from the slave, you will only get 24 bits of data. In this case, only the 8 least significant bits of the last word location will be modified. The remaining 8 bits 8 are not affected. 9 Step 4: Specify Slave Memory Area The last instruction in our sequence is the WX 10 or RX instruction itself. Use WX to write to the SP116 LD slave, and RX to read from the slave. All four of KF101 our instructions are shown to the right. In the last 11 instruction, you must specify the starting address LD and a valid data type for the slave. K128 12 •D irectNET slaves – specify the same address in the WX and RX instruction as the slave’s native I/O LDA address. 13 O40600 • DL405 or DL205 slaves – specify the same address in the WX and RX instruction as the slave’s RX 14 native I/O address. Y0 • 305 slaves – use the following table to A convert DL305 addresses to Modbus addresses. B DL305 Series CPU Memory Type–to–Modbus Cross Reference PLC Memory PLC Base PLC Base Modbus Modbus PLC Memory Type Address Base Address Base Address Type Address C TMR/CNT Current Values D I/O Points The third instruction in the RX or WX sequence is a Load Address (LDA) instruction. Its purpose is to load the starting address of the memory area to be transferred. Entered as an octal number, the LDA instruction converts it to hex and places the result in the accumulator. For a WX instruction, the DL250-1/260 CPU sends the number of bytes previously specified from its memory area beginning at the LDA address specified. For an RX instruction, the DL250-1/260 CPU reads the number of bytes previously specified from the slave, placing the received data into its memory area beginning at the LDA address specified.

Data Registers Stage Status Bits (D3-330P only)

R600

V0

IO 000 R401,R400 S0

GY0 V100 GY200

LDA O40600

TMR/CNT Status Bits Control Relays Shift Registers

CT600

GY600

CR160 SR400

GY160 GY400

DL205 User Manual, 4th Edition, Rev. D

4-43

Page 210

Chapter 4: System Design and Configuration

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 4-44

Communications from a Ladder Program Typically, network communications will last Port Communication Error longer than one scan. The program must wait for the communications to finish before SP117 Y1 starting the next transaction. SET Port 2, which can be a master, has two Special Relay contacts associated with it. SP116 LD KF201 One indicates “Port busy”(SP116), and the other indicates ”Port Communication LD Port Busy Error”(SP117). The example shows the use K3 of these contacts for a network master that only reads a device (RX). The “Port Busy” LDA O40600 bit is on while the PLC communicates with the slave. When the bit is off, the program RX can initiate the next network request. Y0 The “Port Communication Error” bit turns on when the PLC has detected an error. Use of this bit is optional. When used, it should be ahead of any network instruction boxes since the error bit is reset when an RX or WX instruction is executed.

Multiple Read and Write Interlocks If you are using multiple reads and writes in the RLL program, you have to interlock the routines to make sure all the routines are executed. If you don’t use the interlocks, then the CPU will only execute the first routine. This is because each port can only handle one transaction at a time. In the example to the right, after the RX instruction is executed, C100 is set. When the port has finished the communication task, the second routine is executed and C100 is reset. If you’re using RLLPLUS Stage Programming, you can put each routine in a separate program stage to ensure proper execution and switch from stage to stage allowing only one of them to be active at a time.

Interlocking Relay SP116

C100

LD KF201 LD K3 LDA O40600

Interlocking Relay SP116

C100

RX Y0 C100 SET LD KF201 LD K3 LDA O40400 WX VY0 C100 RST

DL205 User Manual, 4th Edition, Rev. D