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

The text of a manual · part 15 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 140 to 149

Pages 140 to 149 of 524

The original document is the PDF (6.4 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 Direct Logic DL06 and Koyo DL06 D0-06DD1

Page 140

Chapter 4: System Design and Configuration

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

The following examples show how to generate the MODBUS address and data type for hosts which require this format.

Example 1: V2100 Find the MODBUS address for User V location V2100.

Holding Reg 1088

1. Find V-memory in the table. 2. Convert V2100 into decimal (1088). 3. Use the MODBUS data type from the table. V-memory, user data (V)

3200

V1200 – V7377

640 – 3839

Holding Register

Example 2: Y20 Find the MODBUS address for output Y20. 1. Find Y outputs in the table.

Coil 2064

2. Convert Y20 into decimal (16). 3. Add the starting address for the range (2048). 4. Use the MODBUS data type from the table. Outputs (V)

256

Y0 – Y377

2048 - 2303

Coil

Example 3: T10 Current Value Find the MODBUS address to obtain the current value from Timer T10. 1. Find Timer Current Values in the table.

Input Reg. 8

2. Convert T10 into decimal (8). 3. Use the MODBUS data type from the table. Timer Current Values (V)

128

V0 – V177

0 - 127

Input Register

Example 4: C54

4–14

Find the MODBUS address for Control Relay C54. 1. Find Control Relays in the table.

Coil 3116

2. Convert C54 into decimal (44). 3. Add the starting address for the range (3072). 4. Use the MODBUS data type from the table. Control Relays (CR)

512

C0 – C77

3072 – 3583

DL06 Micro PLC User Manual; 3rd Edition Rev. A

Coil

Page 141

Chapter 4: System Design and Configuration

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’s still fairly simple. Basically, MODBUS also 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, SP, Y, CR, S, T (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 DL06 Memory Type Global Inputs (GX) Inputs (X) Special Relays (SP) Global Outputs (GY) Outputs (Y) Control Relays (CR) Timer Contacts (T) Counter Contacts (CT) Stage Status Bits (S)

PLC Range (Octal) GX0-GX1746 GX1747-GX3777 X0 – X1777 SP0 – SP777 GY0 - GY3777 Y0 – Y1777 C0 – C3777 T0 – T377 CT0 – CT377 S0 – S1777

Address (484 Address (584/984 MODBUS Data Mode) Mode) Type 1001 - 1999 ------1 - 2048 2049 - 3072 3073 - 5120 6145 - 6400 6401 - 6656 5121 - 6144

10001 - 10999 11000 - 12048 12049 - 13072 13073 - 13584 1 - 2048 2049 - 3072 3073 - 5120 6145 - 6400 6401 - 6656 5121 - 6144

Input Input Input Input Output Output Output Output Output Output

DL06 Micro PLC User Manual; 3rd Edition Rev. A

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

4–15

Page 142

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–16

Registers V-memory (Timers) V-memory (Counters)

V-memory (Data Words)

Word Data Types PLC Range Input/Holding Input/Holding (Octal) (484 Mode)* (584/984 Mode)* V0 - V377 V1000 - V1177 V1200 - V1377 V1400 - V1746 V1747 - V1777 V2000 - V7377 V10000 - V17777

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

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

* MODBUS: Function 04 The DL05/06, DL250-1/260, DL350 and DL450 will support function 04, read input register (Address 30001). To use function 04, put the number ‘4’ into the most significant position (4xxx). Four digits must be entered for the intruction to work properly with this mode. LD

K101

LD K4128 LDA O4000

The Maximum constant possible is 4128. This is due to the 128 maximum number of Bytes that the RX/WX instruction can allow. The value of 4 in the most significant position of the word will cause the RX to use function 04 (30001 range).

RX

Y0

1. Refer to your PLC user manual for the correct memory mapping size of your PLC. Some of the addresses shown above might not pertain to your particular CPU. 2. For an automated MODBUS/Koyo address conversion utility, go to our website, www.automationdirect.com, and down load download the EXCEL file modbus_conversion.xls located at: Tech Support > Technical Support Home page.

DL06 Micro PLC User Manual; 3rd Edition Rev. A

Page 143

Chapter 4: System Design and Configuration

Example 1: V2100 584/984 Mode Find the MODBUS address for User V location V2100.

PLC Address (Dec.) + Mode Address

1. Find V-memory in the table.

V2100 = 1088 decimal

2. Convert V2100 into decimal (1088).

1088 + 40001 =

41089

3. Add the MODBUS starting address for the mode (40001). For Word Data Types.... Timer Current Values (V) Counter Current Values (V) V-memory, user data (V)

PLC Address (Dec.) 128 128 1024

V0 – V177 V1200 – V7377 V2000 – V3777

+

Appropriate Mode Address

0 – 127 512 – 639 1024 – 2047

3001 3001 4001

30001 30001 40001

Input Register Input Register Holding Register

Example 2: Y20 584/984 Mode Find the MODBUS address for output Y20.

PLC Addr. (Dec.) + Start Address + Mode

1. Find Y outputs in the table.

Y20 = 16 decimal

2. Convert Y20 into decimal (16).

16 + 2048 + 1 =

2065

3. Add the starting address for the range (2048). 4. Add the MODBUS address for the mode (1). 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

Example 3: T10 Current Value 484 Mode Find the MODBUS address to obtain the current value from Timer T10.

PLC Address (Dec.) + Mode Address TA10 = 8 decimal

1. Find Timer Current Values in the table.

8 + 3001 =

3009

2. Convert T10 into decimal (8). 3. Add the MODBUS starting address for the mode (3001). For Word Data Types.... Timer Current Values (V) Counter Current Values (V) V-memory, user data (V)

PLC Address (Dec.) 128 128 1024

V0 – V177 V1200 – V7377 V2000 – V3777

+ 0 – 127 512 – 639 1024 – 2047

Appropriate Mode Address 3001 3001 4001

30001 30001 40001

Input Register Input Register Holding Register

Example 4: C54 584/984 Mode Find the MODBUS address for Control Relay C54. PLC Addr. (Dec.) + Start Address + Mode 1. Find Control Relays in the table.

C54 = 44 decimal

2. Convert C54 into decimal (44).

44 + 3072 + 1 =

3117

3. Add the starting address for the range (3072). 4. Add the MODBUS address for the mode (1). 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

DL06 Micro PLC User Manual; 3rd Edition Rev. A

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

4–17

Page 144

Chapter 4: System Design and Configuration

Network Master Operation

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

This section describes how the DL06 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. 0V G LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 AC(L) AC(N) 24V C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. OUTPUT: 6-240V

Y

0

X

1

2

50 - 60Hz 3

INPUT: 12 - 24V

4

2.0A, 6 - 27V

5

6

7

10

2.0A 11

12

PWR: 100-240V 13

14

15

16

PWR RUN CPU TX1 RX1 TX2 RX2

50-60Hz 40VA 17

20

D0-06DR

21 22

23

3 - 15mA

LOGIC C0

06

K oyo

X1 X0

X3 X2

X4 C1

X6 X5

X7

C2 X11 X13 X14 X16 C4 X21 X23 N.C. X15 X17 X20 X22 N.C. X10 X12 C3

TERM PORT1

PORT2

RUN STOP

Master

MODBUS RTU Protocol, or DirectNET

Slave #1

Slave #2

Slave #3

When using the DL06 PLC as the master station, simple RLL instructions are used to initiate the requests. The WX instruction initiates network write operations, and the RX instruction initiates network read operations. Before executing either the WX or RX commands, we will need to load data related to the read or write operation onto the CPU’s accumulator stack. When the WX or RX instruction executes, it uses the information on the stack combined with data in the instruction box to completely define the task, which goes to the port. LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 G 0V AC(L) AC(N) 24V C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. OUTPUT: 6-240V

Y

X

0

1

2

50 - 60Hz 3

INPUT: 12 - 24V

4

5

2.0A, 6 - 27V 6

7

10

2.0A 11

12

PWR: 100-240V 13

14

15

16

PWR RUN CPU TX1 RX1 TX2 RX2

50-60Hz 40VA 17

20

D0-06DR

21 22

23

3 - 15mA

LOGIC C0

06

K oyo

X1 X0

X3 X2

X4 C1

X6 X5

X7

C2 X11 X13 X14 X16 C4 X21 X23 N.C. X10 X12 C3 X15 X17 X20 X22 N.C.

TERM PORT1

PORT2

RUN STOP

Master

Network

WX (write) RX (read) Slave

The following step-by-step procedure will provide you the information necessary to set up your ladder program to receive data from a network slave.

DL06 Micro PLC User Manual; 3rd Edition Rev. A

Page 145

Chapter 4: System Design and Configuration

Step 1: Identify Master Port # and Slave # The first Load (LD) instruction identifies the communications port number on the network master (DL06) 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 “F2” in the upper byte indicates the use of the right port of the DL06 PLC, port number 2. The lower byte contains the slave address number in BCD (01 to 99).

Step 2: Load Number of Bytes to Transfer

F

2

0

1

Slave address (BCD) Port number (BCD) Internal port (hex) LD KF201

6

4

(BCD)

The second Load (LD) instruction determines 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 LD is in BCD format (decimal), from 1 to 128 K64 bytes. The number of bytes specified also depends on the type of data you want to obtain. For example, the DL06 Input points can be accessed by V-memory locations or as X input locations. However, if you only want X0 – X27, you’ll have 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. DL05 / 06 / 205 / 350 / 405 Memory

Bits per unit

Bytes

V-memory T / C current value Inputs (X, SP) Outputs (Y, C, Stage, T/C bits) Scratch Pad Memory Diagnostic Status

16 16 8

2 2 1

8

1

8 8

1 1

DL330 / 340 Memory

Bits per unit

Bytes

Data registers T / C accumulator I/O, internal relays, shift register bits, T/C bits, stage bits Scratch Pad Memory Diagnostic Status(5 word R/W)

8 16

1 2

1

1

8 16

1 10

DL06 Micro PLC User Manual; 3rd Edition Rev. A

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

4–19

Page 146

Chapter 4: System Design and Configuration

Step 3: Specify Master Memory Area

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

4

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 DL06 CPU sends the number of bytes previously specified from its memory area beginning at the LDA address specified. For an RX instruction, the DL06 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.

0

6

0

0

(octal)

Starting address of master transfer area LDA O40600

MSB

V40600

LSB

15 MSB

0 V40601

LSB

15

0

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 are not affected.

Step 4: Specify Slave Memory Area The last instruction in our sequence is the WX or RX instruction itself. Use WX to write to the slave, and RX to read from the slave. All four of our instructions are shown to the right. In the last instruction, you must specify the starting address and a valid data type for the slave.

SP116

LD KF201 LD K64

• DirectNET slaves – specify the same address in the WX and RX instruction as the slave’s native I/O address

LDA O40600

• MODBUS DL405, DL205, or DL06 slaves – specify the same address in the WX and RX instruction as the slave’s native I/O address

Y0

RX

• MODBUS 305 slaves – use the following table to convert DL305 addresses to MODBUS addresses

DL305 Series CPU Memory Type–to–MODBUS Cross Reference (excluding 350 CPU) PLC Memory Type

PLC Base Address

TMR/CNT Current Values

R600

V0

I/O Points Data Registers Stage Status Bits (D3-330P only)

IO 000 R401,R400 S0

GY0 V100 GY200

4–20

MODBUS PLC Memory Base Address Type TMR/CNT Status Bits Control Relays Shift Registers

DL06 Micro PLC User Manual; 3rd Edition Rev. A

PLC Base Address

MODBUS Base Address

CT600

GY600

CR160 SR400

GY160 GY400

Page 147

Chapter 4: System Design and Configuration

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

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 Interlocking interlocks, then the CPU will only execute the first Relay routine. This is because each port can only handle one transaction at a time. SP116 C100 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.

K0003

LDA O40600 RX VY0 C100 SET LD KF201 LD K0003 LDA O40400 WX VY0 C100 RST

DL06 Micro PLC User Manual; 3rd Edition Rev. A

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

4–21

Page 148

Chapter 4: System Design and Configuration

Network Master Operation (using MRX and MWX 1 Instructions)

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

This section describes how the DL06 can communicate on a MODBUS RTU network as a master using the MRX and MWX read/write instructions. These instructions allow you to enter native MODBUS addressing in your ladder logic program with no need to perform octal to decimal conversions. MODBUS is a single master/multiple slave network. 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.

G LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 0V Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. AC(L) AC(N) 24V C0 OUTPUT: 6-240V

Y

X

0

1

2

50 - 60Hz 3

INPUT: 12 - 24V

4

5

2.0A, 6 - 27V 6

7

10

2.0A 11

12

PWR: 100-240V 13

14

15

16

PWR RUN CPU TX1 RX1 TX2 RX2

50-60Hz 40VA 17

20

D0-06DR

21 22

23

3 - 15mA

LOGIC C0

06

K oyo

X1 X0

X3 X2

X4 C1

X6 X5

X7

C2 X11 X13 X14 X16 C4 X21 X23 N.C. X15 X17 X20 X22 N.C. X10 X12 C3

TERM PORT1

PORT2

RUN STOP

Master

MODBUS RTU Protocol, or DirectNET

Slave #1

Slave #2

Slave #3

MODBUS Function Codes Supported 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 DL06 supports the MODBUS function codes described below. MODBUS Function Code

4–22

01 02 05 15 03, 04 06 07 08 16

Function 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) Read Exception Status Diagnostics Write a value into a group of registers

DL06 Micro PLC User Manual; 3rd Edition Rev. A

DL06 Data Types Available Y, CR, T, CT X, SP Y, CR, T, CT Y, CR, T, CT V V V V V

Page 149

Chapter 4: System Design and Configuration

MODBUS Read from Network(MRX) The MODBUS Read from Network (MRX) instruction is used by the DL06 network master to read a block of data from a connected slave device and to write the data into V–memory addresses within the master. The instruction allows the user the to specify the MODBUS Function Code, slave station address, starting master and slave memory addresses, number of elements to transfer, MODBUS data format and the Exception Response Buffer.

• Port Number: must be DL06 Port 2 (K2) • Slave Address: specify a slave station address (0–247) • Function Code: The following MODBUS function codes are supported by the MRX instruction: 01 – Read a group of coils 02 – Read a group of inputs 03 – Read holding registers 04 – Read input registers 07 – Read Exception status 08 – Diagnostics • Start Slave Memory Address: specifies the starting slave memory address of the data to be read. See the table on the following page. • Start Master Memory Address: specifies the starting memory address in the master where the data will be placed. See the table on the following page. • Number of Elements: specifies how many coils, input, holding registers or input register will be read. See the table on the following page. • MODBUS Data Format: specifies MODBUS 584/984 or 484 data format to be used • Exception Response Buffer: specifies the master memory address where the Exception Response will be placed. See the table on the following page.

DL06 Micro PLC User Manual; 3rd Edition Rev. A

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

4–23