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
Practical tips and techniques for automation control tasks. We will answer questions and provide sample programming solutions.
Showing posts with label ACC. Show all posts
Showing posts with label ACC. Show all posts
Sunday, October 12, 2014
Saturday, September 20, 2014
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:
http://www.bimba.com/Global/Library/Catalogs/Bimba%20Catalogs/BimbaRefHandbook.pdf
Alarm Screens:
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.
http://www.automationdirect.com/adc/Overview/Catalog/Programmable_Controllers/Do-more_Series_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
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
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.
http://www.automationdirect.com/adc/Overview/Catalog/Programmable_Controllers/Do-more_Series_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
Saturday, September 13, 2014
Here is a Method That can Help You with Difficult Level Sensing
Turn a capacitive proximity sensor into a level sensor. This is ideal for tanks and vessels that you cannot drill through the side for mounting.
Wrap bare wire around the sensing head and extend it to the length you need to detect. Insulate the wire using electrical tape all the way down, but leave the end exposed. This acts like an antenna. Anything touching the end will now be detected. I have used 14 and 12 awg wire, depending on the application.
Some quick information about capacitive proximity sensors.
A capacitor is defined as two electrically charged plates separated by a dielectric. In the case of a capacitive proximity sensor, the dielectric is the material that you are trying to detect. As the material moves closer to the electrostatic field of the sensor, oscillation begins. It will get past a threshold and trigger the output to switch.
Some common dielectric constants for material:
Glass - 5
Wood - 2.7
Paper - 2.3
Air, Vacuum - 1
Water - 80
Once you know the dielectric constant you can determine the sensing range (Sr) by a chart that usually comes with the sensor or in the manufactures manual.
Example: Water is 80 so the sensing range is 100%
I generally just try the sensor to determine if it will be suitable for the application.
If you have any questions or need further information, please contact me.
Thank you,
Garry
Wrap bare wire around the sensing head and extend it to the length you need to detect. Insulate the wire using electrical tape all the way down, but leave the end exposed. This acts like an antenna. Anything touching the end will now be detected. I have used 14 and 12 awg wire, depending on the application.
This is ideal for hard to mount areas. You can bend the wire any way you want as long as the insulation (electrical tape) is not exposed.I have had the wire extend up to 30 feet from the sensor without an issue.
Some quick information about capacitive proximity sensors.
A capacitor is defined as two electrically charged plates separated by a dielectric. In the case of a capacitive proximity sensor, the dielectric is the material that you are trying to detect. As the material moves closer to the electrostatic field of the sensor, oscillation begins. It will get past a threshold and trigger the output to switch.
Some common dielectric constants for material:
Glass - 5
Wood - 2.7
Paper - 2.3
Air, Vacuum - 1
Water - 80
Once you know the dielectric constant you can determine the sensing range (Sr) by a chart that usually comes with the sensor or in the manufactures manual.
Example: Water is 80 so the sensing range is 100%
I generally just try the sensor to determine if it will be suitable for the application.
If you have any questions or need further information, please contact me.
Thank you,
Garry
Thursday, September 4, 2014
Building a PLC Program That You Can Be Proud Of - Part 2
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. We will now look at how we can use indirect addressing for inputs as well as output to control the sequence in the program.
Lets look at an example of controlling pneumatic (air) cylinders.
This program will have the following inputs. Even thought no sensors are mounted on the cylinders, it is best to have sensor inputs when the cylinder is extended (out) and retracted (in)
Inputs:
Cylinder 1 In - X1
Cylinder 1 Out - X2
Cylinder 2 In - X3
Cylinder 2 Out - X4
Cylinder 3 In - X5
Cylinger 3 Out - X6
Start PB NO - X7
Stop PB NO - X8
Step PB NO - X9
This program will have the following outputs.
Outputs:
Cylinder 1 In - Y1
Cylinder 1 Out - Y2
Cylinder 2 In - Y3
Cylinder 2 Out - Y4
Cylinder 3 In - Y5
Cylinger 3 Out - Y6
We will use the following pointers:
V0 - Output pointer starting at address V2000
V1 - Input pointer starting at address V1000
V10 will be the input word
V20 will be the output word
Before we start and write the code lets look at the sequence that we are trying to accomplish. The best way to do this is a chart indicating the inputs and output. I use either graph paper or a spreadsheet software to configure the sequence.
I usually start with the outputs configure the sequence that I would like to see. Then based upon the output sequence, I figure out the input sequence.
Note: Here is the location for a quick review of numbering systems from a previous post.
Once the sequence has been established, the next step is writing the program.
Input program that will set the input bits in V10.
Control part of the program:
The first scan will reset the input and output pointers.
The input pointer is compared to the input word V10. If they are equal then the output pointer and input pointer are incremented. If the STEP input is hit, then the output and input pointers are incremented.
The output pointer is then compared to the maximum value (end of sequence). If it is greater than or equal to the maximum value then the pointers will be reset.
Line 12 will move the outputs indirectly to the output word.
Output program that will set the actual outputs based upon the bits in V20
As you can see the actual program is very small however the sequence can be thousands of steps. This is a very straight forward and powerful method of programming. Programming this sequence using bits, timers and no indirect addressing would be very difficult and hard to read. Modifications would have to be a complete re-write of the program.
Modifications:
The entire program sequence could change without further lines of code. Only the values in the registers would need to be modified. This could lead to different sequences for different products.
We used a step input to have the program move forward through the sequence. It would be just as easy to add a step reverse function for the program. We would just have decrement the pointers and check to make sure when we were at the beginning of the sequence.
Troubleshooting:
When troubleshooting this program we would only need to look at the compares to determine what input and or output is not working correctly.
Integration with a touch panel display is simplified when using this type of programming method.
What other advantages do you see?
Contact me for the above program. I will be happy to email it to you.
If you have any questions or need further information please contact me.
Thank you,
Garry
You can download the software and simulator free at the following address. Also listed are helpful guides to walk you through your first program.
Do-more Designer Software
How to use video's for Do-more Designer Software
One of the better PLC programming books is PLC Programming for Industrial Automation by Keven Collins. Here is the link to the free download.
Lets look at an example of controlling pneumatic (air) cylinders.
Video of Pneumatic Cylinder Sequencing on YouTube.
This site contains a video of the three cylinders and the sequence required.This program will have the following inputs. Even thought no sensors are mounted on the cylinders, it is best to have sensor inputs when the cylinder is extended (out) and retracted (in)
Inputs:
Cylinder 1 In - X1
Cylinder 1 Out - X2
Cylinder 2 In - X3
Cylinder 2 Out - X4
Cylinder 3 In - X5
Cylinger 3 Out - X6
Start PB NO - X7
Stop PB NO - X8
Step PB NO - X9
This program will have the following outputs.
Outputs:
Cylinder 1 In - Y1
Cylinder 1 Out - Y2
Cylinder 2 In - Y3
Cylinder 2 Out - Y4
Cylinder 3 In - Y5
Cylinger 3 Out - Y6
We will use the following pointers:
V0 - Output pointer starting at address V2000
V1 - Input pointer starting at address V1000
V10 will be the input word
V20 will be the output word
Before we start and write the code lets look at the sequence that we are trying to accomplish. The best way to do this is a chart indicating the inputs and output. I use either graph paper or a spreadsheet software to configure the sequence.
I usually start with the outputs configure the sequence that I would like to see. Then based upon the output sequence, I figure out the input sequence.
Note: Here is the location for a quick review of numbering systems from a previous post.
Once the sequence has been established, the next step is writing the program.
Input program that will set the input bits in V10.
Control part of the program:
The first scan will reset the input and output pointers.
The input pointer is compared to the input word V10. If they are equal then the output pointer and input pointer are incremented. If the STEP input is hit, then the output and input pointers are incremented.
The output pointer is then compared to the maximum value (end of sequence). If it is greater than or equal to the maximum value then the pointers will be reset.
Line 12 will move the outputs indirectly to the output word.
Output program that will set the actual outputs based upon the bits in V20
As you can see the actual program is very small however the sequence can be thousands of steps. This is a very straight forward and powerful method of programming. Programming this sequence using bits, timers and no indirect addressing would be very difficult and hard to read. Modifications would have to be a complete re-write of the program.
Modifications:
The entire program sequence could change without further lines of code. Only the values in the registers would need to be modified. This could lead to different sequences for different products.
We used a step input to have the program move forward through the sequence. It would be just as easy to add a step reverse function for the program. We would just have decrement the pointers and check to make sure when we were at the beginning of the sequence.
Troubleshooting:
When troubleshooting this program we would only need to look at the compares to determine what input and or output is not working correctly.
Integration with a touch panel display is simplified when using this type of programming method.
What other advantages do you see?
Contact me for the above program. I will be happy to email it to you.
If you have any questions or need further information please contact me.
Thank you,
Garry
Do-more Designer Software
One of the better PLC programming books is PLC Programming for Industrial Automation by Keven Collins. Here is the link to the free download.
Wednesday, September 3, 2014
Building a PLC Program That You Can Be Proud Of - Part 1
What is the best way to program a PLC?
My answer is simple. The best way is one in which someone can look at your program and understand it. I cannot stress enough the need for good documentation of your program. The best programs are ones that I can return to after several years and understand what it is doing within a few minutes. Programs should read like a book. This will aid in troubleshooting, modifying or teaching.
How do you approach a PLC program?
You must know everything about the logic or process before starting your program. Making a flow chart is one good method to learning the logic and process. The flow chart will bring out questions like the following:
What happens after a power outage? (In each condition of the outputs)
What happens if a sensor is not made? How long do you wait?
What are the critical items to monitor? (Ex. Air Pressure, Weight, Length, etc)
What happens...
Once you have written your program and are in the troubleshooting stage you can usually go back and add to your flow chart. Usually there is always something that needs to be added, changed or modified based upon the actual functioning of the program.
Consider each project a complete leaning opportunity.
Once you know what you want to do with the PLC and have a good understanding of the logic flow, then it is time to start coding. Remember that there is no write or wrong method to program the PLC, either the program will work or it will not work.
Let's look at an example. We will start with something that we all know how it works.
Traffic Lights
We will look at three programming examples for the lights. Two different approaches to programming will be used, but the program function is the same. The last example will modify the logic for a car being sensed.
My answer is simple. The best way is one in which someone can look at your program and understand it. I cannot stress enough the need for good documentation of your program. The best programs are ones that I can return to after several years and understand what it is doing within a few minutes. Programs should read like a book. This will aid in troubleshooting, modifying or teaching.
How do you approach a PLC program?
You must know everything about the logic or process before starting your program. Making a flow chart is one good method to learning the logic and process. The flow chart will bring out questions like the following:
What happens after a power outage? (In each condition of the outputs)
What happens if a sensor is not made? How long do you wait?
What are the critical items to monitor? (Ex. Air Pressure, Weight, Length, etc)
What happens...
Once you have written your program and are in the troubleshooting stage you can usually go back and add to your flow chart. Usually there is always something that needs to be added, changed or modified based upon the actual functioning of the program.
Consider each project a complete leaning opportunity.
Once you know what you want to do with the PLC and have a good understanding of the logic flow, then it is time to start coding. Remember that there is no write or wrong method to program the PLC, either the program will work or it will not work.
Let's look at an example. We will start with something that we all know how it works.
Traffic Lights
We will look at three programming examples for the lights. Two different approaches to programming will be used, but the program function is the same. The last example will modify the logic for a car being sensed.
Logic:
First Example:
Traffic Light Program
Sample program for traffic light intersection with lights facing North /South and West /East.
Green is on for 5 seconds
Yellow is on for 2 seconds
Red has an overlap of 3 seconds
This program uses discrete bits and timers to accomplish this task.
The $FirstScan bit will reset the timers so if power is lost, the lights will start with Red / Red overlap before starting the sequence again.
The outputs are controlled by when the timers are on (Done) or off (Not Done)
North / South Traffic Lights
West / East Traffic Lights
You will notice that this program is fully documented and easy to understand.Monday, September 1, 2014
Who Else Wants To Know How A PLC Scans?
Programmable Logic Controllers (PLC) will scan very quickly. This can be anywhere from 1 to 20 ms, which translates into 1000 to 500 times each second. But what exactly is a scan?
A scan is when the PLC will complete the following:
Contact me for the above program. I will be happy to email it to you.
If you have any questions or need further information please contact me.
Thank you,
Garry
You can download the software and simulator free at the following address. Also listed are helpful guides to walk you through your first program.
Do-more Designer Software
How to use video's for Do-more Designer Software
A scan is when the PLC will complete the following:
Read Inputs:
Look at all of the inputs to the programmable controller. Digital, Analog, Communication
Execute Program:
Solve the logic to determine the output status. PLCs generally will solve the logic from left to right, top to bottom. The output of the rung before is available for the next rung.
This is like some of the popular bands of PLCs like Mitsubishi, Allen Bradley, Siemens, Omron, Automation Direct, etc. There are some exceptions like older Modicon models which solve the logic top to bottom, left to right. Always refer to the manufactures manual to ensure the program execution method.
Diagnostics and Communication:
The PLC will do a self check. It will verify that no errors exists in memory, cards attached, etc. This is critical because the PLC in an industrial application can have devastating effects if something malfunctions and the machine continues to function erratically. The PLC will stop executing, return the outputs to a normal state and indicate an error has occurred.
Communication will happen to the remote I/O, operator panels, etc.
Update Outputs:
Outputs are set according to the PLC program. (Digital, Analog) This is where the physical items will start moving. (Motors, Valves etc.)
To understand the scan, lets take a look at an example.
The following program will look at input X0 and set an internal bit for one scan one the rising edge of the input and one on the trailing edge of the input. The rising edge is when the input transitions from off to on and the trailing edge is when the input transitions from on to off.
The bits will only be on for one scan so we will increment an internal word by one when the bits go on. This way we will be able to see the bit increment in the word.
Leading edge one shot (one scan) bit. When the input signal goes on (X0) and C1 is not on, then C0 is turned on. The next rung will have C0 and X0 on so C1 turns on.
Remember: The PLC will scan from left to right, top to bottom and the outputs from the previous rung are available for the next.
C0 is on so the increment will add one to D0.
The next scan X0 is still on, C1 is now on so output C0 is turned off. C0 has been now on for one scan from the transition from off to on.
Trailing edge one shot (one scan) bit. When the input signal goes ooff (X0) and C3 is not on, then C2 is turned on. The next rung will have C2 and not X0 on so C3 turns on.
C2 is on so the increment will add one to D1.
The next scan X0 is still off, C3 is now on so output C2 is turned off. C2 has been now on for one scan from the transition from on to off.
If you have any questions or need further information please contact me.
Thank you,
Garry
Do-more Designer Software
Wednesday, August 27, 2014
Who Else Wants To Lean PLC Programming For Free?
I have always been an old school programmer. Hardware in front of you hooked up to all of the I/O. I have recently looked at the automation direct do-more designer software solution. The Do-More Designer Software will allow you to build your ladder logic, download into a simulator (comes with the software) and run the code. The price of all of this... FREE
I will not get into allot of details because the documention available already will get you through the software step by step.
- Download the software
- Install the software
- Use the YouTube videos for help with getting around the software and making your first program.
The following are several links to help you discover the plc programmer in you:
Automaion Direct - Do-more Programming Software
http://www.automationdirect.com/adc/Overview/Catalog/Software_Products/Programmable_Controller_Software/Do-more_PLC_Programming_Software
http://www.aboutplcs.com/do-more/software/
http://www.aboutplcs.com/do-more/software/simulator.html
The simulator has allot of great features, including PID simulation.
Do-more PLC - How to videos on youtube
https://www.youtube.com/playlist?list=PLPdypWXY_ROoJx-HnK9gj2Z5a-i7th-UK
Update: Here is a video from YouTube about the simulator basic instructions:
http://www.youtube.com/watch?v=ZnRSw3ykW6k#t=274
https://www.youtube.com/watch?v=4JiMzBHPa7E
If you have any questions, or need further information please contact me.
Thank you,
Garry
I will not get into allot of details because the documention available already will get you through the software step by step.
- Download the software
- Install the software
- Use the YouTube videos for help with getting around the software and making your first program.
The following are several links to help you discover the plc programmer in you:
Automaion Direct - Do-more Programming Software
http://www.automationdirect.com/adc/Overview/Catalog/Software_Products/Programmable_Controller_Software/Do-more_PLC_Programming_Software
http://www.aboutplcs.com/do-more/software/
http://www.aboutplcs.com/do-more/software/simulator.html
The simulator has allot of great features, including PID simulation.
Do-more PLC - How to videos on youtube
https://www.youtube.com/playlist?list=PLPdypWXY_ROoJx-HnK9gj2Z5a-i7th-UK
Update: Here is a video from YouTube about the simulator basic instructions:
http://www.youtube.com/watch?v=ZnRSw3ykW6k#t=274
https://www.youtube.com/watch?v=4JiMzBHPa7E
If you have any questions, or need further information please contact me.
Thank you,
Garry
Sunday, August 24, 2014
Here’s a Quick Way to Understand PLC Inputs and Outputs
The term I/O means Input/Output. I/O can come in two different types; Discrete or Analog
Most people starting out leaning about programmable logic controls (PLC) are taught all about discrete input and outputs. Data is received from devices such as push-buttons, limit-switches etc. and devices are turned on such as motor contactor, lights, etc. Discrete input and output bits are either on or off. (1 or 0)
The following program will show a motor control circuit stop start.
Motor off:
Motor on:
Analog inputs
Common input variables for analog are temperature, flow, pressure, etc. They are converted to an electrical signal into a PLC analog input. Standard electrical signals are 0 - 20 mA, 4 - 20 mA, 0 - 10 volts DC, -10 - 10 volts DC.
Note: It is recommended that a 4 - 20 mA signal is best. If voltage is required, a resistor can be added to get a voltage input.
Analog outputs
Common output variables for analog are speed, flow, pressure, etc. They are converted from a word in the PLC to the output of the analog. The range of signal is then outputted to the device to control the position, rate, etc. Standard electrical signals to the device are 4 - 20 mA, 0 - 10 volts DC, -10 - 10 volts DC.
Both Analog Inputs and Outputs use words to determine the signal going to or from the device.
Example: 4 - 20 mA current Input - 8 bit resolution
4 mA = 000000002 = 0016
20 mA = 111111112 = FF16
Example: 4 - 20 mA current Output - 8 bit resolution
0016 = 000000002 = 4 mA
FF16 = 111111112 =20 mA
For a review of numbering systems, follow the link below:
What everyone should know about PLC numbering systems
Let me know if you have any questions or need further information.
Most people starting out leaning about programmable logic controls (PLC) are taught all about discrete input and outputs. Data is received from devices such as push-buttons, limit-switches etc. and devices are turned on such as motor contactor, lights, etc. Discrete input and output bits are either on or off. (1 or 0)
The following program will show a motor control circuit stop start.
Motor off:
Motor on:
Analog inputs
Common input variables for analog are temperature, flow, pressure, etc. They are converted to an electrical signal into a PLC analog input. Standard electrical signals are 0 - 20 mA, 4 - 20 mA, 0 - 10 volts DC, -10 - 10 volts DC.
Note: It is recommended that a 4 - 20 mA signal is best. If voltage is required, a resistor can be added to get a voltage input.
Analog outputs
Common output variables for analog are speed, flow, pressure, etc. They are converted from a word in the PLC to the output of the analog. The range of signal is then outputted to the device to control the position, rate, etc. Standard electrical signals to the device are 4 - 20 mA, 0 - 10 volts DC, -10 - 10 volts DC.
Both Analog Inputs and Outputs use words to determine the signal going to or from the device.
Example: 4 - 20 mA current Input - 8 bit resolution
4 mA = 000000002 = 0016
20 mA = 111111112 = FF16
Example: 4 - 20 mA current Output - 8 bit resolution
0016 = 000000002 = 4 mA
FF16 = 111111112 =20 mA
For a review of numbering systems, follow the link below:
What everyone should know about PLC numbering systems
Thursday, August 21, 2014
Here's a Quick Way to Convert Grey Code into Binary for PLC
Grey Code
Grey Code is used because only one bit of data will change at a time. The following chart shows the conversion of Grey Code to Binary.
It is important for absolute encoders because if the power is interrupted the encoder will know where it is within the one bit.
Example:
Power is interrupted when the encoder is between 7 and 8. If we are looking at Binary Code all of the bits would be effected and we would not be sure as to what number we are looking at for the encoder. Therefore we have lost position. In Grey Code only one bit changes so we will still be able to tell if we were on 7 or 8 if the power was interrupted.
The following sample PLC program will convert 4 bit grey code into binary code.
This code was written in an Automation Direct PLC software called Do-more Designer.
Do-more Designer Software
How to use video's for Do-more Designer Software
Contact me for the above program. I will be happy to email it to you.
Thank you,
Garry
Grey Code is used because only one bit of data will change at a time. The following chart shows the conversion of Grey Code to Binary.
Number | Binary Code | Grey Code | Number | Binary Code | Grey Code |
0 | 0000 | 0000 | 8 | 1000 | 1100 |
1 | 0001 | 0001 | 9 | 1001 | 1101 |
2 | 0010 | 0011 | 10 | 1010 | 1111 |
3 | 0011 | 0010 | 11 | 1011 | 1110 |
4 | 0100 | 0110 | 12 | 1100 | 1010 |
5 | 0101 | 0111 | 13 | 1101 | 1011 |
6 | 0110 | 0101 | 14 | 1110 | 1001 |
7 | 0111 | 0100 | 15 | 1111 | 1000 |
It is important for absolute encoders because if the power is interrupted the encoder will know where it is within the one bit.
Example:
Power is interrupted when the encoder is between 7 and 8. If we are looking at Binary Code all of the bits would be effected and we would not be sure as to what number we are looking at for the encoder. Therefore we have lost position. In Grey Code only one bit changes so we will still be able to tell if we were on 7 or 8 if the power was interrupted.
The following sample PLC program will convert 4 bit grey code into binary code.
This code was written in an Automation Direct PLC software called Do-more Designer.
Do-more Designer Software
How to use video's for Do-more Designer Software
Contact me for the above program. I will be happy to email it to you.
Thank you,
Garry
Monday, August 18, 2014
What Everybody Ought to Know About PLC (Programmable Logic Controller) Numbering Systems
Programmable Logic Controllers (PLC) are the same as computers. They only understand two conditions; on and off. (1 or 0 / Hi or Low/ etc.) This is known as binary. The PLC will only understand binary but we need to display, understand and use other numbering systems to make things work. Let's look at the following common numbering systems.
Binary has a base of two (2). Base means the number of symbols used. In binary the symbols are 1 or 0. Each binary symbol can be referred to as a bit. Putting multiple bits together will give you something that looks like this: 100101112. The 2 represents the number of symbols/binary notation. Locations of the bits will indicate weight of the number. The weight of the number is just the number to the power of the position. Positions always start at 0. The right hand bit is the 'least significant bit' and the left hand bit is the 'most significant bit'.

Let's look back at our example to determine what the value of the binary number is:
100101112 =
We start with the least significant bit and work our way to the most significant bit.
1 x 20 = 1 x 1 = 1
1 x 21 = 1 x 2 = 2
1 x 102 = 1 x 10 x 10 = 100
15110 = 1 + 50 + 100
151 = 151
Hexadecimal has a base of sixteen (16). The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal is used to represent binary numbers. F16 = 11112
Every for bits of binary represent one hexadecimal digit.
In our original binary number we now can convert this to hexadecimal.
100101112
The least significant four bits are:
01112 =
1 x 20 = 1 x 1 = 1
1 x 21 = 1 x 2 = 2
Binary has a base of two (2). Base means the number of symbols used. In binary the symbols are 1 or 0. Each binary symbol can be referred to as a bit. Putting multiple bits together will give you something that looks like this: 100101112. The 2 represents the number of symbols/binary notation. Locations of the bits will indicate weight of the number. The weight of the number is just the number to the power of the position. Positions always start at 0. The right hand bit is the 'least significant bit' and the left hand bit is the 'most significant bit'.
Let's look back at our example to determine what the value of the binary number is:
100101112 =
We start with the least significant bit and work our way to the most significant bit.
1 x 20 = 1 x 1 = 1
1 x 21 = 1 x 2 = 2
1 x 22 = 1 x 2 x 2 = 4
0 x 23 = 0 x 2 x 2 x 2 = 0
1 x 24 = 1 x 2 x 2 x 2 x 2 = 16
0 x 25 = 0 x 2 x 2 x 2 x 2 x 2 = 0
0 x 26 = 0 x 2 x 2 x 2 x 2 x 2 x 2 = 0
1 x 27 = 1 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 128
100101112 = 1 + 2 + 4 + 16 + 128
100101112 = 151
Note that the we just converted the binary number to our decimal numbering system. The decimal numbering system is not written with a base value of 10 because this is universally understood.
To be sure we have the concept down, let's take a look at our decimal numbering system the same way as we did the binary.
Decimal has a base of ten (10). The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
15110 =
1 x 100 = 1 x 1 = 1
5 x 101 = 5 x 10 = 501 x 102 = 1 x 10 x 10 = 100
15110 = 1 + 50 + 100
151 = 151
Hexadecimal has a base of sixteen (16). The symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. Hexadecimal is used to represent binary numbers. F16 = 11112
Every for bits of binary represent one hexadecimal digit.
In our original binary number we now can convert this to hexadecimal.
100101112
The least significant four bits are:
01112 =
1 x 20 = 1 x 1 = 1
1 x 21 = 1 x 2 = 2
1 x 22 = 1 x 2 x 2 = 4
0 x 23 = 0 x 2 x 2 x 2 = 0
01112 = 1 + 2 + 4 + 0 = 716
The most significant four bits are:
10012 =
1 x 20 = 1 x 1 = 1
0 x 21 = 0 x 2 = 0
0 x 22 = 0 x 2 x 2 = 0
1 x 23 = 1 x 2 x 2 x 2 = 8
10012 = 1 + 0 + 0 + 8 = 916
Therefore:
100101112 = 9716
We can now convert this hexadecimal number back into decimal
9716 =
The following chart will show all of the combinations for 4 bits (nibble) of binary. Its shows the Binary, Decimal and Hexadecimal (Hex) values. It is interesting to not that Hex is used because you still have only one digit (Place Holder) to represent the nibble of information.
Therefore:
100101112 = 9716
We can now convert this hexadecimal number back into decimal
9716 =
7 x 160 = 7 x 1 = 7
9 x 161 = 9 x 16 = 144
9716 = 7 + 144 = 151
9716 = 7 + 144 = 151
Binary | Decimal | Hexadecimal | Binary | Decimal | Hexadecimal |
0000 | 00 | 0 | 1000 | 08 | 8 |
0001 | 01 | 1 | 1001 | 09 | 9 |
0010 | 02 | 2 | 1010 | 10 | A |
0011 | 03 | 3 | 1011 | 11 | B |
0100 | 04 | 4 | 1100 | 12 | C |
0101 | 05 | 5 | 1101 | 13 | D |
0110 | 06 | 6 | 1110 | 14 | E |
0111 | 07 | 7 | 1111 | 15 | F |
ASCII (American Standard Code for Information Interchange)
Two nibbles (8 bits of data) together form a byte. A byte is what computers (PLC) use to store and use individual information. So it will take one unique byte to represent each individual numbers, letters (upper and lower case), punctuation etc. www.AsciiTable.com
Example:
Chr 'A' = 4116 = 010000012
Chr 'a' = 6116 = 011000012
Chr '5' = 3516 = 001101012
Each time you hit a key on your keyboard, the following 8 bits of data get sent.
A word is made up of two bytes, or 4 nibbles, or 16 bits of data. Words are used in the PLC for holding information. The word can also be referred to as an integer.
Long word / Double word is made up of 4 bytes, or 8 nibbles, or 32 bits of data. Long words are used for instructions in the PLC like math.
Hey what about negative numbers?
So far we have talked about unsigned words. (Positive numbers)
Signed words can hold negative numbers. Bit 15 (most significant bit) of a word is used to determine if the word is negative or not.
The following table shows you the signed vs unsigned numbers that can be represented in the PLC.
Memory retentiveness:
When working with PLC's look at the memory tables to determine what will happen if power is removed from the device. Will the bits go all off or retain their prior state?
Usually there will be areas that can be used in the PLC for both conditions.
As you can see PLC numbering systems and computers are very much related and it all boils down to individual bits turning on and off. The interpretation of these bits will determine what the value will be.
Reference:
Let me know your thoughts, or questions that you have on PLC numbering systems.
Subscribe to:
Posts (Atom)