The text of a manual · part 14 of 40
DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 4: Configuration and Connections, pages 115 to 123
Pages 115 to 123 of 379, from DL05 Micro PLC User Manual, Volume 1 of 2
The original document is the PDF (5.8 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 D0-05AA
Page 115
Chapter 4: Configuration and Connections
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. V2100 = 1088 decimal 1088 + Hold. Reg. = Holding Reg 1088
Find the Modbus address for User V location V2100. 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.
PLC Address (Dec) + Start Addr + Data Type
Y20 = 16 decimal 16 + 2048 + Coil = Coil 2064
1. Find Y outputs in the table. 2. Convert Y20 into decimal (16). 3. Add the starting address for the range (2048). 4. Use the Modbus data type from the table.
Example 3: T10 Current Value Outputs (V)
256
Y0 – Y377
2048 - 2303
Coil
PLC Address (Dec) + Data Type
Find the Modbus address to obtain the current value from Timer T10.
T10 = 8 decimal 8 + Input Reg. = Input Reg. 8
1. Find Timer Current Values in the table. 2. Convert T10 into decimal (8). 3. Use the Modbus data type from the table.
Example 4: C54 Timer Current Values (V)
128
V0 – V177
0 - 127
Input Register
Find the Modbus address for Control Relay C54. 1. Find Control Relays in the table.
PLC Address (Dec) + Start Addr. + Data Type
C54 = 44 decimal 44 + 3072 + Coil = 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)
4–10
PLC Address (Dec) + Data Type
Example 1: V2100
512
C0 – C77
3072 – 3583
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Coil
Page 116
Chapter 4: Configuration and Connections
If Your Modbus Host Software Requires an Address ONLY
1 2 3 • 484 Mode 4 • 584/984 Mode We recommend that you use the 584/984 addressing mode if your host software allows you 5 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 6 the address depends on the type of PLC data you are using. The PLC memory types are split into two categories for this purpose. 7 • Discrete – X, SP, Y, CR, S, T (contacts), C (contacts) • Word – V, Timer current value, Counter current value 8 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 9 group of data. 10 Discrete Data Types PLC Range Address (484 Address (584/984 Modbus Data DL05 Memory Type 11 (Octal) Mode) Mode) Type 12 13 14 A B C D 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:
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)
GX0-GX1746 GX1747-GX3777 X0 – X1777 SP0 – SP777 GY0 - GY3777 Y0 – Y1777 C0 – C3777 T0 – T377 CT0 – CT377 S0 – S1777
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
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Input Input Input Input Output Output Output Output Output Output
4–11
Page 117
Chapter 4: Configuration and Connections
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 4–12
Word Data Types Registers V-Memory (Timers) V-Memory (Counters)
V-Memory (Data Words)
PLC Range (Octal)
Input/Holding (484 Mode)*
Input/Holding (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 instruction 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, download the file modbus_conversion.xls from the www.automationdirect.com website.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 118
Chapter 4: Configuration and Connections
Example 1: V2100 584/984 Mode Find the Modbus address for user V-memory V2100. PLC Address (Dec) + Mode Address V2100 = 1088 decimal 1. Find V memory in the table. 1088 + 40001 = 41089
2. Convert V2100 into decimal (1088). 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.)
+
V0 – V177 V1200 – V7377 V2000 – V3777
0 – 127 512 – 639 1024 – 2047
128 128 1024
Appropriate Mode Address 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. 1. Find Y outputs in the table. 2. Convert Y20 into decimal (16). 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
PLC Address (Dec) + Start Addr + Mode Y20 = 16 decimal 16 + 2048 + 1 = 2065
2048 - 2367 3072 - 3551 6144 - 6271
1 1 1
1 1 1
Coil Coil Coil
Example 3: T10 Current Value 484 Mode PLC Address (Dec) + Mode Address T10 = 8 decimal
Find the Modbus address to obtain the current value for Timer T10.
8 + 3001 = 3009
1. Find Timer Current Values in the table. 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)
128 128 1024
PLC Address (Dec.)
+
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. 1. Find Control Relays in the table. 2. Convert C54 into decimal (44). 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
PLC Address (Dec) + Start Addr + Mode C54 = 44 decimal 44 + 3072 + 1 = 3117
2048 - 2367 3072 - 3551 6144 - 6271
1 1 1
1 1 1
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Coil Coil Coil
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
4–13
Page 119
Chapter 4: Configuration and Connections
Master Operation 1 Network This section describes how the DL05 PLC can communicate on a Modbus or DirectNET network as a master. For Modbus networks, it uses the Modbus RTU protocol, which must 2 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 3 logic for network master operation. 4 5 6 7 8 9 10 When using the DL05 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 11 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 12 with data in the instruction box to completely define the task, which goes to the port. 13 14 A B C D The following step-by-step procedure will provide you the information necessary to set up FA-ISOCON
Modbus
RTU Protocol, or DirectNET
Slave #1
Slave #2
Master
Network
WX (write) RX (read)
Master your ladder program to receive data from a network slave.
4–14
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Slave
Slave #3
Page 120
Chapter 4: Configuration and Connections
Step 1: Identify Master Port # and Slave #
F
2
0
1
1 2 Slave address (BCD) Port number (BCD) 3 Internal port (hex) 4 LD KF201 5 Step 2: Load Number of Bytes to Transfer The second Load (LD) instruction determines the 6 6 4 (BCD) number of bytes which will be transferred between the master and slave in the subsequent 7 WX or RX instruction. The value to be loaded is in BCD format (decimal), from 1 to 128 bytes. # of bytes to transfer 8 The number of bytes specified also depends on LD 9 the type of data you want to obtain. For example, K64 the DL05 Input points can be accessed by Vmemory locations or as X input locations. 10 However, if you only want X0 – X27, you’ll have to use the X input data type because the V11 memory locations can only be accessed in 2-byte increments. The following table shows the byte ranges for the various types of DirectLOGIC™ 12 products. 13 DL 05/205/350/405 Memory Bits per unit Bytes 14 A B DL330/340 Memory Bits per unit Bytes C D The first Load (LD) instruction identifies the communications port number on the network master (DL05) 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 DL05 PLC, port number 2. The lower byte contains the slave address number in BCD (01 to 99).
V-memory T / C current value Inputs (X, SP)
16 16 8
2 2 1
Outputs (Y, C, Stage, T/C bits)
8
1
Scratch Pad Memory Diagnostic Status
8 8
1 1
Data registers T / C accumulator
8 16
1 2
I/O, internal relays, shift register bits, T/C bits, stage bits Scratch Pad Memory Diagnostic Status(5 word R/W)
1
1
8 16
1 10
DL05 Micro PLC User Manual, 6th Edition, Rev. A
4–15
Page 121
Chapter 4: Configuration and Connections
Step 3: Specify Master Memory Area 4 0 6 0 0 (octal) 1 The third instruction in the RX or WX sequence is a Load Address (LDA) instruction. Its purpose is to Starting address of load the starting address of the memory area to be 2 master transfer area transferred. Entered as an octal number, the LDA instruction converts it to hex and places the result in 3 the accumulator. For a WX instruction, the DL05 CPU sends the 4 number of bytes previously specified from its V40600 LSB memory area beginning at the LDA address specified. MSB 5 For an RX instruction, the DL05 CPU reads the 15 0 number of bytes previously specified from the slave, V40601 MSB LSB placing the received data into its memory area 6 beginning at the LDA address specified. 15 0 NOTE: Since V-memory words are always 16 bits, you may not always use the whole word. For example, if 7 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 8 not affected. 9 Step 4: Specify Slave Memory Area SP116 The last instruction in our sequence is the WX or RX LD instruction itself. Use WX to write to the slave, and RX KF201 10 to read from the slave. All four of our instructions are shown to the right. In the last instruction, you must LD 11 specify the starting address and a valid data type for the K64 slave. LDA 12 • DirectNET slaves – specify the same address in the WX O40600 and RX instruction as the slave’s native I/O address • Modbus DL405, DL205, or DL05 slaves – specify the 13 RX same address in the WX and RX instruction as the slave’s Y0 native I/O address 14 • Modbus 305 slaves – use the following table to convert DL305 addresses to Modbus addresses A DL305 Series CPU Memory Type–to–Modbus Cross Reference (excluding 350 CPU) Modbus B PLC Memory Type PLC Base Address BaseModbus Address PLC Memory Type PLC Base Address Base Address C D LDA O40600
TMR/CNT Current Values I/O Points Data Registers Stage Status Bits (D3-330P only)
4–16
R600
V0
TMR/CNT Status Bits
CT600
GY600
IO 000 R401,R400
GY0 V100
Control Relays Shift Registers
CR160 SR400
GY160 GY400
S0
GY200
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 122
Chapter 4: Configuration and Connections
Communications from a Ladder Program Typically network communications will last longer than 1 scan. The program must wait for the communications to finish before starting the next transaction. SP117 Y1 SET Port 2, which can be a master, has two SP116 Special Relay contacts associated with LD KF201 it (see Appendix D for comm port Port Communication Error special relays). One indicates “Port LD Port Busy K0003 busy”(SP116), and the other indicates ”Port Communication Error”(SP117). LDA O40600 The example above shows the use of RX these contacts for a network master Y0 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. Interlocking Relay The “Port Communication Error” bit turns on SP116 C100 when the PLC has detected an error. Use of this bit LD is optional. When used, it should be ahead of any KF201 network instruction boxes since the error bit is reset LD when an RX or WX instruction is executed. K0003
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, C0 is set. When the port has finished the communication task, the second routine is executed and C0 is reset.
LDA O40600
Interlocking Relay
SP116
C100
RX VX0 C100 SET LD KF201 LD K0003 LDA O40400 WX VY0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
C100 RST
DL05 Micro PLC User Manual, 6th Edition, Rev. A
4–17
Page 123
Chapter 4: Configuration and Connections
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 4–18
Notes
DL05 Micro PLC User Manual, 6th Edition, Rev. A