Category Archives: ACC

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.

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:

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:

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:

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 PLC Outputs Work

This post is a further follow up from my original ‘Here’s a Quick Way to Understand PLC Inputs and Outputs’. There are basically two different kinds of PLC outputs, Discrete and analog. Discrete outputs are either ‘ON’ or ‘OFF’; 1 or 0. You can think of them as a single light bulb. Analog outputs have a range to them. They are outputs that usually will control proportional valves, drive speeds, etc. They usually have one of the following signals that are outputted from the PLC: 4-20mA, 0-10VDC, 1-5VDC.

Discrete Outputs

The above diagram has three outputs. A coil, light and motor. The Ladder outputs Y0, Y1 and Y2 control the outputs respectfully. You will notice that when the Ladder output turns on, the corresponding output card bit LED turns on. This then will energise the output hardwired to the device.

The outputs are turned on or off at the end of every PLC Scan. The PLC logic is solved left to right, top to bottom in most PLCs. Physical outputs are not set / reset until an I/O refresh is performed at the end of every scan. This means that if I have a scan of 1msec, then the maximum time it will take to turn on/off the output is 1msec.

PLCs will sometimes have the ability to update the I/O in the middle of a scan. Please refer to your PLC manufacturers manual for this instruction. This can be used for updating the I/O quickly or controlling stepper drives for motors by giving them a pulse train output from the discrete PLC output. A pulse train is just a quick series of on/off states of the output.

Analog Outputs

An analog output converts a digital value to a voltage or current level that can be used to control (vary) physical outputs. In the example above we are controlling the speed of the motor. Words in the PLC will control the analog value.
Example:
4 – 20 mA current Output – 8 bit resolution
4 mA = 00000000 base 2 = 00 base 16
20 mA = 11111111 base 2 = FF base 16
For a review of numbering systems, follow the link below:
What Everybody Ought to Know About PLC (Programmable Logic Controller) Numbering Systems

In the industrial environment noise from variable frequency drives, improper grounding, etc. can interfere with your analog input. The following post will show a quick method to reduce this noise.
The Secret Of Getting Rid Of Noise On Your Analog Signal

Previous Post:
How PLC Inputs Work

Watch on YouTube : How PLC Outputs Work

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 PLC Inputs Work

This post is a further follow up from my original ‘Here’s a Quick Way to Understand PLC Inputs and Outputs’. There are basically two different kinds of PLC inputs, Discrete and analog. Discrete inputs are either ‘ON’ or ‘OFF’; 1 or 0. You can think of them as a single switch. Analog inputs have a range to them. They are inputs that usually will sense pressure, temperature, height, weight, etc.  They usually have one of the following signals that are inputted into the PLC: 4-20mA, 0-10VDC, 1-5VDC.

Discrete Inputs

The above diagram has two inputs. A normally open (NO)  and a normally closed (NC). When we talk about normally open and close, think of the condition of the input if no one touches anything. A normally open contact will not turn on the input to the PLC card in its ‘normal’ state. The normally closed contact will turn on the input to the PLC card in its ‘normal’ state.

Normally Open Input
The NO contact when activated will complete a circuit and turn on the PLC input. Ladder logic will then turn on if you use a normally open (Examine On) input in your program. See above diagram.

Normally Closed Input
The NC contact when activated will break a circuit and turn off the PLC input. Ladder logic will then turn off if you use a normally open (Examine On) input in your program. See above diagram.

As you can see with the diagram above this can get tricky to determine the on/off condition of the input. PLC logic can convert any signal by using normally closed (Examine Off) inputs in the program. In the field, I usually look at the PLC input lights, and wiring diagrams to determine the current state of the input. This is before diving into the program to troubleshoot.

Here is a link to wiring up discrete 3-wire sensors in the field. Here’s a Quick Way to Wire NPN and PNP devices

Analog Inputs

An analog input converts a voltage or current level into a digital value that can be stored and processed in the PLC. They use words to determine the signal coming from the device.
Example:
4 – 20 mA current Input – 8 bit resolution
4 mA = 00000000 base 2 = 00 base 16
20 mA = 11111111 base 2 = FF base 16
For a review of numbering systems, follow the link below:
What Everybody Ought to Know About PLC (Programmable Logic Controller) Numbering Systems

In the industrial environment noise from variable frequency drives, improper grounding, etc. can interfere with your analog input. The following post will show a quick method to reduce this noise.
The Secret Of Getting Rid Of Noise On Your Analog Signal

Here are some additional posts that you might find helpful.
How to make a Start / Stop / Jog circuit in a PLC
The Secret of Using Timers
The Secret of Using Counters

Watch on YouTube : How PLC Inputs Work

Watch on YouTube : Wiring (Testing) Analog PLC Input Click

Watch on YouTube : Wiring (Testing) Analog PLC Input Omron CP1H

Watch on YouTube : Wiring Contact (Discrete) PLC Inputs

Watch on YouTube : Wiring PNP Sensor to PLC

Watch on YouTube : Wiring NPN Sensor to 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.

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.)
https://www.amazon.com/Programming-Industrial-Automation-Kevin-Collins/dp/1846855985
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

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.

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.

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.

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

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?

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.

How to Troubleshoot a PLC

Your control system does not work. Where do you start? Lets walk through a series of questions in order to determine where the problem lies.

Is this a new installation or previous installation that was running fine? Determine if system has been running well in the past and has currently stop working correctly. This is the indication that the problem relies inside the system.

Is there anything that has happened outside of the system? Has there been a lightening strike, blown drives on other systems, etc.  This can point to the original cause of the malfunction.

What is the system doing now and what should it be doing? Gather all of the information you can from every resource you can.

  • Supervisors  – machine, location, time of error, other happenings in the plant, etc
  • Operators – What is it currently doing? What should it be doing? What do you think is wrong?
Operators of the equipment are your key resource in finding, correcting and ensuring the error does not happen again. They know the equipment from an operational point of view which can assist you greatly in troubleshooting.

PLC fatal and non-fatal errors:
If the machine is still running partially then this is an indication of a non-fatal error. Cannot run at all is usually a fatal error.

Take a look at the PLC indicator lights on the CPU. Refer to the operation manual for the PLC for troubleshooting specific lights on the CPU. The following are general tips:

If no lights are on then the possible cause is a power supply. This is usually the most common of errors on a PLC system. Mean time before failure (MTBF) is rated on the lowest rating of components which is usually the power supply.

If the run light is on and an error light flashing this usually indicates internal errors such as batteries, scan time, etc. It is usually not the reason for the lack of operation.

If the run light is on and no other errors are seen on the CPU we can put the PLC program on the bottom of the list of items that could be the cause.

Check the input cards of the PLC. You should see the individual sensors lighting up the inputs. If not then check the power supply to the input card / cards.

Ask the operator what is happening and what is suppose to happen. Try to follow the sequence of events in the PLC to determine either and input or output device not working.
Some items to watch:

If this is a new PLC program that you are doing start with a logic flow diagram. This will determine the procedure to start programming.
Every program can be done in several ways. The best method is the most documented one.

Documentation is the mark of a good program.

Some trouble with new programs can be racing conditions. This is usually a case of not understanding how the PLC scans logic. In general the PLC will scan from left to right, top to bottom. The output bits / words are available to the inputs of the next rung of logic. (Modicon PLC’s will scan differently.) Actual outputs and inputs are not read until the end of the scan of the PLC. Racing conditions happen when the output is set on multiple rungs, but will not get actually set until the end of the scan. Think of it as the last action will always win. So if this happens move the logic to the end of the program and see if it works. Then go back and see where the output was also set.  Cross reference guides are ideal for this purpose. (Refer to your programming software on how to get cross references.)

We have discussed just a few troubleshooting techniques. Hopefully now you know how to start looking for the errors on your  system. Let me know how you make  out.

Watch on YouTube : How to Troubleshoot a PLC

Do you know of additional tips or methods to share?

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 to Implement the Omron PLC Host Link Protocol

Hostlink communication protocol is a method developed by Omron for communication to PLC’s and other equipment. This ASCII based protocol is used over RS232 or RS422/RS485. It is a many to one implementation which means that you can communicate with up to 32 devices back to a master. (1:N) This communication on the industrial floor can control PLC’s, Temperature Controllers, Panel Meters, etc.

Our look at this protocol will include the wiring, setting of RS232 port settings, protocol format and  writing a VB6 program to read information from the PLC. I will also point you links to then store this information into a database and share over an intranet/internet. Lets get started.

Wiring of the communication ports will depend on the equipment purchased. If communicating over 15 meters, it is recommended to switch to RS422 or RS485 connection. However I have seen RS232 runs of 50 meters without an issue. It will depend on your implementation and electrical noise in the plant.

The above diagram is the basic communication needed for RS232C. Note that the shield of the communication wire is connected only to one side. This ensures that any noise induced in the communication is filtered to one end.

Settings for RS232C communications are set in a number of ways. Older Omron C**K PLC were set through a series of dip switches. Current Omron SMR1/CPM1 PLC’s are set though data memory locations.
Note: Most of the time, you need to cycle the power or switch to program / run mode for the setting to be activated.

I generally tend to leave everything at the default settings: 9600 bps, Even parity, 7 data bits, 1 stop bit. The default host link unit number is 00. (32 max. – 00 – 31)

Protocol Format
Each piece of equipment will have a list of parameters that can be read and written using the HostLink protocol. This can be found in the programming manual of the device. Here are the areas in the CPM1/CPM1A/CPM2A/CPM2C/SRM1(-V2) from the programming manual.

Lets take a look at the command to read the DM area. All of the commands and responses will be in an ASCII format.

The command format begins with a ‘@‘ sign followed by the Node / Unit number that you wish to communicate. Header code is the command in which you with to execute. (RD) This header code will determine the next series of information. In our case the next four digits will be the beginning word followed by the next four digits to indicate the number of words. The next part of the command is the FCS (checksum) calculation. The comparison to this at each end will ensure that the command/response is correct. FCS is a 8 bit data converted into two ASCII characters. The 8 bits are a result of an Exclusive OR performed on the data from the beginning to the end of the text in the frame. In our case this would be performed on the following:

"@00RD00000010"

The last part of the command is the terminator. This is an ‘*’ followed by the character for the carriage return. (CHR$(13))

The response format begins with a ‘@’ sign followed by the Node / Unit number that you are communicating to. The header code is next (RD) followed by the End Code. The end code is a two digit ASCII code that indicates the message response / errors when executing the action. A normal code of ’00’ indicates that everything is fine. See the operation manual for the entire list of end codes for your equipment. The next part of the response depends on the header code executed. In our case it would contain the data requested. The last two parts of the response is the FCS and terminator just like the command format.

The above shows the timing of the command and responses.

Visual Basic VB6 (Example)
Now lets look at an example of reading the first 10 words from the DM area  of an Omron PLC.

The first step is the design the form. You can see that we have our ten DM area words set out to populate with values. We also have a T$ for transmit. This will show what we are sending to the PLC. The RXD$ will show what the response will be from the PLC.

The MSComm is used to communicate through the serial ports of the computer. The following is the settings for the communication port.

Here is the VB6 code for the program:
When the form loads the Date/Time will get updated and Timer1 is enabled. This timer controls the interval in which the commands get executed. (Set to 1 second)

Private Sub Form_Load()
 Label2.Caption = Format(Date, "YYYY/MM/DD") + "    " + Format(Time, "HH:MM:SS")
 Timer1.Enabled = True
 End Sub

The following code will open the communication port, set the command format, send the command through the port, receive the response through the port and display the information. It will then close the communication port.

Private Sub Timer1_Timer()
 Timer1.Enabled = False
 MSComm1.PortOpen = True
 Label2.Caption = Format(Date, "YYYY/MM/DD") + "    " + Format(Time, "HH:MM:SS")
'Check DM AREA DM0000 to DM0009 data update
 T$ = "@00RD00000010"
 charreturn = 51
 GoSub FCS
 GoSub communicate
'Show Transmit information
 Label24.Caption = Buffer
 'Show Returned information
 Label26.Caption = rxd$
If Mid(rxd$, 6, 2) = "00" And (Len(rxd$)) >= charreturn Then
 Label4.Caption = Mid(rxd$, 8, 4)
 Label6.Caption = Mid(rxd$, 12, 4)
 Label8.Caption = Mid(rxd$, 16, 4)
 Label10.Caption = Mid(rxd$, 20, 4)
 Label12.Caption = Mid(rxd$, 24, 4)
 Label14.Caption = Mid(rxd$, 28, 4)
 Label16.Caption = Mid(rxd$, 32, 4)
 Label18.Caption = Mid(rxd$, 36, 4)
 Label20.Caption = Mid(rxd$, 40, 4)
 Label22.Caption = Mid(rxd$, 44, 4)
 End If
 Timer1.Enabled = True
 MSComm1.PortOpen = False
 Exit Sub

The following is the subroutine to communicate. Timer2 is the amount of time to wait before expecting an answer on the communication port. Once the command has been sent a maximum of two seconds is waited for an response. If no response nothing is returned. When the response is obtained, the FCS is checked and if correct the information is returned.

communicate:
 rxd$ = ""
 Buffer = T$ + FCS$ + "*" + Chr$(13)
 MSComm1.Output = Buffer
 Timer2.Enabled = True
 Do
 DoEvents
 Loop Until Timer2.Enabled = False
 If Time > #11:59:50 PM# Then
 timeout = #12:00:02 AM#
 Else
 timeout = DateAdd("s", 2, Time)
 End If
 MSComm1.InputLen = 0
 Do
 If timeout <= Time Then GoTo timeoutcom
 DoEvents
 Loop Until MSComm1.InBufferCount >= charreturn
 rxd$ = MSComm1.Input
 fcs_rxd$ = Left((Right(rxd$, 4)), 2)
 If Left(rxd$, 1) = "@" Then
 T$ = Mid(rxd$, 1, (Len(rxd$) - 4))
 ElseIf Mid(rxd$, 2, 1) = "@" Then
 T$ = Mid(rxd$, 2, (Len(rxd$) - 5))
 rxd$ = Mid(rxd$, 2, (Len(rxd$) - 1))
 End If
 GoSub FCS
 If FCS <> fcs_rxd$ Then
 rxd$ = ""
 End If
 clearbuffer$ = MSComm1.Input
 Return

This is the FCS (checksum) calculation routine.

FCS:
 L = Len(T$)
 A = 0
 For J = 1 To L
 TJ$ = Mid$(T$, J, 1)
 A = Asc(TJ$) Xor A
 Next J
 FCS$ = Hex$(A)
 If Len(FCS$) = 1 Then FCS$ = "0" + FCS$
 Return

This is the routine that will execute if the response is not received within the time period expected.

timeoutcom:
 clearbuffer$ = MSComm1.Input
 rxd$ = ""
 Return
End Sub

Timer2 was used as a delay before looking for a response after sending the command.

Private Sub Timer2_Timer()
 Timer2.Enabled = False
 End Sub

Here is the code running:

Helpful Tips/Links:
– When troubleshooting serial communications it is sometimes helpful to use HyperTerminal. This program will send and receive information in/out of the serial ports.
HostLink Command Generator
HostLink Command Format

Watch on YouTube : How to Implement the Omron PLC Host Link Protocol

If you have any questions, need further information or would like a copy of this program 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.

Here is a Method That is Helping PLC Programmers to Program Faster

PLC programming involves both direct and indirect addressing. Direct address programming involves writing each ladder logic rung to do the operation required. We often forget about using the powerful indirect addressing to solve our logic.

The below animated picture will show a simple example of using indirect addressing. This will use the MOVE instruction and transfer a word indirectly to output word V100. V[V0] means that the value in V0 will point to the V memory to get the value to move. You can think of this as a pointer for the memory location to move.

Of course we need to monitor V0. Our values are in sequence from V1 to V6. We need to ensure that V0 is always in the range from 1 to 6.

Lets take a look at a program sample using the Do-more Designer Software. We will set up the sequence similar to the animation above, but expand the program.
Just like above we will set up the pointer at V0 and the output at V100 memory locations. V1 to V37 will hold our output data sequence. This is outputs that we want to set on each event and/or time frame. You can see some of the registers and the corresponding values. These are set as a hexadecimal value. The following link will provide a review of the numbering systems in the PLC. (WHAT EVERYBODY OUGHT TO KNOW ABOUT PLC (PROGRAMMABLE LOGIC CONTROLLER) NUMBERING SYSTEMS)

This is the logic to set up the move instruction. The source is V[V0] which means the pointer is V0 in this memory area. The destination will be V100.

An internal timing bit ST5($100ms) is used to increment the pointer V0. This could also be done by an event or series of events. The pointer is then compared to ensure that it is between 1 and 37.

Finally the output word is then transferred to the physical outputs. This is done by using the MAPIO instruction. Each bit can be set independently.

p

This example uses indirect addressing to program a sequence based upon time. We could just as easily used indirect addressing to compare inputs to a table and set the outputs accordingly. You can see how this method can greatly reduce the amount of time to develop your program. This holds especially true if the sequence needs to be changed. It would be just a matter of changing data values in the table.

The following are separate posts that use indirect addressing:

Building a PLC Program You Can Be Proud Of – Part 1
This use the control of an intersection traffic light to demonstrate direct versus indirect addressing.

Building a PLC Program That You Can Be Proud Of – Part 2
A sample program to control valves. This uses indirect addressing for the inputs as well as the outputs.

Now You Can Have Robust Data Logging for Free – Part 1
Using indirect addressing, this sample program will log information in the PLC to be retrieved at a later time.

Indirect addressing is a powerful method of programming to simplify and program faster than you ever thought possible. You can even use indirect addressing in the PLC to scale a non-linear analog input signal. Let me know you thoughts on using indirect addressing. What can you come up with?

Watch on YouTube : Here is a Method That is Helping PLC Programmers to Program Faster

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.

The Secret of Using Counters

Counters  are used in the majority of PLC programs. This is especially true if part of your SCADA system. Counters like the animated picture above count things. In this situation we are counting the number of turns the little guy makes. The counter is displaying the total number. This is considered a totalizing counter. If an output turned on to do something then it would be a preset (target number entered for the count) counter. There are also a wide variety of off the shelf industrial counters that you can use. The implementation of counters can be vast, however it all starts with a TIMING CHART. This is the same as the timing charts we discussed in ‘The Secret of Timers’ post.

A timing chart is the secret behind understanding of the counter that you need in your application. Making a timing chart before writing the program will ensure that all of the information will be accounted.

The timing chart is mapped out on a x and y plain. The ‘y’ plain has the state of the input on/off (1 or 0). The ‘x’ plain will show time.

The following shows a timing chart for a counter:
As you can see in this timing chart, you have an input, output and display.

Inputs:
Inputs are used usually sensors that are wired to the counter (PLC) to indicate the items that we need to count. They can be switches, photoelectric sensors, proximity sensors, encoders, etc. (Wiring of NPN / PNP devices) A counter will generally have only one input. In the case of an encoder input it is still only one input, however this is wired usually as a A, B and Z phase. Z is always the reset. A and B indicate the pulses and are leading or trailing each other by 90 degrees depending on direction. Allot of counters will also allow you to as a direction input signal. However this is all still only one input.

Outputs:
Outputs from counters are generally discrete. This means that they are on or off, similar to the inputs. Outputs will trigger when the count value matches the set value. The duration that the output is on depends on the reset signal, to start the count again. (DC Solenoids protection) Allot of the counters today will allow you to have multiple outputs. These multifunction counters can have several preset outputs that trigger when the counter set value has been reached. Batch outputs are also available on some of the industrial counters. A batch output counts the number of times that the preset has been reached. This output will be turned on when the number entered for the batch has been reached.

Set Value – SV:
This is usually on the display and shows the preset value. It is the target number of counts.

Present Value – PV:
This is usually on the display and shows the current or accumulated value.

The PLC programming is usually not that much different then the industrial counter. Allot of the manufactures will have an up counter, down counter and/or an up/down counter. Just as the name implies the display is either counting up or down. You have to refer to the instruction manual of the manufacturer you are programming for the way in which the counter will be programmed.

In the above example Do-More PLC program we have an up and a down counter. X0 is the input and X1 is the reset on both of these counters. (CT0, CT1)
The preset value is stored in memory location D0. This value is set to the number 3.
When the present value (accumulated) reaches the set value (preset) then the CT0.Done bit goes on and the output Y0 is active. Y0 will remain on until the reset input goes on.
The only difference for down counter is the display. You will see that the present value will count down to zero (0) before the CT1.Done bit is turned on.
These counters are memory retentive. So in order to make the counter non-memory retentive, use the first scan bit of the PLC to trigger the reset of the counter. (ST0 – $FirstScan)

Every PLC has counters. They all have different types depending on what you are trying to achieve. It will all start with your Timing Chart.

Watch on YouTube : Learn PLC Programming – Free 9 – The Secret of Counters

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.

… and I also do PLC programming.

Programmable Logic Controller (PLC) programming is often thought as something everyone can do easily. We often design the system, install the hardware and then start to think about the PLC program and programmers. This approach can be improved. The landscape of PLC programming is changing and we must also change.

Computer Programming / PLC Programming
I believe that with all of the new functions of the PLC processor, you would be better served by someone that can do additional computer programming. Ladder logic has been taught in our schools for about 20 years or more. The basic bit programming in ladder is easily understood. Connecting to the manufacturers dedicated software  shows the power flow from left to right and shows the logic solved from top to bottom.

Some applications are fine if you are just replacing a few relays, however today’s manufacturing floor must be integrated. The existing hardware in the plant must also be connected to the PLC system. This will allow connection of data logging, email, vision system, motion control, HMI, computer servers, etc.

Ladder logic and the standardization of PLC’s on the plant floor has long been a topic for discussion and debate. The benefits were that anyone can look and understand the PLC logic to troubleshoot the system. Today the PLC can do allot more. Visually it can indicate /display its own troubleshooting and diagnostics to the engineer, electrician and/or operator in a variety of ways. You no longer need the skills on the plant floor all of the time. Using HMI (Human Machine Interface), computer screens, indication lights and email, just to name a few, information can be passed for troubleshooting and diagnostics. The investment in the program and integration of the system in your plant will pay for itself time and time again.

I believe that PLC programmers need more than just this programming language. They must have network and high level language skills to be capable of integrating the entire plant floor.

Let me know what you think? Are we teaching the new generation the right way?
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.

Creating More Than Just A PLC Program

A collection of random thoughts on PLC programming and doing more than just basic logic. Making your program intuitive.

PLC programs usually just control the logic between the inputs and outputs. If this turns on and that is not on, then this output is on, bla bla bla. Programmable logic controller programs can go far beyond just the basic logic. Modern processing power has enabled allot more features that can be programmed.

Traditional PLC programs are written so everyone can understand the ladder programming. This is not the case anymore. There should be no need for anyone to review the ladder program. Error messages, alarms and sequencing should automatically make troubleshooting simple. If something is not working, your system should direct personal how and what to do to fix it.

Touch screens, LED indicators, stack lights, custom user error messages, display boards and logging software are just a few methods of displaying information to the operator, electrician, mechanic, supervisors, managers and even owners of the equipment.

Your program can track the basic hours of operation and trigger maintenance events from these hours. What needs to be done after 100, 500, 1000 hours? Just like the service on your car, you should plan for the service on your machine through the use of program.

If a pneumatic cylinder is used here are a few things that you can track in the program:

  • Number of cylinder cycles
    • Life expectancy
  • Time it takes to complete cycle (Sensors on both ends of the cylinder)
    • Determine if a seal is leaking
    • Pressure of the incoming supply if multiple cylinders are monitored

Here is a good reference for Bimba Cylinders.
http://www.bimba.com/Global/Library/Catalogs/Bimba%20Catalogs/BimbaRefHandbook.pdf

Alarm Screens:

Alarms should be easily identified and located.
Remember: A picture is worth a thousand words.

Establish sequencing of events that can be stepped through forward and backwards can allow maintenance personal to easily troubleshoot the system without going through possibly hundreds of lines of ladder logic.
Please see the following links for sequencing your program:
Building a PLC Program That You Can Be Proud Of – Part 1
Building a PLC Program That You Can Be Proud Of – Part 2

With Ethernet connections built into most modern PLC CPUs, it is now  possible for the PLC to automatically send email to your exchange server.
Automation Direct Do-More CPU is one of these PLCs.
https://www.automationdirect.com/adc/Shopping/Catalog/Programmable_Controllers/Do-more_Series_(BRX,_H2,_T1H)_PLCs_(Micro_Modular_-a-_Stackable)

When programming PLC’s for logging data, information must be stored in the PLC for later retrieval. Most commercially available software for logging data does not consider the event of loosing the communication cable. If an interruption on your communication lines happen, data cannot be retrieved from the PLC. The PLC can use indirect addressing to store the logged information. Logging software can read the pointer to the logged data, read the data and then reset the pointer. The duration and amount of information that you are logging will determine the amount of time the communication can be disabled before loosing data. I usually log daily summaries as well as detailed information in the process. My detailed data will be lost in 2 hours but my log daily will take one month.

What other options do you see with a modern PLC?

I look forward to your comments,
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.