Tag Archives: plc programming tutorial for beginners

BRX PLC Analog IO – System Configuration

One of the features of the BRX Series PLC is the ability to expand its capability to fit your application. This is easily done by “snap-on” modules that will fit on the side of the BRX MPU (Multi Processor Unit). As we have seen before in the BRX PLC System Configuration post we can add additional discrete inputs and outputs. Automation Direct now offers Analog Voltage and Analog Current input and output modules. These modules come as an 8 point channel unit. There is also a 4 point thermocouple input module also available. We will be configuring, scaling and programming the Analog input and output Voltage modules for our BRX PLC. Let’s get started. Continue Reading!

PLC Bits Numbers and Position

People often ask “What is a PLC?” and “PLC Meaning”. A programmable logic controller (PLC) is a piece of hardware that isolates inputs from outputs. Programs are written to look at the inputs solve logic and set the outputs to perform work. Today we are going to look at the basic fundamental way we program. Every PLC company will do this…

Everything in the programmable logic controller actually boils down to bits in the memory.
Memory Bits-min
It is these bits that we manipulate in order to accomplish the work that we need done by the PLC. The instruction set is the method we use to do this. In general, there are several ways to view the bits. Discrete input and output, Numbers and Position of bits will be covered. Understanding the different ways in which we can view these bits will help in developing programs.
Bits are part of the memory of all PLC systems. The memory can be retentive or non-memory retentive. Memory retentive means that if power is lost to the PLC, the status of the bit remains the same when power is restored. If the bit is non-memory retentive, and power is lost the bit returns to the off state. Addressing refers to how the controller understands what memory location to look at. When we address memory in the PLC we can do this in two different ways:
Direct Addressing: Specify a location of the memory location
Indirect Addressing: Specify a location that contains a value to point to the memory location required.
Indirect Addressing Animation

Refer to the manual of the specific PLC that you are using for the way in which memory is addressed and if it is memory retentive or not.

Discrete bits are the basic building blocks in the PLC. When we talk of digital I/O this is referring to the individual bits that you can wire switches, pushbuttons, proximity sensors, or any other device that is either on or off. (1 or 0) They can be usually wired to the PLC as a normally open or normally closed contact. The ladder logic is written in a way that you examine the bit as either on or off.
HOW PLC INPUTS WORK
PLC Input

HOW PLC OUTPUTS WORKPLC Outputs
We also must look at the frequency (rate of change from off to on) of the input bits or output in some cases. The maximum frequency that we can read an input to the PLC will be determined by the scan of the PLC.
Example:
A 2 ms Scan (0.002 second) means that we can read the inputs and solve the logic in 2 ms. In order to ensure that the input is read in both states (on / off) we have to ensure that the input is off or on for at least 2 ms. The maximum frequency (Switching / Second) that the input could switch would be 2 ms = 1/.002 times per second = 500hz

Numbers in the PLC are all based on binary. Analog inputs and outputs are based upon the number of bits put together in order to display the range for the input. (12 bit or 16 bit) The values from the analog 12bit input will go from 000 to FFF base 16 (Hex). Hexadecimal is used to display the binary bits in the word or register. Some of the more common numbering systems in the PLC are binary, hexadecimal, BCD (binary coded decimal) and octal (based on 8 bits)
funny_counter
Additional Information on understanding numbering systems in the PLC:
What Everybody Ought to Know about PLC (Programmable Logic Controller) Numbering Systems

Position of the bits within the word, stack or accumulator can be very useful. Usually we can use this to track items. The typical example of this is to track items on a conveyor belt. The belt movement is usually a pulse input from an encoder. A sensor indicates the item on the conveyor.
PLC PROGRAMMING EXAMPLE – SHIFT REGISTER (CONVEYOR REJECT)
Conveyor Reject

Bits are the basic building blocks that we use to program programmable logic controllers. The three ways to view bits (Discrete, Number and Position) will help use to understand the different ways to program.
Here are some additional links that you may find helpful:
Five Steps to PLC Program Development
PLC Programming Example – Process Mixer
PLC Programming Example – Shift Register (Conveyor Reject)
PLC Programming Example – Paint Spraying

The Secret of Using Counters
The Secret of Using Timers

Watch on YouTube : PLC Bits Numbers and Position
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.




Building a PLC Program That You Can Be Proud Of – Part 3

In part 1 we looked at writing PLC programs to control a traffic light using discrete bits and then using timed sequencing using indirect addressing. Part 2 used indirect addressing for inputs as well as output to control the sequence of pneumatic (air) cylinders in the program. We will now return to the traffic light application and expand our program significantly.

Let’s build on the traffic light sequencing used in part one with inputs for pedestrian and car detection. We will also throw in the time of day so that during weekday peak hours an advanced arrow will be used. Advanced green (flashing) will be used when the traffic is detected in the turning lane during the off peak hours.
Pedestrian Walk Signals Traffic Light with Turn

Programming using this method of sequencing requires allot of time up front before we start the actual PLC program. However this method makes the program easier to understand, troubleshoot and modify in the future.

Remember that the PLC programmer must know everything about the machine and operation before programming.

If we just start writing code, then we will constantly be correcting and modifying based on trial and error. I use a spreadsheet program to plot out the inputs, outputs and mask tables. We will go into the details of this below.

Lets look at the inputs:
Sequencer Inputs

We set up the input table in words V0 to V499. Each bit in the table will be compared to the signals coming the actual signals wired or programmed in the PLC.
Bit 0 is the time input which will control the entire program interval. Next we have the Car Detection signals on Bits 1 to 4. The pedestrian signals are pushbuttons coming from Bits 5 and 6. The left turn signals are located in Bits 7 to 10.  The real time clock functions will come from Bits 12 to 15.

Lets look at the outputs:
Sequencer Outputs

The output table will be in words V1000 to V1499. The input word will be compared to the actual inputs and the corresponding output channel will be moved to the actual outputs. All of the output bits control lights. You will notice that there is a green light for each direction. This will give us the greatest flexibility when writing our PLC program. Pedestrian signals have a flashing output bit and just an output bit. There will be only one output but this bit will determine if it is flashing or not.

Masking Inputs:
Sequencer Mask

The masking table will be in words V500 to V999. The masking bits will correspond directly to the input table bits. Using the mask will allow us to ignore the status of certain bits when using the compare instruction and setting the outputs.

The Mask table will be used by using an ‘AND’ word instruction. If the mask bit is on for the input then it will be used in the compare instruction. If the mask bit is off for the input then the value is always off using the compare.
Example:
1 ‘AND’ 1 = 1
1 ‘AND’ 0 = 0
0’AND’ 1 = 0
0 ‘AND’ 0 = 0

Once we have this all laid out in the spreadsheet, we can start filling out our sequence of events. Fill in the events based upon the time frame from input bit 0. I usually start by thinking about what happens when power is applied to the unit the first time. This exercise can be a struggle because you must know exactly what you want the sequence to be in order to fill out the table.

We will continue this next time by writing the code to do what our tables want. A review of the numbering systems can be found on this post. A copy of the spreadsheet can be obtained at the following link: PLC Traffic Sequence

Part 4 will continue with the programming of the logic in the PLC.

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.




How you can learn PLC Programming without spending a dime!

I have been writing PLC programs for over 20 years. I often get asked what is the best way to lean PLC programming. Programming in the way I was taught in college was with the Motorola 6809. (Yes, I know that I am dating myself) This was microprocessor programming, but it was the best way to sometimes explain the methods behind PLC programming. Manufacturers of PLCs had allot of proprietary software that were not even related in their appearance and methods of programming. Today we have a few standards that have changed the look and feel of the programming software packages so each manufacturer is similar. The following is the best recommendation that I have for beginners to start to learn PLC programming today.

start stop 003

The first place to start in order to learn PLC programming is the free publication by Kevin Collins. This PDF will teach you PLC programming without just telling you what a PLC is and how it functions. He also includes some test questions along the way in order for you to retain and understand the important points that he is making.

PLC Programming for Industrial Automation
by Kevin Collins
(Note: This book is now for sale on Amazon.)

Topics covered include:

  • PLC Basics
  • Ladder Programming
  • Conditional Logic
  • Ladder Diagrams
  • Normally closed contacts
  • Outputs and latches
  • Internal relays
  • Timers
  • The Pulse Generator
  • Counters
  • Sequential Programming Introduction
  • Evolution of the Sequential Function Chart
  • Programming using the Sequential Function Chart
  • Entering the SFC program into the PLC
  • Modifying an SFC Program
  • Selective Branching
  • Parallel Branching

GreyToBinaryCode

Simulator

After learning the basics from the above manual, practice. Create programs yourself and test what you have learned. You can accomplish this by using simulators. Allot of the programming software will have simulators. The simulator will mimic the PLC hardware so you can test your programs before installing in the field. Traditionally I have not been a fan of simulators, but recently Automation Direct has introduced a simulator with their Do-More PLC. It is the Do-More Designer Software. This software simulator includes the entire instruction set (Not Just Bit Logic) as well as communication protocols. It can be downloaded and installed for free from the above link.

Indirect Addressing 2 Pointer

The next step I recommend is then to advance into some of the advanced instructions. An understanding of the numbering systems in the PLC will be a benefit. Math, PID, register manipulation and conversion instructions are just a few of the advanced programming you can learn. All of these and more instruction information can be obtained from reviewing the documentation from the PLC manual that you are programming. Once again all of these instructions are included in the Do-More Designer Software.

Indirect Addressing Animation

Program structure is the next topic. Allot of programmers would stop here and can do well with developing software, however there is much more that you can lean.  Sequencers give programmers the methods to change logic on the fly and allow troubleshooting the system easier. This method of programming can benefit you greatly and reduce the development time of your logic.

Omron HostLink Frame_Responseadu_pdu

The last step that I recommend learning is the sharing of information. I am meaning the information that you program through an HMI and/or SCADA package. This refers to understanding of the ways in which information can be gathered from the PLC and displayed in different ways. Here are a couple of previous articles that have been written on this subject:

How to Implement the Omron PLC Host Link Protocol 

Robust PLC Data Logger

iis107 display

As you can see, there is allot of information available to you to begin and lean PLC programming without spending a dime!  Remember that PLCs are similar to computers, (Moore’s Law) they increase in size and ability. Systems are expanding and changing everyday. Happy programming.

Do you know of additional tips or methods to share?
PLC Beginner’ s Guide – There are many different PLC manufacturers with different hardware and software. All of the programmable logic controllers have similar basic features. Here is how I would approach learning about basic PLCs.

Watch on YouTube : How you can learn PLC Programming without spending a dime!

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.