Modicon Ladder Logic Block Library User Guide Volume 4

Transcription

ModiconLadder Logic BlockLibrary User GuideVolume 4840 USE 101 00043505766.814/2006This document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

iiThis document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

Table of ContentsSafety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviiAbout the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxixPart I General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Chapter 1Ladder Logic Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Segments and Networks in Ladder Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4How a PLC Solves Ladder Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Ladder Logic Elements and Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Chapter 2Memory Allocation in a PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . 15User Memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .State RAM Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .State RAM Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The Configuration Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .The I/O Map Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 31618202226Ladder Logic Opcodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Translating Ladder Logic Elements in the System Memory Database . . . . . . . . 28Translating DX Instructions in the System Memory Database . . . . . . . . . . . . . . 30Opcode Defaults for Loadables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Chapter 4Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Parameter Assignment of Instuctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35iiiThis document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

Chapter 5Instruction Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Instruction Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38ASCII Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Counters and Timers Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40Fast I/O Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Loadable DX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43Matrix Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Move Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Skips/Specials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Special Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Coils, Contacts and Interconnects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Chapter 6Equation Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Equation Network Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Mathematical Equations in Equation Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 55Mathematical Operations in Equation Networks . . . . . . . . . . . . . . . . . . . . . . . . . 59Mathematical Functions in Equation Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 64Data Conversions in an Equation Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Roundoff Differences in PLCs without a Math Coprocessor . . . . . . . . . . . . . . . . 68Benchmark Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69Chapter 7Closed Loop Control / Analog Values . . . . . . . . . . . . . . . . . . . 71Closed Loop Control / Analog Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72PCFL Subfunctions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73A PID Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77PID2 Level Control Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Chapter 8Formatting Messages for ASCII READ/WRIT Operations . . . 83Formatting Messages for ASCII READ/WRIT Operations . . . . . . . . . . . . . . . . . . 84Format Specifiers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Special Set-up Considerations for Control/MonitorSignals Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Chapter 9Coils, Contacts and Interconnects. . . . . . . . . . . . . . . . . . . . . . 91Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92Contacts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Interconnects (Shorts) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96Chapter 10Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97Chapter 11Subroutine Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99ivThis document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

Chapter 12Installation of DX Loadables . . . . . . . . . . . . . . . . . . . . . . . . . . 101Part II Instruction Descriptions (A to D) . . . . . . . . . . . . . . . . . 103Chapter 131X3X - Input Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Short Description: 1X3X - Input Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106Representation: 1X3X - Input Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Chapter 14AD16: Ad 16 Bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110Representation: AD16 - 16-bit Addition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Chapter 15ADD: Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114Representation: ADD - Single Precision Add . . . . . . . . . . . . . . . . . . . . . . . . . . 115Chapter 16AND: Logical And . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118Representation: AND - Logical And . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Parameter Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121Chapter 17BCD: Binary to Binary Code . . . . . . . . . . . . . . . . . . . . . . . . . . 123Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Representation: BCD - Binary Coded Decimal Conversion . . . . . . . . . . . . . . . 125Chapter 18BLKM: Block Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128Representation: BLKM - Block Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Chapter 19BLKT: Block to Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132Representation: BLKT - Block-to-Table Move. . . . . . . . . . . . . . . . . . . . . . . . . . 133Parameter Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Chapter 20BMDI: Block Move with Interrupts Disabled . . . . . . . . . . . . . 135Short Description: BMDI - Block Move Interrupts Disabled. . . . . . . . . . . . . . . . 136Representation: BMDI - Block Move Interrupts Disabled . . . . . . . . . . . . . . . . . 137Chapter 21BROT: Bit Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Short Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Representation: BROT - Bit Rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Parameter Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142vThis document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

Chapter 22CALL: Activate Immediate or Deferred DX Function . . . . . . 143Short Description: CALL - Activate Immediate or Deferred DX Function. . . . . . 144Representation: CALL - Activate Immediate DX Function . . . . . . . . . . . . . . . . . 145Representation: CALL - Activate Deferred DX Function . . . . . . . . . . . . . . . . . . 148Chapter 23CANT - Interpret Coils, Contacts, Timers, Counters,and the SUB Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151Short Description: CANT - Interpret Coils, Contacts, Timers,Counters, and the SUB Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152Representation: CANT - Interpret Coils, Contacts, Timers,Counters, and the SUB Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Parameter Description: CANT - Interpret Coils, Contacts, Timers,Counters, and the SUB Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154Chapter 24CHS: Configure Hot Standby . . . . . . . . . . . . . . . . . . . . . . . . . 157Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158Representation: CHS - Configure Hot Standby . . . . . . . . . . . . . . . . . . . . . . . . . 159Detailed Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160Chapter 25CKSM: Check Sum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164Representation: CKSM - Checksum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Chapter 26CMPR: Compare Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168Representation: CMPR - Logical Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170Chapter 27Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171Short Description: Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172General Usage Guidelines: Coils. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Chapter 28COMM - ASCII Communications Function . . . . . . . . . . . . . . 175Short Description: COMM - ASCII Communications Block . . . . . . . . . . . . . . . . 176Representation: COMM - ASCII Communications Function . . . . . . . . . . . . . . . 177Chapter 29COMP: Complement a Matrix . . . . . . . . . . . . . . . . . . . . . . . . . 179Short Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180Representation: COMP - Logical Compliment . . . . . . . . . . . . . . . . . . . . . . . . . . 181Parameter Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183Chapter 30Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Short Description: Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186Representation: Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187viThis document provided by Barr-Thorp Electric Co., Inc. 800-473-9123www.barr-thorp.com

Chapter 31CONV - Convert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189Short Description: CONV - Convert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190Representation: CONV - Convert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191Chapter 32CTIF - Counter, Timer, and Interrupt Function. . . . . . . . . . . . 193Short Description: CTIF - Counter, Timer, and Interrupt Function . . . . . . . . . . 194Representation: CTIF - Counter, Timer, Interrupt Function. . . . . . . . . . . . . . . . 195Parameter Description: CTIF - Register Usage Table (Top Node) . . . . . . . . . . 196Chapter 33DC

043505766.81 Modicon Ladder Logic Block Library User Guide Volume 4 840 USE 101 00 4/2006 7KLVGRFXPHQWSURYLGHGE\%DUU 7KRUS(OHFWULF&R ,QF ZZZ EDUU WKRUS FRP