Jump to content
  • PLC programming technology and HMI interface design English database

    PLC, DCS, HMI and SCADA product application technical articles

    leigehong
    Different Blocks structures are available when programming a PLC, these blocks include Functions FCs, function blocks FBs, and data blocks DBs. These blocks are very handy tools that you can use to better design your PLC logic and make your code more readable and easy to follow and debug
    In previous articles, we discussed the FCs and FBs. In this article, we will discuss the Data Block DBs, more specifically the Global Data Block.
    Contents:
    What is a data block DB? Types of data blocks. What is a global data block? Creating a global data block? Working with Global data blocks. Example simulation. What is a Data Block?
    A data block DB is a memory area that is used to save the values of the parameters that are written during the execution of the PLC program.
    Opposite to the code block, the data block DB contains only variable declarations. It doesn’t have any networks or instructions like an FC or an FB has. The structure of the DB is defined by how many variables you have declared inside the data block.
    Types of Data Blocks in PLC
    There are two types of data blocks:
    Global Data blocks Instance data blocks ARRAY data blocks Global Data Blocks
    As the name suggests, the global data block is globally declared for the whole PLC logic. It is not assigned to a specific code block. You can access the values of a global data block from any code block anywhere in your PLC logic. A global data block contains only static tags.
    The structure of the global data block can be freely defined. In the declaration table for data blocks, you declare the data elements that are to be contained in the global data block.
    Instance data Blocks
    The instance data block is assigned directly to a function block FB, whether this function block is internally defined in the PLC like Timers and Counters or user-defined Function blocks FBs.
    The structure of an instance data block cannot be freely defined but is instead determined by the interface of the function block. The instance data block contains exactly those block parameters and tags that are declared in the Function block interface.
    However, you can define instance-specific values in the instance data block; for example, start values for the declared tags.
    ARRAY Data Blocks
    Available only for S7-1500 CPUs, ARRAY data blocks are global data blocks that consist of an ARRAY. This ARRAY can be based on any data type.
    For example, an ARRAY of a PLC data type (UDT) is possible. The DB contains no other elements besides the ARRAY. Because of their flat structure, ARRAY data blocks facilitate access to the ARRAY elements and their transfer to called blocks.
    The “Move operations” section of the “Instructions” task card offers options for addressing ARRAY DBs.
    In this article, we will take about the global data block, and we will discuss the other two types in separate articles.
    What is Global Data Block?
    Data blocks are used to store PLC program data. That means they contain variable data that is used by the user program. Global data blocks store data that can be used by all other blocks.
    The maximum size of data blocks varies depending on the CPU. You can define the structure of global data blocks any way you, please.
    You also have the option of using PLC data types (UDT) as a template for creating global data blocks.
    Every function block FB, function FC, or organization block OB can read the data from a global data block or can itself write data to a global data block. This data remains in the data block even after the data block is exited. See picture 1.

    Picture 1 – Accessing global data block
    As you can see from the previous picture, a global data block can be accessed from any code block inside the PLC program, whereas the instance data block can only be accessed by the associated function block.
    Creating a Global Data Block
    You create a global data block the same way you create a function FC or a function block FB. From the add a new block to your project tree. See picture 2.

    Picture 2 – Creating a global data block
    Let’s declare some variables inside the Global data block.
    You do that by clicking the add new under name section writing the variable name that you want and then choosing the variable data type. See picture 3.

    Picture 3 – Variables declaration in a global data block
    Working with a Global Data Block
    Declaring a tag. We already showed how to declare a tag/variable in picture 3.
    Defining a start value The start value of a tag is a value defined by you, which the tag assumes after a CPU startup. The value must match the data type of the tag and should not exceed the range of the data type. See picture 4.
    The tag takes the defined value at startup, provided it was not declared as retentive.

    Picture 4 – Defining the start value of your tags
    So, if I set the Tank1Level start value to any value other than zero, this value will be applied the next time the PLC is restarted. See picture 5.

    Picture 5 – Defining a start value for your variables
    Retaining of variables in global data blocks To prevent data loss in the event of power failure, you can mark the data as retentive. This data is stored in a retentive memory area.
    The options for setting the retain depend on the type of data block and the type of block access that is set. See picture 6.

    Picture 6 -. Retain option in global data blocks
    As you see in picture 6, the Tank2Level variable is set to be a retained value, which means even if the PLC stopped or there was a power failure, the Tank2Level will have the same data stored when the PLC is on again. It will not be reset to the start value.
    Accessibility to/from HMI In a global data block, you can define if a variable can be visible from the HMI tag tables or not. You can also define if this variable can be read or written from the HMI. See picture 7.

    Picture 7 – Accessibility from HMI
    The default setting for any declared variable in a global data block is that it can be accessed, read, and writable from HMI. If you want to disable this feature for a certain variable, you have to uncheck the accessibility option for that variable.
    Example Simulation
    So far we created a global data block and declared some variables inside.
    Now we will try to run a simulation of the program and see if we can better understand what a global data block is.
    Two PLC simulations are provided below.
    Testing the Start Values of a Variable
    Check the following animation explaining the start value of a variable inside a global data block.

    Animation 1
    Animation 1 Explanation:
    The start values of the tank level parameters are zero, you can see in the video they are being changed by the simulation screen. When the PLC is restarted, powered off then powered on again, you see that the values will be reset to the start values which are zero. After that, the start values were changed to 500, 32654, and -356 respectively, and when the PLC is restarted the values were changed to the new start values. Notice that when we changed the start values, we had to download our logic again to the PLC; you need to do that each time you make a change to your logic. Testing the Retain Option of Variables in Global DB
    Check the following animation explaining the retain option of a variable inside a global data block.

    Animation 2
    Animation 2 Explanation:
    First, you will notice that the Retain property of Tank2Level is now active. You see in the video the values of the 3 tanks are being changed. When the PLC is stopped and then started again, the Tank1Level and Tank3Level are reset back to the start value which is 0, but Tank2Level retained its value of -22938 Conclusion
    A global data block can be accessed from anywhere and by any block that exists in the PLC program. You can declare as many variables as you want inside a global database.
    The best practice technique is to create separate data blocks for the different sections of your logic, to make it very easy to follow your logic. For example a separate data block for all the variables that need to be read or written by an HMI.

    leikang
    In previous articles, we talked about timers in PLC, different types, and how to use them. Timers don’t really need real-time to work, as they just depend on counting seconds or milliseconds depending on your settings.
    But for some applications, you need to know the PLC program’s real date and time for example for diagnostics purposes.
    In this article, we will talk about the system and local time of a PLC.
    Contents:
    Why do I need real-time in PLC? Example program and simulation What is system time? What is local time? Conclusions. Why do I need Real-time in PLC?
    In many applications of PLCs, you would need to know the real-time while the process is running, for many different reasons.
    Following are some of these reasons:
    Backup of the PLC to the main server. For diagnostics of the PLC, you need to have a time record for the diagnostics, to know at which time a certain event has occurred, otherwise, diagnostics information wouldn’t be very useful. For applications where you need to work with the time of day interrupts OB10 you would need to know the actual time. You might need to use local time or system time in parts of your logic where you need to handle real-time applications. For data logging, if you have important data to save and you need the time stamp for each data recording, then you need to have the right time setting for your PLC so that stored data would make sense. PLC Example Program and Simulation
    To better understand what is system time and local time in a PLC, we will start by creating a very simple program and use it to explain the concept of real times inside PLCs.
    Check the following step:
    In this article, we will not create any PLC logic, but we will show some configurations that are related to the system and local time in PLC, how to set them, and what are the differences.
    Open Siemens Tia Portal, Add a new device, and this time we will use the CPU 1512C-1 PN. See picture 1.

    Picture 1 – Add new PLC
     Compile and start a new PLC simulation. open the online & diagnostics page and check the set time of the PLC. See picture 2.

    Picture 2 – Online time of the PLC
    From the previous picture you can see that there are two different times:
    The PG/PC time – this is the local time of your PC itself. The Module time – this is the actual time inside the PLC itself. Both these times can be set as the same value, or they can be different. it is best to make them the same, it is better to make the module time similar to your local time, or more specifically similar to the local time of the area where the PLC will be used. See picture 3.

    Picture 3 – Set time of the PLC
    If you want module time to be the same as local time, then select Take from PG/PC and press apply.
    In your main OB1, drag and drop the RD_SYS_T and RD_LOC_T instructions.
    These are the read system time and read local time instructions. These instructions are built-in functions FCs inside the PLC and they are used to write the local time and system time of the PLC to whichever destination you choose in the output OUT of the instruction. see picture 4.

    Picture 4 – Add read system and local time instructions
    Add a new global data block, and define some tags to work with. See picture 5.

    Picture 5 – Create a new global data block
    Run your simulation again and check both times. See pictures 6

    Picture 6 – Online local and system time of the PLC
    You see from the previous picture that the local time and system time of the PLC is the same, but they are different from the actual local time of your PC.
    If you remember, we have set the module time of the PLC to be similar to the PG/PC time, which is your local time. See picture 7.

    Picture 7 – Module time and PG/PC time
    As you see, on the set time page the module time is chosen to be taken from PG/PC time. But then in actual cases, they are different. Why?
    Why times are different? Because the default setting of the PLC local time is the UTC+0 or the Zulu time if you’re familiar with that term, you don’t change it from the online and diagnostics page, but rather from the properties of the PLC itself. See picture 8.

    Picture 8 – Time of day configuration in a PLC
    As you can see, the default setting of the PLC time of day is set to UTC+0 time, and that is why the PLC module time was different from your actual local time. Except if you were actually in London, then you wouldn’t face this problem.
    To correct the PLC local time we have to change that in the configuration, we need to change the time zone to the time zone we have, which is in my case the UTC+02:00. See picture 9. 

    Picture 9 – Adjusting PLC local time to your time zone
    You can also see that the daylight saving time option was deactivated because it is not used in my country. You will have to activate it if it is used in your area.
    Now that all configurations are set correctly, go back and see the local time and system time again in the simulation. See picture 10.

    Picture 10 – The local time of PLC is now the same as PC
    You see now after adjusting the PLC time zone, the local time of the PLC and the actual local time of your area is the same.
    As we said before it is very important to set the right local time of the PLC, for the many reasons we mentioned above. Can you now define what is the system time and local time of the PLC?
    System Time in PLC
    Is the module time of the CPU clock.
    The CPU clock interprets the module time as the coordinated universal time (UTC). Accordingly, the module time is always stored without the factors “local time zone” or “summer time” in the CPU clock. The CPU clock then calculates the local time of the CPU clock based on the module time.
    The module time of the CPU clock is used as a template for all time processes starting from the CPU.
    Examples of use:
    Calculation of local time of CPU clock based on module time Representation of the module time in local time under “Online & Diagnostics” Entries in the diagnostics buffer of the CPU Local Time in PLC
    Information on the time zone and the start of daylight saving time and standard time, which you have set in the configuration of the CPU clock, is used to output the local time.
    Local time is the time you have on your PC or in your country which will be different from one area to another.
    Conclusion
    Many applications will require that the PLC would know the real-time or local time of the process, so that it would be able to perform certain tasks, for example, data logging and diagnostics tasks. In a future article, we will show some applications where real-time is needed for your logic
    The local time of the PLC should be manually configured to match the area where the PLC will be used.

    leizuofa
    In previous articles we discussed different types of Blocks in SIEMENS TIA Portal, we talked about function blocks FBs, functions FCs, and data blocks DBs.
    In this article we will take about another type of block in SIEMENS PLCs, these are the organization blocks, and in this article, we will discuss the most important organization block of them all, which is the Main Organization Block or OB1.
    Contents:
    What are organization blocks? Different types of OBs. What is OB1? Cycle time monitoring. Simple program example. Conclusion. What is an Organization Block (OB)?
    Organization blocks, you can think of them as functions FCs or function blocks FBs. But the difference is, you don’t call them, the operating system of the PLC calls these organization blocks, whether the operating system calls the OB cyclically as OB1 or whether it gets called when a certain event occurs, either way, the operating system takes care of it. You only need to create the block and add whatever logic you want inside the block. Sometimes you don’t even need to add any code inside the OB, just creating the OB itself can provide many benefits, which we will see when discussing some of those OBs.
    Organization blocks are the interface between the PLC operating system and the user program. Any PLC will have two different programs, the runtime program which is the operating system of the PLC, and the user program which is the logic or code that the PLC programmer will write to control a certain process. This two different software need to talk with each other, and the organization blocks OBs are how that is done.
    Organization blocks OBs are used to perform a lot of tasks, some of which are listed below:
    Startup characteristics of the automation system Cyclic program processing Interrupt-driven program execution Error handling. Different Types of Organization Blocks
    As organization blocks are basically the tools of the operating system to perform a lot of tasks.
    Different tasks require different OB, and that is why you have many different OBs inside a PLC, how many different OBs will depend on the type of PLC you are using, but here are some of the most common OBs you can find in almost all of SIEMENS PLC:
    Main Cyclic OB1. Time interrupts OBs. Time of day OBs. Software errors OBs. Hardware errors OBs Many more Organization blocks are available for use with your logic. See picture 1.

    Picture 1 – Different Organization Blocks available in TIA Portal
    In this article, we will discuss the most important organization block of them all, which is the Main Cyclic Interrupt OB1.
    Main Cyclic Interrupt OB1
    The main cyclic OB1 is the organization block which is responsible for cyclically executing your logic by the PLC. Whenever you create a new project and add a PLC, the Main OB1 will be automatically created by the software. These are the minimum needed blocks for a PLC code. See picture 2.

    Picture 2 – Main OB1 is created automatically
    Inside this Main OB1, you can either write your whole PLC program if it is a small project. If your project is quite large, then you probably have some functions FCs of function blocks FBs that you need to execute. In that case, you will use the Main OB1 to call them.
    Off course, you don’t have to call every FC or FB by the OB1, but if your OB1 is not the first block of your nesting calls, then it will not be executed. See picture 3.
    146-
    Picture 3 – Calling your blocks by OB1
    The essential basis of your PLC code is the cyclic behavior, meaning you need your code to be executed continuously. When the processing of your logic has been completed, the operating system starts processing it again. That is done through the use of the main OB1, you put and call all of your logic and code inside this OB1 and the operating system will make sure to continuously execute it.
    You should know that, even if you can’t create an OB1 block as it is automatically created when adding a new PLC, you can create more than one cyclic interrupt block.
    OB1 is a cyclic interrupt, that the operating system will automatically and continuously call and executed whatever logic is inside. However, for large PLC projects where you have so many functions and function blocks in your PLC logic, you can use more than one cyclic interrupt OB to better structure your code to make it easy to read and follow.
    In that case, you would create another cyclic interrupt, see picture 4.

    Picture 4 – Creating more than one cyclic OB
    When you have created several program cycle OBs, these are called one after the other in the order of their OB numbers.
    The program cycle OB with the lowest OB number is called first. See picture 5.

    Picture 5 – Program cycle with more than one cyclic OB
    After the cyclic program is complete, the operating system updates the process images as follows:
    It writes the values from the process image output to the output modules. It reads the inputs at the input modules and transfers these to the process image input. The previous two steps plus the execution of the PLC program are called a scan cycle. See picture 6.

    Picture 6 – Scan cycle of a Siemens PLC
    Cycle Time Monitoring
    Cycle time refers to the runtime of the cyclic program, including the runtime of all nested program parts like FCs, FBs, and higher-priority OBs. If you have created several program cycle OBs, each program cycle OB contributes to the cycle time.
    The operating system monitors whether the cycle time remains smaller than the configured maximum cycle time. If it exceeds the maximum cycle time, PLC will either go to STOP mode or call OB80 depending on your programming.
    Apart from monitoring the maximum cycle time, it is also possible to guarantee a minimum cycle time. To do this, the operating system delays the start of a new cycle until the minimum cycle time has been reached.
    You can configure the minimum and maximum cycle time in the configuration properties of your PLC. See picture 7.

    Picture 7 – Configure the minimum and maximum cycle time
    Simple Program Example in PLC

    Picture 8 – PLC Program Example
    To better understand the PLC program cycle and OB1 execution, let’s create a simple program. This program will use an add instruction that will accumulate a value of 1 into a memory area each 1 scan cycle. See the following simulation.

    As you see from the animation, the add instruction is being executed very fast; this is how fast the scan cycle is. It will depend on how powerful your PLC is. But mainly the scan cycle is in the range of milliseconds.
    Conclusion
    Organization blocks are the interface between the PLC operating system and your control program. Main Cyclic OB1 is cyclically executed by the operating system. You will execute your logic by including it inside one or more Cyclic OBs. The scan cycle time is the time used to execute your logic 1 time.

    leizuofa
    Controlling a process in any machine or system has always been a fantasy for engineers. Thanks to the advent of technology, many controllers have been developed to control a process flexibly and reliably.
    With controllers, there are two general types that are widely used in many processes, from small scale to large scale. They are microcontrollers and PLCs. They can do every operation, ranging from small calculations to complex algorithms, logic performance, and data processing. This makes the task easier by automating the process.
    In this post, we will see the difference between microcontroller and PLC.
    What is a Microcontroller?
    Let us understand the basics first. You have one push button and one lamp. You are asked to turn the lamp on after 5 seconds of pressing the push button. From these, what do we require to execute this task? You will require one input (push button), one output (lamp), one controller to execute this task (processor type), one power supply to power the circuits, and one memory to store this logic and the status of inputs and outputs. This, when combined in a single package, makes a microcontroller.
    In short, a microcontroller is a type of small computer that takes physical inputs, processes the logic according to them, and turns on or off the physical outputs. It is a small chip-type device that embeds all these circuits in it, like a small package, and does all the processing and controlling work.
    A microcontroller will handle a small number of inputs and outputs. For example, consider a small display circuit like LED or LCD mounted on a handheld device. If you press a push button on it, it will display the corresponding number on the display.
    And when you press another push button, it will show some other number written according to the logic inside the processor. This means it was first programmed to show a number, and then by pressing the second button, a calculated number would be shown. All these calculations, storage handling of variables, and IO processing are done inside this microcontroller chip.

    What is a PLC?
    Let us go ahead to some higher level of processing. You have 50 number of sensors, either 4-20 mA or thermocouple types. You have 20 different types of outputs, either 0-10V DC actuators or relay outputs. You have been assigned the same task to accept inputs and control outputs according to the logic written in it.
    All the same components of IO’s, power supply, processor, and memory will be required. But, you can see all these IO boards/pins with memory and processor cannot be embedded on a small single chip. This is when PLC comes into the picture. PLC is basically an extension of the microcontroller. It is a cabinet-box-type device that has IO boards, memory, and a processor; all interfaced with each other on different chips. All these chips make a single PLC cabinet.
    The IO’s can be of different types, ranging from simple digital signals to complex analog signals. They have special communication boards, which can communicate with real-life protocols like Ethernet, Modbus, CAN Open, Profibus, Profinet, etc.
    Microcontrollers too have communication boards, but they are of small interfaces and limited connectivity.
    The IO modules are either embedded in the main PLC or connected to remote modules through communication. This easily allows for the expansion of IOs. Various high-grade industrial sensors and actuators can be easily interfaced with PLC.
    Difference between Microcontroller and PLC
    Now that we have understood their meaning, let us have a look at their differences:
    In the definition only, we got to know that a PLC can handle a large number of processes and cycles. That is why, it is best used for industrial applications. Microcontrollers cannot cater to a large number of IOs with complex wiring and communication requirements. It is best suitable for small-scale applications. Signal processing is much more flexible in PLC as compared to a microcontroller. This means, analog to digital conversion, high-speed counter inputs, and outputs are more easily configured in a PLC than in a microcontroller. Microcontrollers are cheaper in price than PLC, due to the limited amount of features it provides. The main advantage of PLC is its ruggedness and stability. With a very high temperature and environmental stubbornness, it is the best suitable product for critical, risky, and harsh environments. PLC can be much better prone to electromagnetic noise and such other types, than a microcontroller. Programming is very easier in PLC than in a microcontroller. Microcontrollers use complex software like C and C++ for programming, which is much easier in a PLC as it has languages that easily co-relate to an electrical drawing understanding. Microcontrollers require knowledge of embedded systems, VLSI, and software to design it, whereas PLC programmers require knowledge of industrial automation, instrumentation, and networking to design it.

    leizuofa
    Sequential logic is of great use in PLC programming. It helps in sorting out things easily. A wide range of applications that use PLC has some or the other sequential logic written in it.
    Two of the most widely used sequences are LIFO and FIFO. You must have heard the names in electronics when used for stacking and sequencing. These types of sequential logic are available in PLC too.
    In this article, we will learn the LIFO and FIFO sequence concepts in PLC programming.
    FIFO Sequence in PLC
    FIFO stands for first in first out. The meaning of this sequence can be understood easily from its name. The thing that comes first will go out first. You input one element; and when you request an element, the first one that is entered will be given to you. This same logic works in PLC programming for the FIFO sequence.
    In programming, a logic block is assigned named FIFO. It can store up to 16 words or more, depending on the PLC. It contains three types of inputs – reset, storage, and retrieval.
    On a rising edge of the reset input, the sequence is reset and made empty. On a rising edge of the storage input, the word present at the input is stored in the block. The block will memorize the sequence of words received.
    On a rising edge of the retrieval input, the word entered first will be given in the destination word configured by the PLC programmer. It has two outputs – empty and full. If the empty bit is true, then it indicates that the storage is empty, and if the full input is true, then it indicates that the storage is full.

    LIFO Sequence in PLC
    LIFO stands for last in first out. The meaning of this sequence can be understood easily from its name. The thing that comes last will go out first. You input one element; and when you request an element, the last one that is entered will be given to you. This same logic works in PLC programming for the LIFO sequence.
    In programming, a logic block is assigned named LIFO. It can store up to 16 words or more, depending on the PLC. It contains three types of inputs – reset, storage, and retrieval. On a rising edge of the reset input, the sequence is reset and made empty.
    On a rising edge of the storage input, the word present at the input is stored in the block. The block will memorize the sequence of words received.
    On a rising edge of the retrieval input, the word which entered last will be given in the destination word configured by the programmer. It has two outputs – empty and full. If the empty bit is true, then it indicates that the storage is empty, and if the full input is true, then it indicates that the storage is full.
    These sequences are pretty easy to operate. The programmer has to take care that any inputs are not given simultaneously to the storage blocks. The block will then not do any action in this case. Only one input has to be given at a time. It is also to be noted that different PLCs function differently on warm restart or cold restart.
    Generally, in a PLC cold restart, for example, the register will be reset and in case of a warm restart, the register will be intact as it is. It depends on manufacturer to manufacturer.

    caixiaofeng
    There are many instructions in PLC that help in executing the logic in a simplified way. Instructions come in various categories like arithmetic, comparison, logical, controller, etc. For example, a simple addition instruction for adding two variables comes in the arithmetic category. So, similarly, many types of instructions are available in a PLC logic.
    One such instruction which is widely used in PLC programming is shift instruction. It comes in the category of numerical processing.
    In this article, we will learn the concept of shift bit register instruction in PLC programming.
    Shift Bit Register in PLC
    As the name implies, a shift instruction is a command for shifting bits of a word by some predefined position.
    For example, you have a word of 16 bits. You want to move bit number 3 from its current fourth position to the seventh position. So, whenever a shift command pulse is given, the bit will shift in each trigger from the fourth position to the seventh position.
    In that continuity, the bit in the fifth position will move to the eighth position; and the bit in the third position will move to the sixth position. So, here, you are shifting the bits in a group by the number of positions you define.
    Shift Instruction
    Shift instructions come in two types – shift and rotate. Let us have a look at the rotate instruction. Consider a syntax – %MW10:= SHL (%MW12, 4). %MW10 is the destination memory word and %MW12 is the source memory word.
    Refer to the below image. In %MW10, when a first trigger for shift left is given, bit0 shifts to bit1, and so on. This result is stored in %MW12. When such triggers are given four times, ultimately, bit 0 will shift finally to bit 4, and so on.
    The end result is stored in %MW12 anyways and you get a final answer of the bits shifted by four positions from the source word. But, one thing to remember is, with each shift, the preceding bit is filled with value 0. This you can see clearly in the image.
    After the first shift, the first bit in %MW12 is 0. So, after four shifts, the end result will be – 0000 1101 1100 0000. This shift can thus be either right or left.

    One more type of shift comes in PLC; the earlier one added zeroes from the preceding position, but this second type keeps the value of the first bit (MSB for right and LSB for left) as it is. This is called arithmetic shifting.
    So, if the value of the first bit (MSB for right and LSB for left) initially before the shift was 1, then the last bit will remain as 1 only and the zeroes will be added from the second preceding bit up to how many times the shift command is given. It is to be noted that the last bit which is shifted is always stored in a carry bit.
    Rotate Instruction
    The second type is rotate instruction. Consider the syntax – %MW10:= ROL (%MW12, 4). %MW10 is the destination memory word and %MW12 is the source memory word. We will use the same above image for reference. Rotate instruction, as the name defines, just rotates the bits by how many positions you define.
    Compared to shift instruction where zero was added after every preceding bit; here, the bits are just shifted in the same sequence as it is in the left direction. So, suppose you have a source word of – 1100 1010 1100 0101; then, after a trigger of 4 positions, the end result will be – 1010 1100 0101 1100. The same logic works in the right direction. The last bit shifted is also stored in a carry bit.
    One more type comes in the rotate category. Here, instead of shifting only 16 bits, the carry bit to is rolled over. This means, the last bit is shifted to the carry bit, and the carry bit will then be shifted to the first bit, and so on. In the earlier type, the last bit was only stored in the carry bit.

    xiangjinjiao
    Siemens is a well-known multinational company that operates in a variety of industries, including energy, healthcare, transportation, and industrial automation. Siemens was founded in 1847 and has since grown into a global corporation with operations in many countries. Siemens is known for its innovative products and services, and it has been recognized as one of the world’s most sustainable companies.
    In this article, we will give an overview of Siemens PLC which is a very small portion of Siemens’s various products in the industrial automation sector.
    Contents:
    Siemens in industrial automation. Siemens Different PLCs families. Overview of Siemens S7 PLCs. Simatic S7-1200. Simatic S7-1500. Simatic S7-300. Simatic S7-400. Simatic S7-ET 200 CPU Why are there a lot of different models? How to decide which type of S7 PLCs best fits my application? Conclusion. Siemens in Industrial Automation
    Siemens is a leader in the field of industrial automation and is known for its high-quality products and solutions. The company offers a wide range of industrial automation products, including programmable logic controllers (PLCs), human-machine interfaces (HMIs), variable frequency drives (VFDs), and industrial communication networks.
    Siemens also provides software solutions for industrial automation, such as the Totally Integrated Automation TIA Portal, which is an engineering framework that integrates all automation software tools in one platform. Also, Siemens has developed its own Industrial Internet of Things (IIoT) platform called MindSphere, which enables the collection and analysis of data from connected devices in industrial environments.
    Siemens Different PLCs families
    Siemens have two main families of PLCs that were developed and they are:
    Simatic S5 family of PLCs Simatic S7 family of PLCs The Simatic S5 series was Siemens’ previous generation of PLCs, and it is still in use in some older industrial systems. But is no longer manufactured.
    The Simatic S7 series is the current Siemens PLC. It offers a wide range of CPUs with varying levels of performance and functionality to meet different automation needs. The S7 series is known for its reliability, robustness, and flexibility, and is widely used in industries such as automotive, food and beverage, and pharmaceuticals.
    Overview of Siemens S7 PLC
    Siemens S7 generation of PLCs offers a wide range of CPUs with different levels of performance and functionality to meet the demands of different industrial automation processes, these CPUs will belong to one of the below sub-families:
    Simatic S7-1200
    The Simatic S7-1200 is a compact PLC designed for small to medium-sized applications. It offers a flexible and cost-effective automation solution with its compact design, integrated communication, and programming options.
    Simatic S7-1500
    The Simatic S7-1500 is a high-performance PLC designed for medium to large-scale applications. It offers advanced functionality such as motion control, safety, and security, making it suitable for complex automation tasks.
    Simatic S7-300
    The Simatic S7-300 is a modular PLC that can be easily adapted to a wide range of applications. It offers high processing power, extensive communication options, and a wide range of I/O modules, making it a popular choice for many industries.
    Simatic S7-400
    The Simatic S7-400 is a high-performance PLC designed for demanding applications that require high processing power and extensive communication capabilities. It offers a large number of I/O modules, redundancy options, and advanced diagnostics, making it suitable for complex automation tasks.
    Simatic S7-ET 200SP
    The Simatic S7-ET 200SP is a compact remote I/O system that can be easily integrated with other Simatic S7 PLCs. It offers a high degree of flexibility, scalability, and modularity, making it suitable for various automation applications.
    When you create a new project in TIA Portal and try to add a new device, you can find all the available and supported CPUs from different S7 families. See picture 1.

    Picture 1 – Different PLCs are available in the Simatic S7 generation
    S7-1200 PLC
    The Simatic S7-1200 is a versatile and cost-effective PLC that offers a range of models to meet different automation needs, making it a popular choice for small to medium-sized applications.
    Here’s an overview of the different models in the S7-1200 series:
    Simatic S7-1200 CPUs: These are the standard CPUs in the S7-1200 series, and they come in different versions, including CPU 1211C, CPU 1212C, CPU 1214C, CPU 1215C, and CPU 1217C. They offer more advanced functionality than the Basic Controllers, including built-in communication interfaces and additional I/O options. They also come in different versions, including DC/DC/DC, DC/DC/RLY, AC/DC/RLY, and AC/DC/TC. They have limited functionality but are ideal for simple control tasks.
    Simatic S7-1200 Safety Integrated: This is a safety-certified version of the S7-1200 that includes safety-related functions, such as safety inputs, safety outputs, and safety communication, to enhance the safety of the automation system.
    Simatic S7-1200 SIPLUS: This is a ruggedized version of the S7-1200 that is designed to operate in harsh environments with extreme temperatures, humidity, and vibration.
    See picture 2 for different models of S7-1200.

    Picture 2 – Different models of S7-1200 CPU
    S7-1500 PLC
    the Simatic S7-1500 is a powerful PLC that offers a range of models to meet different automation needs, making it a popular choice for demanding applications.
    Here’s an overview of the different models in the S7-1500 series:
    Simatic S7-1500 Standard CPUs: These are the standard CPUs in the S7-1500 series, and they come in different versions, including CPU 1511-1 PN, CPU 1513-1 PN, CPU 1515-2 PN, and CPU 1518-4 PN. They offer high-speed processing and advanced communication options, such as Profinet, Profibus, and Industrial Ethernet.
    Simatic S7-1500 Safety Integrated: This is a safety-certified version of the S7-1500 that includes safety-related functions, such as safety inputs, safety outputs, and safety communication, to enhance the safety of the automation system.
    Simatic S7-1500 Advanced Controllers: These are advanced versions of the S7-1500 that offer additional functionality, such as motion control, high-speed counting, and advanced communication options.
    Simatic S7-1500 T-CPU: This is an advanced version of the S7-1500 CPUs that have extended motion control functions such as Kinematic functions and Gearing and camming functions.
    Simatic S7-1500 TM NPU: This is a neural processing unit (NPU) that is designed for machine learning and artificial intelligence (AI) applications, such as predictive maintenance, quality control, and process optimization.
    See picture 3 for different models of S7-1500.

    Picture 3 – Different models of S7-1500
    S7-300 PLC
    Simatic S7-300 CPUs: These are the standard CPUs in the S7-300 series, and they come in different versions, including CPU 312C, CPU 313C, CPU 314C, CPU 315-2DP, CPU 317-2DP, and CPU 319-3PN/DP. They offer high processing power, advanced communication options, and a wide range of I/O options.
    Simatic S7-300 Fail-Safe CPUs: These are safety-certified versions of the S7-300 CPUs that include safety-related functions, such as safety inputs, safety outputs, and safety communication, to enhance the safety of the automation system.
    Simatic S7-300 Compact CPUs: These are compact versions of the S7-300 CPUs that offer reduced size and power consumption, making them ideal for applications with limited space and power supply.
    Simatic S7-300 Technology CPUs: These are specialized CPUs that are designed for specific automation applications, such as motion control, temperature control, and process control.
    Simatic S7-300 Distributed Controllers: These are modular controllers that offer distributed I/O and communication options, making them ideal for applications that require distributed automation.
    See picture 4 for different models of S7-300.

    Picture 4 – Different models of S7-300
    S7-400 PLC
    Simatic S7-400 CPUs: These are the standard CPUs in the S7-400 series, and they come in different versions, including CPU 412-1, CPU 414-1, CPU 414-2, CPU 416-2, and CPU 417-4. They offer high processing power, advanced communication options, and a wide range of I/O options.
    Simatic S7-400H CPUs: These are high-availability CPUs that offer redundancy options to enhance the availability and reliability of the automation system.
    Simatic S7-400F/FH CPUs: These are safety-certified CPUs that include safety-related functions, such as safety inputs, safety outputs, and safety communication, to enhance the safety of the automation system.
    Simatic S7-400 Distributed Controllers: These are modular controllers that offer distributed I/O and communication options, making them ideal for applications that require distributed automation.
    See picture 5 for different models of S7-400.

    Picture 5 – Different models of S7-400
    Simatic S7-ET 200 PLC
    Simatic S7-ET 200 CPUs: These are the standard CPUs in the S7-ET 200 series, and they come in different versions, including CPU 1511C-1 PN, CPU 1513-1 PN, and CPU 1515-2 PN. They offer high processing power, advanced communication options, and a wide range of I/O options.
    Simatic S7-ET 200F CPUs: These are safety-certified CPUs that include safety-related functions, such as safety inputs, safety outputs, and safety communication, to enhance the safety of the automation system.
    Simatic S7-ET 200SP CPUs: These are compact CPUs that offer reduced size and power consumption, making them ideal for applications with limited space and power supply.
    See picture 6 for different models of S7-ET200.

    Picture 6 – Different models of S7-ET200
    Why are there a lot of different models?
    There are many different models of Siemens S7 PLCs to provide customers with a wide range of options and features to choose from, allowing them to select the PLC that best suits their specific automation needs.
    Different models offer different features, processing power, memory, communication options, and I/O capabilities. Some models are designed for specific applications, such as motion control, temperature control, and process control, others are designed for general-purpose automation systems.
    Also, as technology advances and new automation requirements arise, Siemens continues to develop and release new models and versions of S7 PLCs with enhanced features and capabilities, providing customers with the latest automation technology to help them improve their productivity, reduce their costs, and enhance their system’s performance.
    How to decide which type of S7 PLCs best fits my application?
    Choosing the right type of S7 PLC for your application requires careful consideration of several factors. Here are some general steps to help you decide which type of S7 PLCs best fit your application:
    Determine the size and complexity of your automation system:
    If you have a large and complex automation system, you may need a high-performance PLC, such as the S7-400 or S7-1500 that can handle a large number of I/O points and advanced communication options. If your system is smaller and less complex, a smaller PLC, such as the S7-1200 or S7-300, may be sufficient.
    Identify the required I/O types and count:
    Each S7 PLC has a different range of I/O options and capacity. You need to determine the type and number of I/O points that you need for your application and select the PLC that can support them.
    Consider the required processing speed and performance:
    Different S7 PLCs have different processing speeds and performance capabilities. You need to determine the required processing speed and select the PLC that can meet your performance requirements.
    Evaluate the required communication options:
    Different S7 PLCs offer different communication options, such as Ethernet, Profibus, Profinet, and AS-i. You need to determine the required communication protocols for your application and select the PLC that can support them.
    Consider the required safety features:
    If your application requires safety functions, such as safety inputs, safety outputs, and safety communication, you may need a safety-certified PLC, such as the S7-1500F or S7-400F.
    Conclusion
    Siemens provides a wide range of industrial automation products including various models of PLCs with different functionality and performance capabilities including the S7-1200, S7-1500, S7-300, and S7-400 CPUs. 
    The many different models of Siemens S7 PLCs are there to provide customers with a wide range of options and features to choose from.
    Choosing the PLC model that best fits your Process requires some points to consider before selecting the PLC, some of these points are IOs count, safety requirements, and communication options.

    leikang
    In this article, We will learn how to read the PLC datasheet and important notes about PLC specifications that are useful to automation engineers. Also, we will talk about what different information is provided in a PLC datasheet, and how that can be useful to me as a programmer or as an installation engineer.
    Contents:
    What information does a datasheet provide? Examples of the information in a PLC datasheet Current and voltage rating PLC memory Different blocks and data areas addressing Inputs and Outputs Specifications Communication interfaces and protocols Ambient Conditions Important notes on reading the data sheet. What information does a datasheet provide?
    The datasheet of a PLC will provide you with much information; this information will cover almost every feature that the PLC can provide. But some of this information won’t be as important to you as others, it depends on what is your scope with the PLC.
    If you are the installation engineer, then you will focus on the technical specs of the PLC like the supply voltage, type of inputs and outputs, and power rating of these IO points.
    You will also pay more attention to the dimension of the PLC and the Ambient conditions during PLC operation to determine the size of the electrical panel you will use for the PLC and also the cooling methods used for the PLC.
    How to Read the PLC Datasheet?
    On the other hand, if you are just the PLC programmer, then the past information might not be as critical to you, instead, you will focus on data related to for example the PLC memory, the number of IO available, and the capability of adding new modules.
    You will also pay attention to some other information like the programming languages supported by that PLC because not all PLCs support all programming languages. Communication and networking are also other important points you will care about as a programmer.
    The data sheet of a plc will always start with a general overview description of the PLC. See pictures 1 and 2 for S7-1200 and S7-1500 simple examples.

    Picture 1 – 1st page of an S7-1500 PLC data sheet.

    Picture 2 – 1st page of an S7-1200 PLC data sheet.
    As you can see, a general description of the PLC is given at the beginning of the datasheet. This general description will give you a basic idea about the PLC and if it fits your application or not.
    Examples of the information in a PLC Datasheet
    In this article, we will use the data sheet of an S7-1200 PLC to show some of the different information it contains.
    Current and Voltage Rating
    In a certain section of the data sheet there must be some information about the PLC voltage and current ratings, some PLCs will need a DC supply while others will require an AC supply, also the inputs and outputs of the PLC might have different ratings, which is exactly the case in our PLC, where the voltage supply to the PLC is 220AC but the ratings for IOs are DC. See picture 3.

    Picture 3 – Voltage and current ratings.
    PLC Memory
    Different memory capabilities of the PLC will be provided in the datasheet, this will show how much work memory you have and whether you can expand it or not, see picture 4.

    Picture 4 – Memory description of the PLC.
    Different Blocks and Data Areas Addressing
    In this section, you will know the different blocks that you can use with your PLC, like timers, counters, FCs, etc. And the maximum number of blocks that you can use. You will also be provided with the data areas’ memory and their retentivity. See picture 5.

    Picture 5 – CPU blocks are available.
    Inputs and Outputs Specifications
    This is another critical data that should be provided, through this information you will know the number of IOs provided with your PLC, and how to connect and use each IO. See pictures 6 and 7.

    Picture 6 – Digital inputs of the PLC.
    As you can see, we have 8 DI points in our PLC, 6 of which can be used for HSC (high-speed counting) inputs like encoders. It also tells you that the input voltage is 24vdc which means you can’t directly connect AC sensors of inputs to the PLC.

    Picture 7 – Digital outputs are available in our PLC.
    If the PLC has analog IOs then it will be mentioned also in the data sheet. See picture 8

    Picture 8 – Analog IOs description.
    Communication Interfaces and Protocols
    The communication interfaces available in your PLC, as well as the communication protocols it can support, will also be mentioned in the datasheet. See picture 9.

    Picture 9 – The communication interface of the PLC.
    As you can see, the PLC we have only has one communication interface, which is a PROFINET interface provided as an RJ-45 port. However, the PLC itself can support many communication protocols such as PROFIBUS and AS-Interface. See picture 10.

    Picture 10 – Communication protocols supported.
    Ambient Conditions
    This is another very important data you should know about your PLC, as it will help decide the type of enclosure and cooling that will be best suited to your PLC. See picture 11.

    Picture 11 – Ambient condition of the PLC.
    Important notes on Reading the DataSheet of a PLC
    Not all the PLC data sheets contain the same information, as different PLCs will have different features and capabilities and hence, different information to show.
    Not all the information inside the datasheet will be important to you, that will depend on whether you are a PLC programmer or an installation engineer as we mentioned before.
    It’s OK if you don’t understand some of the information in the datasheet, as we said the data sheet will provide information about almost all the features supported by your PLC, you might not know about some of these features and you might not even ever need to use it. For example, the OPC UA or the web server features. So if you find some data you don’t understand, it won’t necessarily mean your PLC doesn’t fit your project.
    Conclusion
    Reading the PLC datasheet is important to help decide if the PLC is suitable for your application or not. It is also important to decide what types of IOs and voltage supply ratings you can work with.
    Try reading the datasheet of different PLC models and see if you can understand the basic information provided in the datasheet.

    xiangjinjiao
    In this article, we will take about clock memory bits in TIA Portal and Siemens PLC. And we will show how to enable the use of the memory bits and how it can help you avoid coding a lot of logic lines to obtain a simple function that your PLC already do it internally.
    Contents:
    What are clock memory bits? The need for clock memory bits. Enable clock memory in my project. Simple program example. Program simulation. Conclusion. What are Clock Memory Bits?
    A clock memory is a bit memory that changes its binary status periodically in the ratio of 1:1. That simply means it changes its status periodically between true and false with a pre-defined frequency.
    There are 8 clock memory bits pre-defined in the CPU which is why they are also called clock memory byte.
    You decide which memory byte of the CPU will become the clock memory byte when you enable the use of the memory byte and assign the clock memory parameters.
    The Need for Clock Memory Bits
    You don’t necessarily need the clock memory as you can create your own logic and achieve the same functionality. However, it is a good thing to have in your pocket when you need such functionality. As creating 8 separate logic for 8 clock memory bits will take some of your time and effort and might make your program unnecessarily large.
    You can use clock memory, for example, to activate flashing indicator lamps or to initiate periodically recurring operations such as recording actual values.
    Each bit of the clock bit memory byte is assigned a frequency. See the following table.
    Bit of the clock memory byte 7 6 5 4 3 2 1 0 Period (s) 2.0 1.6 1.0 0.8 0.5 0.4 0.2 0.1 Frequency (Hz) 0.5 0.625 1 1.25 2 2.5 5 10 Table 1. Clock memory bits frequencies according to the TIA Portal help manual.
    Enable Clock Memory in Siemens PLC
    To use the clock memory bits in your logic, you need to enable the use of the clock memory byte from the properties of the CPU. See picture 1.

    Picture 1 – Enable the use of clock memory byte
    You can choose the address of the byte you want to assign for the clock memory, just make sure it doesn’t conflict with any other memory bytes in your PLC logic.
    As you see from the picture, we chose the address 0, so if you need to use the 2Hz clock bit you will use the bit %M0.3
    Tia Portal Conveyor Belt Example Program
    In a previous article, we used a simple example of a conveyor belt moving a product between the start and end of the belt. There was an indication LED that turns ON when the Belt is running. See picture 2.

    Picture 2 – Simple conveyor belt system
    We will use the same example, but this time we will make the LED more intuitive using the clock memory bits. This time we will use the clock memory bits with the LED to give an indication of different cases of the process.
    Process Description
    In a conveyor belt system controlled by a PLC, there are two presence sensors at the two ends of the belt to detect the presence of a product, when the product is detected at the start of the belt, the conveyor can be started through a start Pushbutton and when the product reaches the end the belt will stop automatically and it will not run again until a new product is detected once again at the start and the START push button is pressed.
    The indication LED should have more than one behavior depending on the current case of the system.
    These cases are as follows:
    If there is a product at the start of the belt but START is not pressed yet, the LED should be flashing by a frequency of 0.5Hz. If the conveyor is moving the product the LED should be flashing by a 2Hz frequency. When the product reaches the end of the belt the LED should be ON When the product is removed from the end the LED will go OFF. Project IOs
    We have 4 digital inputs as follows:
    START: start push button to run the Conveyor. STOP: stop push button to stop the conveyor at any moment. P1: Presence sensor at the start of the belt. P2: Presence sensor at the end of the belt. We also have 2 digital outputs as follows:
    MOTOR: when activated the Conveyor belt will start running. LED: will be activated according to the sequence mentioned before. Program Code
    First, we select our PLC and assign the IO tags. See picture 3

    Picture 3 – Assign inputs and outputs tags
    Don’t forget to enable the use of the clock memory byte as shown in picture 1.
    We will have two networks of code, one for the control of the conveyor belt and another for the LED logic. See pictures 4 and 5 for the logic.

    Picture 4 – The control logic of the conveyor belt

    Picture 5 – The control logic of the LED
    As you can see, using the clock memory bits made the logic simple and easy to read. Imagine if you would create the same logic without the use of these bits, you would have used a lot of timers and your logic would have been fairly complicated.
    Program Simulation
    We explained before how to use the PLCSim to simulate our code. In this example, we will use the simulation sequence to create the same sequence of the actual process and we will see if the LED behavior will match the intended functionality or not.
    Start by compiling our code and start a new simulation. See picture 6.

    Picture 6 – Program simulation
    As you can see, the LED is now OFF; there are no products presences at the start or the end of the conveyor.
    We created a simulation sequence and see how the LED will react to different process conditions. See the following animation.

    See if you can notice how the LED behavior changes with different process conditions.
    Conclusion
    Clock memory bits turn on and off with a pre-defined frequency.  They are very useful when you need to activate flashing indicator lamps or to initiate periodically recurring operations. Using clock memory bits will save you the time and effort consumed to obtain the same functionality through your own logic.

    caixiaofeng
    In this article, we will show how to take a program backup from the physical PLC to your computer using the Siemens Tia portal software.
    Contents:
    Why would You need to take a backup? How to take a backup from PLC? Notes about Backup from PLC Conclusion Why would You need to take a Backup?
    Imagine if you accidentally deleted your software from the PC while working on it. Or maybe you need to make an update to certain process software that has been running for 10 years and you no longer have the software code.
     Instead of rewriting the whole code from scratch, it will be easier to just upload the current code and make your changes to it.
    In this article, we will show how to easily upload the software contained inside the PLC to your PC.
    How to Take a Backup from PLC?
    TIA Portal with the new Siemens controllers S7-1200 and S7-1500 provides more advantages when taking a backup compared to them when you are working with older controllers like S7-300 or S7-400, with older controllers you would take the backup but it will not show any comments or addressing details, the software will work just fine but it will be difficult to read or understand.
    With the newer PLC controllers, you can now upload both the code and all associated addressing and comments, which will make reading the code very simple and make any updates to it possible.
    Steps to upload the software from the PLC
    Create a new project, but unlike what we do usually we will not add a new device rather we will press the Online and choose “upload device as a new station”. See picture 1.

    Picture 1 – Upload the device as a new station.
    This will take you to upload the device into the PG/PC window. See picture 2.

    Picture 2 – Upload device window.
    You need to choose the type of PG/PC interface as shown in the last picture and then press Start search. 
    When the search is done, you will see all the devices that were found by your software. Note that, it’s not necessary to only find PLCs; you will also be able to find HMIs, IO modules, and every other communication module that the software can detect. See picture 3.

    Picture 3 – Scan complete and devices found.
    After the scan is complete, you can select the PLC that you need to upload and then press Upload.  This will start uploading the software from the PLC to your TIA Portal. See picture 4.

    Picture 4 – Upload from PLC is complete.
    As you can see from the previous picture, the complete project saved on the PLC will be uploaded into your TIA Portal. Even with all the comments and addresses. See picture 5.

    Picture 5 – PLC project is uploaded
    As you can see, the whole PLC project was uploaded from the PLC to your PC. With all the blocks, comments, and project configurations.
    Notes about Backup from PLC
    If your PC and the PLC have different IP addresses, the TIA Portal will ask you to assign a new IP for your PC that matches the addressing of the PLC and it will even do that automatically, if you allow it.
    If the project on the PLC is password protected, you will be asked to write this password before the upload step starts, if you can’t provide the right password, then the upload will not start. Make sure you know that password if any.
    Sometimes,  the TIA Portal will find your PLC, but can’t upload the project, due to different reasons, for example, the project on the PLC is written in a different TIA Portal version than what you are using right now. Either way, the reason for failed upload will be shown to you, and you can upload once these reasons are cleared.
    Conclusion
    You can upload the project on the PLC to your PC using TIA Portal. If the PLC is s7-1200 or s7-1500 the project will be uploaded with all the associated addressing and comments. If there is any reason preventing TIA Portal from uploading the project, this reason will be shown to you by TIA Portal and you can upload once you fix the problem.

    leigehong
    In this PLC program, automatic door operation is designed using PLC programming to open or close the door when detecting the object. Here the object is nothing but a car.
    Automatic Door Operation
    The below simulation shows the automatic door system operation.

    Inputs and Outputs
    Type Device No. Device name Operation Input X0 Lower limit ON when door reaches lower limit. Input X1 Upper limit ON when door reaches upper limit. Input X2 In gate sensor ON when object approaches the door. Input X3 Out sensor ON when object leaves the door. Input YO Door up Moves up when YO is ON. Output Y1 Door down Moves down when Y1 is ON. Output Y6 Light Lit when Y6 is ON. Output Y7 Buzzer Sounds when Y7 is ON (Lamp on screen is lit). Program Description
    As the car approaches the entrance, the door moves up. An In-gate sensor X2 is used to detect the car’s presence at the entrance.
    The moment the car drives through, the door moves down. An Out-gate sensor X3 is used to detect the car’s presence after crossing the door.
    The upward movement of the door halts when the upper limit switch (X1) gets activated.
    Similarly, the door’s downward motion stops when the lower limit switch (X0) gets engaged.
    The door remains up as long as the car is detected within the range of the entrance (In gate sensor X2) and exit (Out sensor X3).
    A buzzer (Y7) buzzes as a signal for the door’s movement.
    While the car is within the detection range, between the In gate sensor (X2) and the Out sensor (X3), a light (Y6) remains illuminated.
    The status of the door’s movement is indicated by the lighting or extinguishing of four indicator lamps on the control panel.
    Manual control of the door is possible. Buttons on the control panel can be pressed to either open (⬆Door up) or close (⬇Door down) the door.
    PLC Programming


    xiangjinjiao
    In this PLC programming, we do sorting and distribution of boxes by height into the designated storage bins using sensors and conveyors.
    This PLC program distributes the specified number of parts according to their size.
    PLC Sorting Boxes by Height
    The below simulation shows the working principle of PLC logic for sorting boxes based on their height. Here we have 3 different size boxes like small, medium, and large sizes.
    There are three storage bins for each box size. There are three pushers and three conveyors. Each box size has one pusher and one conveyor.

    The robot places the boxes randomly on the conveyor. The sensors are used to detect the box’s size. The conveyors are started and stopped when the respective box size reaches there using the sensors.
    The respective pusher is activated and moves the respective box size to the dedicated storage bins.
    PLC I/O List
    The below table lists the inputs and outputs of this system.
    Type Device No. evice Name Operation Input X0 Starting point ON when the robot is at starting point. Input X1 Upper ON when the part is detected. Input X2 Middle ON when the part is detected. Input X3 Lower ON when the part is detected. Input X4 Sensor ON when the part is detected on the incline. Input X5 Sensor ON when the part is detected on the incline. Input X6 Sensor ON when the part is detected on the incline. Input X7 Sensor ON when the part is detected at the right end. Input X10 Detect part ON when the part is detected in front of the pusher. Input X11 Detect part ON when the part is detected in front of the pusher. Input X12 Detect part ON when the part is detected in front of the pusher. Output Y0 Supply command One part is supplied When Y0 is ON. A process cycle begins: Wooden part repeats in order M, S, L, M, M, L, S, S, L, L. Output Y1 Conveyor forward The conveyor moves forward when Y1 is ON. Output Y2 Conveyor forward The conveyor moves forward when Y2 is ON. Output Y3 Conveyor forward The conveyor moves forward when Y3 is ON. Output Y4 Conveyor forward The conveyor moves forward when Y4 is ON. Output Y5 Pusher Extends when Y5 is ON and retracts when Y5 is OFF. The pusher cannot be stopped in the mid-stroke. Output Y6 Pusher Extends when Y6 is ON and retracts when Y6 is OFF. The pusher cannot be stopped in the mid-stroke. Output Y7 Pusher Extends when Y7 is ON and retracts when Y7 is OFF. The pusher cannot be stopped in the mid-stroke. Program Description
    Programming a Programmable Logic Controller (PLC) for Box Sorting Based on Height and Component Distribution.
    Initiating the robot’s operation involves pressing the pushbutton PB1 (X20) located on the control panel, which activates the Robot Supply Command (Y0).
    The Robot Supply Command (Y0) is deactivated upon the robot completing the part movement and returning to its initial position.
    The Conveyor Movement Command is controlled by the Switch SW1 (X24) on the control panel. Activating the switch (turning it ON) propels the conveyor’s movement forward while deactivating it (turning it OFF) brings the conveyor to a halt.
    Sorting of parts, segregated into large, medium, and small sizes, is executed through the input from the Upper (X1), Middle (X2), and Lower (X3) sensors. Post-sorting, the parts are conveyed to their designated trays.
    The presence of a part in the pusher is identified by the activation (turning ON) of the Part Detection Sensors (X10, X11, or X12). Upon part detection, the conveyor is brought to a halt, and the detected part is displaced onto the tray.
    Note: The operation of the pusher is governed by the Pusher Actuation Command. Upon receiving an ON signal, the pusher fully extends, while an OFF signal causes the pusher to retract.
    Each tray is to contain a specific number of parts, depending on their size. Any parts exceeding these specified numbers bypass the pusher and are ejected from the conveyor at the right end.
    The designated number of parts per size is as follows:
    Large: 3 parts Medium: 2 parts Small: 2 parts PLC Ladder Logic


    leigehong
    The PLC program for stage control provides the opening and closing of curtains, as well as the raising and lowering of the stage. It provides two modes of operation: automatic and manual.
    PLC Program for Stage Control
    The below simulation shows the usage of PLC for stage-controlling applications.
    This is a utility project where we have to open and close the stage curtains automatically and also manually using push buttons. The sensors are used to detect the right and left curtains’ positions at different points.

    After opening the curtains, the stage will be moved up and elevated to the top position. Similarly, when the curtains are closed, the center stage will be moved down.
    The stage position will also be tracked using lower and upper limit sensors.
    PLC Devices List
    The below table lists the all inputs and outputs in this PLC program.
    Type Device No. Device name Operation Input X0 Inside (Left curtain) ON when the curtain is halfway. Input X1 ON when the curtain closes completely. ON when the curtain opens completely. Input X2 Outside (Left curtain)  ON when the curtain closes completely. Input X3 Inside (Right curtain) ON when the curtain is on its half-way. Input X4 Middle (Right curtain) ON when the curtain opens completely. Input X5 Outside (Right curtain) ON when the stage reaches a lower limit. Input X6 Stage upper limit The stage moves up when Y2 is ON. The stage stops when Y2 is OFF. Input X7 Stage lower limit ON when the stage reaches the upper limit. Output Y0 Curtain open command Curtains open when Y0 is ON. Curtains stop when Y0 is OFF. Output Y1 Curtain close command Curtains close when Y1 is ON. Curtains stop when Y1 is OFF. Output Y2 Stage up The stage moves up when Y2 is ON. The stage stops when Y2 is OFF. Output Y3 Stage down The stage moves down when Y3 is ON. The stage stops when Y3 is OFF. Output Y5 Buzzer Sounds when Y5 is ON (Lamp on screen is lit). Program Description
    PLC program to Control stage settings including opening/closing curtains and raising/lowering the stage.
    The purpose of this PLC program is to facilitate control over a range of stage settings, encompassing tasks such as opening and closing curtains, as well as raising and lowering the stage itself. To accommodate different preferences and requirements, the program offers two distinct modes of operation: automatic and manual.
    Automatic Operation
    When the “Begin” pushbutton (X16) on the operation panel is pressed, a buzzer (Y5) emits a sound for a duration of 5 seconds.
    Note: The “Begin” pushbutton (X16) can only be activated when the curtains are closed and the stage is positioned at its lower limit.
    After the buzzer stops, the command to open the curtains (Y0) is activated. The curtains will continue opening until they reach their outer limits, as defined by input signals X2 and X5.
    Once the curtains are fully opened, the stage begins to elevate when the “Stage up” command (Y2) is activated. The stage will continue moving upward until it reaches its upper limit, as indicated by input signal X6.
    Pressing the “End” pushbutton (X17) on the operation panel initiates the closing of the curtains. The command to close the curtains (Y1) is activated, and the curtains will close until they reach their inner limits, defined by input signals X0 and X3.
    Manual Operation
    The following operations are only available when the automatic operation described above is not active.

    The curtains can be opened by pressing the “Curtain open” pushbutton (X10) on the operation panel. The curtains will stop once they reach their outer limits (X2 and X5).
    The curtains can be closed by pressing the “Curtain close” pushbutton (X11) on the operation panel. The curtains will continue closing until they reach their inner limits (X0 and X3).
    The stage can be raised by pressing the “⬆Stage up” pushbutton (X12) on the operation panel. The stage will stop once it reaches its upper limit (X6).
    The stage can be lowered by pressing the “⬇Stage down” pushbutton (X13) on the operation panel. The stage will stop once it reaches its lower limit (X7).
    The indicator lamps on the operation panel will illuminate or turn off accordingly, providing visual feedback on the status of the curtains and stage operations.
    PLC Programming


    leizuofa
    Counters are a very important instruction in PLC programming. You require it in almost every logic. Be it counting something to counting events, counters form an important part of PLC programming.
    Because event count is used in many applications and it helps PLC programmers save time in writing cumbersome coding. But, many times, it is always required to find a backup solution for a plan if it does not work.
    In the case of counters too, a PLC programmer must know a backup logic if it does not work properly. For that, two instructions can be combined and written – move and addition.
    In this post, we will learn how to design counters in PLC programming with a move and add instruction.
    Counters
    First of all, we will see a counter instruction on how it is written. Refer to the below image. As you can see, a counter has three inputs – count, reset, and set value; and has two outputs – done and current value.
    A count input is required to provide the counter with a pulse for counting it, a reset input is required to reset the counter, and a set value is required for feeding the counter with set counts. A done output is used to denote that the counter has finished counting and the current value shows the present value of counts that the counter has counted till now.

    When count input is received, the counter increments by a value. The count input works on a pulse basis and not on a continuous basis. When the counter reaches its set count, then the output done bit goes on.
    The only way to then turn it off is by giving the reset input. The count value will become zero on this input and the counter resets due to this. It is to be noted that even if the count has been reached and you still give count input, then too the count will go on incrementing.
    You can also see that a comparison block is used after counter output, which allows it to pass to the final bit to be turned on. This prevents the final bit from turning on unnecessarily if the set count is zero.
    Design Counters in PLC With a Move Instruction
    Now, we will see how to write this same coding with the help of move and add instructions. Refer to the below image. In the first rung, the count input is replaced with an add instruction.
    The addition will happen if the input condition is true, and that too with a pulse. Pulse must be used, otherwise, continuous addition will go on and there will be no control over it.

    In the second rung, it compares whether the set counts have been reached or not. It also checks whether the set count is more than zero or not. If these conditions are true, then the output turns on.
    In the third rung, the counter value becomes zero on the receipt of the corresponding inputs. This equals the operation of reset input.
    These three rungs are enough to replicate the function of a counter. You can use either a counter or this PLC logic, according to your needs. But, it is to be noted that we can program a counter by writing this way too.
    In this way, we saw how to write counters in PLC programming with a move and add instruction.

Apply for friendship links:WhatsApp or E-mail: admin@plchmis.com
×
×
  • Create New...