PLC Programming Notes

Numbering Systems

  • PLCs use numbering systems for various functions like input addresses and math instructions.

  • Different data types require multiple numbering systems.

Five Commonly Used Numbering Systems in PLCs

  • Hexadecimal

  • Decimal

  • Binary

  • Octal

  • Binary Coded Decimal (BCD)

Hexadecimal

  • Base 16, using 0-9 and A-F (A=10, B=11, C=12, D=13, E=14, F=15).

Decimal

  • Base 10, using 0-9. Most common numbering system.

Binary

  • Base 2, using 0 and 1. Used by computers to represent switch states (off/on).

Octal

  • Base 8, using 0-7. Less common than binary and hexadecimal.

Binary Coded Decimal (BCD)

  • Represents each decimal digit with a binary value (e.g., 0 = 0000, 9 = 1001).

  • Example: Decimal 10 in BCD is 0001 0000, not 1010 (binary).

Decimal Numbering System

  • Base 10, uses numerals 0-9.

  • Place value assigns a power to each position (right-most is power 0).

Numbering System Weighting

  • Each position's weight is the base raised to the power of the position.

  • Decimal system weights: 1, 10, 100, 1000, etc.

  • Value is computed by multiplying each digit by its position's weight and summing the results.

Least and Most Significant Digits

  • Least Significant Digit (LSD): Right-most digit with the lowest value.

  • Most Significant Digit (MSD): Left-most digit with the highest value.

Binary Numbering System

  • Base 2, includes symbols 0 and 1.

Uses of Binary Numbers

  • Digital electronics use two voltage levels to represent 11 (high) and 00 (low).

  • PLCs use binary to track status of inputs, outputs, and memory instructions.

Weighted Values in Binary Numbers

  • Values are expressed by assigning a weighted value to each position (right to left).

  • Weights are powers of 2 (1, 2, 4, 8, 16, 32, 64, etc.).

Converting Binary to Decimal

  • Multiply each digit by its weighting factor and sum the products.

Converting Decimal to Binary

  • Use successive division by 2 until the answer is zero.

  • Remainders of 1 produce a binary 1; remainders less than 1 produce a binary 0.

  • Arrange remainders from right (LSD) to left (MSD).

Decimal to Binary Example

  • Convert 112 to binary: Divide by 2, track remainders, and arrange.

Arrangement of Binary Numbers

  • Arranged in groups of eight digits by adding zeros to the left.

Processor Files

  • A processor file is a collection of program and data files that contains all the instructions, data, and configuration information related to a PLC program.

Processor Memory Files

  • Data Files

  • Force Files

  • I/O Configuration

  • Ladder

  • SFC

  • Structured Text

  • System

PLC Software Advantages

  • Easier Viewing

  • Program Storage

  • Easier Editing/Entry

Steps to Create a New Program

  • Open the Software

  • Select New File

  • Select the Processor

  • Insert Rungs

  • Enter Instructions

  • Assign PLC Addresses

  • Complete the Program

  • Verify the Project

Modifying a PLC Project

  • Delete Rungs

  • Modify Rungs

  • Modify Instruction Address

  • Modify Instruction Type

Multiple Input Instruction Advantages

  • PLCs allow multiple instructions to be controlled by one input.

  • Use the same input address for all instructions.

XIO Instruction

  • Input device and instruction do not need to have the same logic.

  • Stop pushbuttons use normally closed contacts for safety.

Multiple Outputs

  • Branch the outputs.

  • Place each output on a separate rung with multiple input instructions using the same address.

PLC Motor Control

  • Direct Control

  • Indirect Control

Direct Control

  • Current flows directly between the motor and the output terminal.

  • Use only for small motors (usually below two amps).

Indirect Control

  • Uses contactor contacts to separate PLC control electricity from motor power electricity.

  • Magnetic motor starter includes contactor and overload protection.

Motor Starter Overload Condition

  • Overload protection circuits detect excessive current and cut control power to the contactor.

Indirect Control in Fluid Power Motors

  • Uses a solenoid-operated directional control valve.

PLC Output Diagram

  • Shows control wiring of electric motor.

  • Includes N.C. contacts controlled by the motor starter overload device.

Power Diagram

  • Shows the power wiring.

  • Symbol for starter includes contacts labeled by the same name as the motor starter coil.

PLC Output Program

  • The wiring is between the output terminal and the solenoid of the valve.

  • The solenoid in the power diagram will have the same label as it does in the output diagram.

OTE Instruction

  • PLC input instructions (XICs and XIOs) can be controlled by OTE output instructions using the same address.

OTE Instruction Compared to Relay Contacts

  • PLC uses instructions instead of physical hardware.

  • OTE instruction can control many input contacts in any combination of XIC and XIO instructions.

Three Applications Given Output Addresses

  • Sequencing operations

  • Simultaneous operation of more than one output

  • Motor control programs

Seal-In Logic Circuit

  • PLC seal-in logic causes an OTE instruction to stay on.

Seal-In Logic Circuit Operation

  • Uses a second XIC instruction in parallel with the XIC instruction that turns on the output.

Interlock Safety Applications

  • Used to prevent an event from happening unless certain conditions are present.

Interlock Circuit Example Operation

  • XIO 0:0/1 on the first rung and XIO O:0/0 on the second rung.

Project Documentation

  • Comments placed in the program to describe the function/operation of a ladder logic program, its rungs, instructions, and/or address.

Project Documentation Types

  • Address Description

  • Instruction Comment

  • Rung Comment

  • Page Title

  • Address Symbol

Description of an Internal Output Instruction

  • Internal output instructions look and operate like OTE instructions because they can control XIC and XIO instructions with the same address.

Internal Output Instruction Applications

  • Program memory logic

  • Program interlocks

Function of PLC Timer Instructions

  • Used to provide time-based control logic.

  • Provide a time delay between two events in a machine's sequence.

PLC Timer Instruction Applications

  • Reduced voltage starting

  • Plastics injection molding

  • General purpose machine sequencing

Two Classifications of PLC Timers

  • Retentive Timers

  • Non-Retentive Timers

Retentive Timers

  • Accumulates the total amount of time the instruction has been energized and retains this value even when it is de-energized.

Non-Retentive Timers

  • Accumulates time when energized and resets whenever the input is de-energized.

Non-Retentive Timer On-Delay Operation

  • TON sets its Done bit to 1 when the instruction has been enabled for a preset amount of time.

Timer Address

  • Consists of file type, file number, and timer number.

Time Base

  • Determines the duration in seconds for each instruction count.

Off-Delay Timer Operation

*The components of an off-delay timer (TOF) instruction are the same as those of a non-retentive on-delay timer.

Time-Driven Sequencing Defined

  • PLC routines may use timers as well as limit switches to sequence events.

Two Types of PLC Counter Instructions

  • Count Up

  • Count Down

The Count Up Instruction

  • Count Up Bit