Rail (+V) Rail (0 V) A B Variable in ladder logic programming is called TAG. TAG is linked to ladder logic instruction. Created variables TAG and their types are gathered in Datablock. C 1 2 3 4 5 6 Ladder fundamentals Terminology BOOL 1 = TRUE = HIGH = ON BOOL 0 = FALSE = LOW = OFF NO & NC CONTACTS NO INPUT = 1 ➔ | | ➔ OUTPUT = 1 NC INPUT = 1 ➔ |\| ➔ OUTPUT = 0 TRUTH TABLES INPUTS OUTPUT A B X 0 0 0 0 1 1 1 0 1 1 1 0 TRUTH TABLES INPUTS OUTPUT A B C X 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 Boolean Algebra • Multiplication = Logical AND • Addition = Logical OR • ! = logical inversion (NOT) Example • X = AB (X equals A AND B) • Y = A + !B (Y equals A OR NOT B) The normally open (NO) Contact • Basic Instruction: If A, Then X • If Boolean tag A is true then make tag X true else, make tag X false • Bool algebra X = A TAG.1A TAG.1X The normally open (NO) Contact • Basic Instruction: If A, Then X • If Boolean tag A is true then make tag X true else, make tag X false • Bool algebra X = A TAG.1A TAG.1X The normally open (NO) Contact • Basic Instruction: If A, Then X • If Boolean tag A is true then make tag X true else, make tag X false • Bool algebra X = A TAG.1A TAG.1X The normally open (NO) Contact • Basic Instruction: If A, Then X • If Boolean tag A is true then make tag X true else, make tag X false • Bool algebra X = A TAG.1A TAG.1X The normally closed (NC) Contact • Basic Instruction: IF NOT (A), Then X • If Boolean tag A is NOT true then make tag X true else, make tag X false • Bool algebra X = !(A) • NOTE: NOT is represented by an NC contact TAG.2A TAG.2X The normally closed (NC) Contact • Basic Instruction: IF NOT (A), Then X • If Boolean tag A is NOT true then make tag X true else, make tag X false • Bool algebra X = !(A) • NOTE: NOT is represented by an NC contact TAG.2A TAG.2X Combining Contacts: The AND Instruction (IF (A AND B), Then X Truthe Table: • Basic Instruction: AND- If (A AND B), Then X A B X • If A & B are true then make X true 0 0 0 else, make X false 0 1 0 1 0 0 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional series NO contact for each tag. For example A AND B AND C AND D can be achieved by Adding a 2 series NO contacts. TAG.3A TAG.3B TAG.3X Combining Contacts: The AND Instruction (IF (A AND B), Then X Truthe Table: • Basic Instruction: AND- If (A AND B), Then X A B X • If A & B are true then make X true 0 0 0 else, make X false 0 1 0 1 0 0 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional series NO contact for each tag. For example A AND B AND C AND D can be achieved by Adding a 2 series NO contacts. TAG.3A TAG.3B TAG.3X Combining Contacts: The AND Instruction (IF (A AND B), Then X Truthe Table: • Basic Instruction: AND- If (A AND B), Then X A B X • If A & B are true then make X true 0 0 0 else, make X false 0 1 0 1 0 0 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional series NO contact for each tag. For example A AND B AND C AND D can be achieved by Adding a 2 series NO contacts. TAG.3A TAG.3B TAG.3X Combining Contacts: The AND Instruction (IF (A AND B), Then X Truthe Table: • Basic Instruction: AND- If (A AND B), Then X A B X • If A & B are true then make X true 0 0 0 else, make X false 0 1 0 1 0 0 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional series NO contact for each tag. For example A AND B AND C AND D can be achieved by Adding a 2 series NO contacts. TAG.3A TAG.3B TAG.3X Combining Contacts: The OR Instruction (IF (A OR B), Then X Truthe Table: • Basic Instruction: OR- If (A OR B), Then X A B X • If A OR B is true then make X true 0 0 0 else, make X false 0 1 1 1 0 1 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional parallel NO contact for each tag. For example A OR B OR C OR D can be achieved by Adding a 2 parallel NO contacts. TAG.4A TAG.4B TAG.4X Combining Contacts: The OR Instruction (IF (A OR B), Then X Truthe Table: • Basic Instruction: OR- If (A OR B), Then X A B X • If A OR B is true then make X true 0 0 0 else, make X false 0 1 1 1 0 1 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional parallel NO contact for each tag. For example A OR B OR C OR D can be achieved by Adding a 2 parallel NO contacts. TAG.4A TAG.4B TAG.4X Combining Contacts: The OR Instruction (IF (A OR B), Then X Truthe Table: • Basic Instruction: OR- If (A OR B), Then X A B X • If A OR B is true then make X true 0 0 0 else, make X false 0 1 1 1 0 1 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional parallel NO contact for each tag. For example A OR B OR C OR D can be achieved by Adding a 2 parallel NO contacts. TAG.4A TAG.4B TAG.4X Combining Contacts: The OR Instruction (IF (A OR B), Then X Truthe Table: • Basic Instruction: OR- If (A OR B), Then X A B X • If A OR B is true then make X true 0 0 0 else, make X false 0 1 1 1 0 1 1 1 1 • Bool algebra X = AB • NOTE: Can be expanded to contain more input tags by adding an additional parallel NO contact for each tag. For example A OR B OR C OR D can be achieved by Adding a 2 parallel NO contacts. TAG.4A TAG.4B TAG.4X Best Practice: Multiple Outputs • Multiple outputs can be used in a network, they may be placed in series or parallel with each other, best practice is to place them in parallel with each other. TAG.5A TAG.5B TAG.5Y TAG.5X TAG.5Z Best Practice: Multiple Outputs • Multiple outputs can be used in a network, they may be placed in series or parallel with each other, best practice is to place them in parallel with each other. TAG.5A TAG.5B TAG.5Y TAG.5X TAG.5Z Best Practice: Multiple Outputs • Multiple outputs can be used in a network, they may be placed in series or parallel with each other, best practice is to place them in parallel with each other. TAG.5A TAG.5B TAG.5Y TAG.5X TAG.5Z Exercise: Three Input AND Instruction • Write a ladder logic to represent a 3 input AND instruction which takes inputs A, B and C, and has output X. Note that input C should be inverted. • Boolean algebra for this Instruction: X=(A)(B)(!C) • Verbal Reading of this instruction: X equals A AND B AND NOT C Question for this assignment: • How many input combinations produced a TRUE output for X? • How many input combinations are possible for a 3 input instruction? (Hint: for Boolean/ binary logic, the number of input combinations is 2^n, where n is the number of inputs. Exercise: Three Input AND Instruction • Write a ladder logic to represent a 3 input AND instruction which takes inputs A, B and C, and has output X. Note that input C should be inverted. X = (A)(B)(!C) A B C X 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 Exercise: Three Input OR Instruction • Write a ladder logic to represent a 3 input OR instruction which takes inputs A, B and C, and has output X. Note that input C should be inverted. • Boolean algebra for this Instruction: X=A+B+(!C) • Verbal Reading of this instruction: X equals A OR B OR NOT C Question for this assignment: • Which instruction is more likely to produce a TRUE output between the AND instruction and the OR instruction? • How many input combinations are possible for a 3 input instruction? (Hint: for Boolean/ binary logic, the number of input combinations is 2^n, where n is the number of inputs. Exercise: Three Input OR Instruction • Write a ladder logic to represent a 3 input OR instruction which takes inputs A, B and C, and has output X. Note that input C should be inverted. X = (A)(B)(!C) A B C X 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 Combining Contacts: The XOR Instruction (IF (A XOR B), Then X • If either A or B is true, but not both at the same time, then make X true (if only one input is true, make X true) Else, make X false • Equivalent Bool Algebra X = (!A)(B) + (A)(!B) TAG.8A TAG.8B TAG.8A TAG.8B Truthe Table: A B X 0 0 0 0 1 1 1 0 1 1 1 0 TAG.8X Combining Contacts: The XOR Instruction (IF (A XOR B), Then X • If either A or B is true, but not both at the same time, then make X true (if only one input is true, make X true) Else, make X false • Equivalent Bool Algebra X = (!A)(B) + (A)(!B) TAG.8A TAG.8B TAG.8A TAG.8B Truthe Table: A B X 0 0 0 0 1 1 1 0 1 1 1 0 TAG.8X Combining Contacts: The XOR Instruction (IF (A XOR B), Then X • If either A or B is true, but not both at the same time, then make X true (if only one input is true, make X true) Else, make X false • Equivalent Bool Algebra X = (!A)(B) + (A)(!B) TAG.8A TAG.8B TAG.8A TAG.8B Truthe Table: A B X 0 0 0 0 1 1 1 0 1 1 1 0 TAG.8X Combining Contacts: The XOR Instruction (IF (A XOR B), Then X • If either A or B is true, but not both at the same time, then make X true (if only one input is true, make X true) Else, make X false • Equivalent Bool Algebra X = (!A)(B) + (A)(!B) TAG.8A TAG.8B TAG.8A TAG.8B Truthe Table: A B X 0 0 0 0 1 1 1 0 1 1 1 0 TAG.8X Lab Assignment: Three Input XOR Instruction • Write a ladder logic to represent a 3 input XOR Instruction which takes inputs A, B and C, and has an output X. • Boolean Algebra for this instruction X = ABC • Equivalent Boolean Algebra for this Instruction: X=(A)(!B)(!C)+((!A)(!B)(C)+(!A)(B)(!C)+(A)(B)(C) Verbal Reading of this instruction: X equals A XOR B XOR C Questions for this assignment 1. True or False? An XOR instruction produces a TRUE output when it has an ODD number of TRUE inputs? The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. TAG.10A TAG.10X TAG.10B TAG.10X The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. Press TAG.10A TAG.10X TAG.10B TAG.10X The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. Press TAG.10A TAG.10X TAG.10B TAG.10X The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. Unpress TAG.10A TAG.10X TAG.10B TAG.10X The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. Press TAG.10A TAG.10X TAG.10B TAG.10X The Latch Circuit • Often used for Basic Motor Start/Stop • If Input A is made TRUE, output X should become true and remain true regardless of whether input A is true or false. • Output X should only become false if input B is made true. • Note: Outputs may be used as inputs. TAG.10A TAG.10X TAG.10B TAG.10X