You are on page 1of 3

PLC Instructions Studied

Examine On TON/TOF
Timer Time Base0.01 Preset Accum T4:1 500 0

EN

PLC Logic and Math Instructions
Lecture 14 Engineering 475 Automated Production Systems
L

Examine Off
Energize

DN

Latch

RTO Timer Time Base Preset Accum CTU/CTD Counter Preset Accum

T4:1 0.01 500 0

EN

DN

U

Unlatch T4:1 500 0 EN

RES

Reset

DN

Comparison Instructions
Relational operators exist in virtually all programming languages. Matlab if a <= b c=1.25 end C if (a <= b) c=1.25; Ladder Logic Comparison Instructions EQU LEQ NEQ GRT LES GEQ MEQ equal less than or equal not equal greater than less than greater than or equal masked compare for equal

Comparison Instructions - Syntax
Ladder Logic Comparison Instructions EQU LEQ NEQ GRT LES GEQ MEQ equal less than or equal not equal greater than less than greater than or equal masked compare for equal All of these instructions are used as inputs on a ladder rung to control rung outputs.

EQU Source A Source B if A = B then ____

Syntax
(Continued) LEQ Source A Source B if A <= B then _____ GRT Source A Source B if A > B then ______ Source Mask Compare

Masked Equal Instruction
MEQ Source Mask Compare The MEQ instruction permits a 16 bit word to be compared to another 16 bit word. A mask or filter can be set up to include/eliminate bits from the comparison. 1001001110011101 0000010000111000 0000010000001000

NEQ Source A Source B if A ~= B then ______

GEQ Source A Source B if A >= B then ______

if all of the bits in the source for which the mask is high (1) equals the bits in the compare then ________

1

(whole word move) XOR Source A Source B Dest MOV Source Dest Masked Move Instruction Syntax Binary and Hexidecimal Numbers Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Hexidecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F Example Hexidecimal numbers are a shorter method of representing binary numbers. They are frequently encountered when working with microprocessors.15 2 . Fig. (bit wise move) Move what is at one address to another address subject to a mask. perform the logic operation Source A * Source B. AND OR XOR NOT logical AND logical OR logical XOR logical NOT Syntax AND Source A Source B Dest Source A. Source B. and Dest are addresses where the information is stored. If the rung logic is true. 1616-bit word 1001 1011 0011 0010 hexidecimal 9B32 Geller. MOV MVM Move what is at one address to another address.14& 10. Source A: 1 Source B: 1 Dest: 1 Source A: 1 Source B: 0 Dest: 0 Source A: 0 Source B: 0 Dest: 0 Syntax (Continued) OR Source A Source B Dest NOT Source Dest Data Movement Instructions The data movement instructions are output instructions that are executed only if the rung logic is true. 10. and put the result in Dest(ination).Logical Instructions The PLC logical instructions are output functions that are performed only if the rung logic is true.

Math Instructions Math instructions are output instructions that are executed only if the rung logic is true. 2.ACC value was 24 and input I:0. 4. Show a rung that would turn on bit B3/19 if counter C5:3’s value is under 15 and timer T4:13 is below 25. DIV Source A Source B Dest Divide Source A by Source B and put the result in Dest 3 . Show an example of how you would turn on memory bit B3/4 only when the timer T4:10.1/2 was on. Simple Math Instruction Syntax (Continued) MUL Source A Source B Dest Multiply Source A and Source B and put the result in Dest Assignment 1. ACCUM value to location N7:25 whenever B3/18 is on. Show how your would move the counter C8:5. Simple Math Instructions ADD SUB MUL DIV More Complex Math Instructions DDV NEG CLR TOD FRD DCD Simple Math Instruction Syntax ADD Source A Source B Dest Add Source A to Source B and put the result in Dest SUB Source A Source B Dest Subtract Source B from Source A and put the result in Dest Reference Geller for descriptions of the “More Complex Math Instructions”. ACC value was between 5 and 12. Show an example of how you could use the LEQ and GEQ instructions together to turn on memory bit B3/7 if the counter C5:6. 3.