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

The text of a manual · part 16 of 53

DL06 Micro PLC User Manual, Volume 1 of 2, pages 150 to 159

Pages 150 to 159 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 150

Chapter 4: System Design and Configuration

MRX Slave Memory Address MRX Slave Address Ranges 1 Function Code MODBUS Data Format Slave Address Range(s) 2 3 4 5 6 MRX Master Memory Addresses 7 MRX Master Memory Address Ranges Operand Data Type DL06 Range 8 9 10 11 12 MRX Number of Elements 13 Number of Elements DL06 Range 14 A MRX Exception Response Buffer B Exception Response Buffer Operand Data Type DL06 Range C D 01 – Read Coil 01 – Read Coil 02 – Read Input Status

484 Mode 584/984 Mode 484 Mode

02 – Read Input Status

584/984 Mode

03 – Read Holding Register

484 Mode

03 – Read Holding Register

584/984

04 – Read Input Register

484 Mode

04 – Read Input Register

584/984 Mode

07 – Read Exception Status 08 – Diagnostics

484 and 584/984 Mode 484 and 584/984 Mode

Inputs X Outputs Y Control Relays C Stage Bits S Timer Bits T Counter Bits CT Special Relays SP V–memory V Global Inputs GX Global Outputs GY

0–1777 0–1777 0–3777 0–1777 0–377 0–377 0–777 All 0–3777 0–3777

Operand Data Type V–memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K

All 1–2000

V–memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

All

4–24

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

1–999 1–65535 1001–1999 10001–19999 (5 digit) or 100001–165535 (6 digit) 4001–4999 40001–49999 (5 digit) or 4000001–465535 (6 digit) 3001–3999 30001–39999 (5 digit) or 3000001–365535 (6 digit) n/a 0–65535

Page 151

Chapter 4: System Design and Configuration

MODBUS Write to Network (MWX) The MODBUS Write to Network (MWX) instruction is used to write a block of data from the network masters’s (DL06) memory to MODBUS memory addresses within a slave device on the network. The instruction allows the user 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.

1 2 3 4 5 6 7 8 9 • Port Number: must be DL06 Port 2 (K2) • Slave Address: specify a slave station address (0–247) 10 • Function Code: The following MODBUS function codes are supported by the MWX instruction: 11 05 – Force Single coil 06 – Preset Single Register 12 08 – Diagnostics 15 – Force Multiple Coils 13 16 – Preset Multiple Registers • Start Slave Memory Address: specifies the starting slave memory address where the data will 14 be written. • Start Master Memory Address: specifies the starting address of the data in the master that is A to written to the slave. • Number of Elements: specifies how many consecutive coils or registers will be written to. B This field is only active when either function code 15 or 16 is selected. • MODBUS Data Format: specifies MODBUS 584/984 or 484 data format to be used. C • Exception Response Buffer: specifies the master memory address where the Exception Response will be placed. D DL06 Micro PLC User Manual; 3rd Edition Rev. A

4–25

Page 152

Chapter 4: System Design and Configuration Chapter 4: CPU Specifications and Operation

MWX Slave Memory Address

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

MWX Slave Address Ranges Function Code

MODBUS Data Format

05 – Force Single Coil 05 – Force Single Coil 06 – Preset Single Register

484 Mode 584/984 Mode 484 Mode

06 – Preset Single Register

84/984 Mode

08 – Diagnostics 15 – Force Multiple Coils 15 – Force Multiple Coils 16 – Preset Multiple Registers

484 and 584/984 Mode 484 585/984 Mode 484 Mode

16 – Preset Multiple Registers

584/984 Mode

Slave Address Range(s) 1–999 1–65535 4001–4999 40001–49999 (5 digit) or 400001–465535 (6 digit) 0–65535 1–999 1–65535 4001–4999 40001–49999 (5 digit) or 4000001–465535 (6 digit)

MWX Master Memory Addresses MRX Master Memory Address Ranges Operand Data Type

DL06 Range

Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . Stage Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Timer Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Counter Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Special Relays. . . . . . . . . . . . . . . . . . . . . . . . . . . . V–memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Global Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . Global Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . .

X Y C S T CT SP V GX GY

0–777 0–777 0–1777 0–1777 0–377 0–177 0–777 All 0–3777 0–3777

MWX Number of Elements Number of Elements Operand Data Type

DL06 Range

V–memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

V K

All 1–2000

MWX Exception Response Buffer Exception Response Buffer Operand Data Type V–memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4–26

V

DL06 Range All

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

Page 153

Chapter 4: System Design and Configuration

MRX/MWX Example in DirectSOFT 5 DL06 port 2 has two Special Relay contacts associated with it (see Appendix D for comm port special relays). One indicates “Port busy”(SP116), and the other indicates ”Port Communication Error”(SP117). 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 PLC has detected an error and 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 MRX or MWX instruction is executed. Typically network communications will last longer than 1 CPU scan. The program must wait for the communications to finish before starting the next transaction. 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 below, after the MRX 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. See example on the next 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–27

Page 154

Chapter 4: System Design and Configuration Pulse/Minute

_1Minute

1

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

C20 ( PD )

SP3

Calculation of communication transfer quantity per minute between PLC and device. Pulse/Minute

2

LD

C20

CTA1 OUT Transactions/Min

V3600 LD CTA2 OUT Errors/Minute

V3601 SP116 pulses on every transaction - CT1 counts the transactions per minute. The counter is reset every minute. Port 2 busy bit

3

CNT

SP116

Number of transactions per minute

Pulse/Minute

C20

CT1 K9999

SP117 pulses on every transaction - CT2 counts the errors per minute. The counter is reset every minute. Port 2 error bit

4

CNT

SP117

Number of errors per minute

Pulse/Minute

C20

CT2 K9999

This rung does a MODBUS write to the first holding register 40001 of slave address number one. It writes the values over that reside in V2000. This particular function code only writes to one register. Use function code 16 to write to multiple registers. Only one Network Instruction (WX, RX, MWX, MRX) can be enabled in one scan. That is the reason for the interlock bits. For using many network instructions on the same port, use the Shift Register instruction. Port 2 busy bit

SP116

C100

MWX Port Number: K2 Slave Address: K1 Function Code: 06 - Preset Single Register Start Slave Memory Address: 40001 Number of Elements: n/a Modbus Data Type: 584/984 Mode Exception Response Buffer: V400

3

Instruction interlock bit C100 ( SET ) This rung does a MODBUS read from the first 32 coils of slave address number one. It will place the values into 32 bits of the master starting at C0. Port 2 busy bit

4

SP116

C100

MRX Port Number: K2 Slave Address: K1 Function Code: 01 - Read Coil Status Start Slave Memory Address: 1 Start Master Memory Address: C0 Number of Elements: 32 Modbus Data Type: 584/984 Mode Exception Response Buffer: V400

Instruction interlock bit C100 ( RST )

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

Page 155

STANDARD RLL INSTRUCTIONS

CHAPTER

5

In This Chapter Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–2 Using Boolean Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–5 Boolean Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–10 Comparative Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–26 Immediate Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–32 Timer, Counter and Shift Register Instructions . . . . . . . . . . . . . . . .5–39 Accumulator/Stack Load and Output Data Instructions . . . . . . . . .5–52 Logical Instructions (Accumulator) . . . . . . . . . . . . . . . . . . . . . . . . .5–69 Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–86 Transcendental Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–118 Bit Operation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–120 Number Conversion Instructions (Accumulator) . . . . . . . . . . . . . .5–127 Table Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–141 Clock/Calendar Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–171 CPU Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–173 Program Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–175 Interrupt Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–183 Message Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–186 Intelligent I/O Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–194 Network Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–196 MODBUS RTU Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–204 ASCII Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5–210 Intelligent Box (IBox) Instructions . . . . . . . . . . . . . . . . . . . . . . . .5–230

Page 156

Chapter 5: Standard RLL Instructions

Introduction DL06 Micro PLCs offer a wide variety of instructions to perform many different types of 1 operations. This chapter shows you how to use each standard Relay Ladder Logic (RLL) instruction. In addition to these instructions, you may also need to refer to the Drum 2 instruction in Chapter 6, the Stage programming instructions in Chapter 7,PID in Chapter 8, LCD in Chapter 10 and programming for analog modules in D0-OPTIONS-M. 3 There are two ways to quickly find the instruction you need. • If you know the instruction category (Boolean, Comparative Boolean, etc.) just use the title at the 4 top of the page to find the pages that discuss the instructions in that category. • If you know the individual instruction name, use the following table to find the page(s) that 5 Instruction discusses the instruction. Page Instruction Page 6 7 8 9 10 11 12 13 14 A B C D Accumulating Fast Timer (TMRAF)

5–42

And Store (AND STR)

Accumulating Timer (TMRA)

5–42

And with Stack (ANDS)

5–72

Add (ADD)

5–86

Arc Cosine Real (ACOSR)

5–119

Add Binary (ADDB)

5–99

Arc Sine Real (ASINR)

5–118

Add Binary Double (ADDBD)

5–100

Arc Tangent Real (ATANR)

5–119

Add Binary Top of Stack (ADDBS)

5–114

ASCII Clear Buffer (ACRB)

5–228

Add Double (ADDD)

5–87

ASCII Compare (CMPV)

5–220

Add Formatted (ADDF)

5–106

ASCII Constant (ACON)

5–187

Add Real (ADDR)

5–88

ASCII Extract (AEX)

5–219

Add to Top (ATT)

5–162

ASCII Find (AFIND)

5–216

Add Top of Stack (ADDS)

5–110

ASCII Input (AIN)

5–212

And (AND)

5–14

ASCII Print from V–memory (PRINTV)

5–226

And Bit-of-Word (AND)

5–15

ASCII Print to V–memory (VPRINT)

5–221

And (AND)

5–31

ASCII Swap Bytes (SWAPB)

5–227

AND (AND logical)

5–69

ASCII to HEX (ATH)

5–134

And Double (ANDD)

5–70

Binary (BIN)

5–127

And Formatted (ANDF)

5–71

Binary Coded Decimal (BCD)

5–128

And If Equal (ANDE)

5–28

Binary to Real Conversion (BTOR)

5–131

And If Not Equal (ANDNE)

5–28

Compare (CMP)

5–81

And Immediate (ANDI)

5–33

Compare Double (CMPD)

5–82

AND Move (ANDMOV)

5–167

Compare Formatted (CMPF)

5–83

And Negative Differential (ANDND)

5–22

Compare Real Number (CMPR)

5–85

And Not (ANDN)

5–14

Compare with Stack (CMPS)

5–84

And Not Bit-of-Word (ANDN)

5–15

Cosine Real (COSR)

5–118

And Not (ANDN)

5–31

Counter (CNT)

5–45

And Not Immediate (ANDNI)

5–33

Data Label (DLBL)

5–187

And Positive Differential (ANDPD)

5–22

Date (DATE)

5–171

5–2

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

5–16

Page 157

Chapter 5: Standard RLL Instructions Instruction

Page

Instruction

Decode (DECO)

5–126

Load Accumulator Indexed from Data Constants (LDSX) 5–62

Decrement (DEC)

5–98

Load Address (LDA)

5–60

Decrement Binary (DECB)

5–105

Load Double (LDD)

5–58

Degree Real Conversion (DEGR)

5–133

Load Formatted (LDF)

5–59

Disable Interrupts (DISI)

5–184

Load Immediate (LDI)

5–37

Divide (DIV)

5–95

Load Immediate Formatted (LDIF)

5–38

Divide Binary (DIVB)

5–104

Load Label (LDLBL)

5–142

Divide Binary by Top OF Stack (DIVBS)

5–117

Load Real Number (LDR)

5–63

Divide by Top of Stack (DIVS)

5–113

Master Line Reset (MLR)

5–181

Divide Double (DIVD)

5–96

Master Line Set (MLS)

5–181

Divide Formatted (DIVF)

5–109

MODBUS Read from Network (MRX)

5–204

Divide Real (DIVR)

5–97

MODBUS Write to Network (MWX)

5–207

Enable Interrupts (ENI)

5–183

Move Block (MOVBLK)

5-189

Encode (ENCO)

5–125

Move (MOV)

5–141

End (END)

5–173

Move Memory Cartridge (MOVMC)

5–142

Exclusive Or (XOR)

5–77

Multiply (MUL)

5–92

Exclusive Or Double (XORD)

5–78

Multiply Binary (MULB)

5–103

Exclusive Or Formatted (XORF)

5–79

Multiply Binary Top of Stack (MULBS)

5–116

Exclusive OR Move (XORMOV)

5–167

Multiply Double (MULD)

5–93

Exclusive Or with Stack (XORS)

5–80

Multiply Formatted (MULF)

5–108

Fault (FAULT)

5–186

Multiply Real (MULR)

5–94

Fill (FILL)

5–146

Multiply Top of Stack (MULS)

5–112

Find (FIND)

5–147

No Operation (NOP)

5–173

Find Block (FINDB)

5–169

Not (NOT)

5–19

Find Greater Than (FDGT)

5–148

Numerical Constant (NCON)

5–187

For / Next (FOR) (NEXT)

5–176

Or (OR)

5–12

Goto Label (GOTO) (LBL)

5–175

Or (OR)

5–30

Goto Subroutine (GTS) (SBR)

5–178

Or (OR logical)

5–73

Gray Code (GRAY)

5–138

Or Bit-of-Word (OR)

5–13

HEX to ASCII (HTA)

5–135

Or Double (ORD)

5–74

Increment (INC)

5–98

Or Formatted (ORF)

5–75

Increment Binary (INCB)

5–105

Or If Equal (ORE)

5–27

Interrupt (INT)

5–183

Or If Not Equal (ORNE)

5–27

Interrupt Return (IRT)

5–183

Or Immediate (ORI)

5–32

Interrupt Return Conditional (IRTC)

5–183

OR Move (ORMOV)

5–167

Invert (INV)

5–129

Or Negative Differential (ORND)

5–21

LCD

5–200

Or Not (ORN)

5–12

Load (LD)

5–57

Or Not (ORN)

5–30

Load Accumulator Indexed (LDX)

5–61

Or Not Bit-of-Word (ORN)

5–13

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

Page

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

5–3

Page 158

Chapter 5: Standard RLL Instructions

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

Instruction

Page

Instruction

Page

Or Not Immediate (ORNI)

5–32

Shuffle Digits (SFLDGT)

5–139

Or Out (OROUT)

5–17

Sine Real (SINR)

5–118

Or Out Immediate (OROUTI)

5–34

Source to Table (STT)

5–156

Or Positive Differential (ORPD)

5–21

Square Root Real (SQRTR)

5–119

Or Store (ORSTR)

5–16

Stage Counter (SGCNT)

5–47

Or with Stack (ORS)

5–76

Stop (STOP)

5–173

Out (OUT)

5–17

Store (STR)

5–10

Out Bit-of-Word (OUT)

5–18

Store (STR)

5–29

Out (OUT)

5–64

Store Bit-of-Word (STRB)

5–11

Out Double (OUTD)

5–64

Store If Equal (STRE)

5–26

Out Formatted (OUTF)

5–65

Store If Not Equal (STRNE)

5–26

Out Immediate (OUTI)

5–34

Store Immediate (STRI)

5–32

Out Immediate Formatted (OUTIF)

5–35

Store Negative Differential (STRND)

5–20

Out Indexed (OUTX)

5–67

Store Not (STRN)

5–29

Out Least (OUTL)

5–68

Store Not (STRN)

5–10

Out Most (OUTM)

5–68

Store Not Bit-of-Word (STRNB)

5–11

Pause (PAUSE)

5–25

Store Not Immediate (STRNI)

5–32

Pop (POP)

5–65

Store Positive Differential (STRPD)

5–20

Positive Differential (PD)

5–19

Subroutine Return (RT)

5–178

Print Message (PRINT)

5–190

Subroutine Return Conditional (RTC)

5–178

Radian Real Conversion (RADR)

5–133

Subtract (SUB)

5–89

Read from Intelligent I/O Module (RD)

5-194

Subtract Binary (SUBB)

5–101

Read from Network (RX)

5–196

Subtract Binary Double (SUBBD)

5–102

Real to Binary Conversion (RTOB)

5–132

Subtract Binary Top of Stack (SUBBS)

5–115

Remove from Bottom (RFB)

5–153

Subtract Double (SUBD)

5–90

Remove from Table (RFT)

5–159

Subtract Formatted (SUBF)

5–107

Reset (RST)

5–23

Subtract Real (SUBR)

5–91

Reset Bit-of-Word (RST)

5–24

Subtract Top of Stack (SUBS)

5–111

Reset Immediate (RSTI)

5–36

Sum (SUM)

5–120

Reset Watch Dog Timer (RSTWT)

5–174

Swap (SWAP)

5–170

Rotate Left (ROTL)

5–123

Table Shift Left (TSHFL)

5–165

Rotate Right (ROTR)

5–124

Table Shift Right (TSHFR)

5–165

RSTBIT

5–144

Table to Destination (TTD)

5–150

Segment (SEG)

5–137

Tangent Real (TANR)

5–118

Set (SET)

5–23

Ten’s Complement (BCDCPL)

5–130

Set Bit-of-Word (SET)

5–24

Time (TIME)

5–172

Set Immediate (SETI)

5–36

Timer (TMR) and Timer Fast (TMRF)

5–40

SETBIT

5–144

Up Down Counter (UDC)

5–49

Shift Left (SHFL)

5–121

Write to Intelligent I/O Module (WT)

5-195

Shift Register (SR)

5–51

Write to Network (WX)

5–198

Shift Right (SHFR)

5–122

5–4

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

Page 159

Chapter 5: Standard RLL Instructions - Boolean Instructions

Using Boolean Instructions

1 2 3 4 5 6 The following paragraphs show how these instructions are used to build simple ladder 7 programs. END Statement 8 All DL06 programs require an END statement as the last instruction. This tells the CPU that this is the end of the program. Normally, any instructions placed after the END statement 9 will not be executed. There are exceptions to this such as interrupt routines, etc. This chapter will discuss the instruction set in detail. 10 11 12 Simple Rungs 13 You use a contact to start rungs that contain both contacts and coils. The boolean instruction that does this is called a Store or, STR instruction. The output point is represented by the Output or, OUT instruction. The following example shows how to enter a single contact and 14 a single output coil. A B C D Do you ever wonder why so many PLC manufacturers always quote the scan time for a 1K Boolean program? Simple. Most all programs utilize many Boolean instructions. These are typically very simple instructions designed to join input and output contacts in various series and parallel combinations. Our DirectSOFT 5 software is a similar program. It uses graphic symbols to develop a program; therefore, you don't necessarily have to know the instruction mnemonics in order to develop your program. Many of the instructions in this chapter are not program instructions used in DirectSOFT 5, but are implied. In other words, they are not actually keyboard commands, however, they can be seen in a Mnemonic View of the program once the DirectSOFT 5 program has been developed and accepted (compiled). Each instruction listed in this chapter will have a small chart to indicate how the instruction is used with DirectSOFT 5 and the HPP. DS5 Implied

HPP

X0

Used

DirectSOFT DirectSOFT325Example

All programs must have an END statement

Y0

OUT

END

DirectSOFT DirectSOFT325Example

X0

Y0

OUT

Handheld Mnemonics STR X0 OUT Y0 END

END

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

5–5