Skip to main content

LIFO Instruction in PLC

 LIFO is a special programming instruction that can be used in the applications that require to store the sequence of data in order and unload it.

Now we are gonna see how are loading and unloading done in LIFO.

LIFO Instruction in PLC

Yes! LIFO should be used in a pair. There should be an instruction to load and there should be an instruction to unload.

The following are the block parameters in LIFO load instruction,
Source: Here is where one should give an address where the values to be loaded are present.

LIFO: Here is where one should specify the address where the values have to be loaded. This address seems weird right with an ‘#’ in the front. When we use an ‘#’ symbol in the front, It is called an array of addresses. Obviously there will be a sequence of values present to be loaded arrays are capable of storing many values right? So why we gave ‘#’ in the front should make sense now.

Control: Here is where one should specify the control address. In the Rockwell PLC programming environment, there is a separate address for the control with R6:0 as starting one. So when the LIFO load is done loading the values the R6:0 address gives us a true bit.

Length: Here is where we have to specify the length of the array so that the array of address prepares them for loading the values.

Position: Here is where we have to give the index number of an array from where the loading has to start. I’ll leave it to 0 so the loading starts from the 0th index.

The following are the block parameters in LIFO unload instruction,
LIFO: Here is where one has to give the address where the values to be unloaded are present. So obviously both the load and unload has the same address in here.

Dest: Here is where one has to give the address where the values have to be unloaded.

Control, Length, and Position carry the same explanation from the LIFO load.

Now we’re going to the run time to see how the loading and unloading happens,

Now we are on the run time and when the input to LFL is made to turn on the value on N7:0 gets loaded to the array address #B3:0. B3:0 is a binary address to view the value as decimal change the radix to decimal.

Refer to the below figure for the first loaded value.

You can also see the number of lengths we specified is 4 and the Binary data file shows us from 0 to 3.

Here is the next loaded value.
Since we didn’t change the number in the source the same number will get loaded to the destination address.

You can see that the position is increasing in the LFL and LFU as the value is getting loaded. So the value is getting loaded from left to right the starting position is 0 and the ending is 3.

Also, notice that the value gets loaded for each false to the true transition of the rung. Refer to the below figure.

So now we have completed loading the values now the Position is at 10 and the done bit goes to the true state.
You can also notice from the figure that the Done bit is turned on after completely loading the values.

Now we are going to look at the unloading of the data,


Now I made the LFU rung true you can notice that the done bit goes OFF again.

Also, notice that the value which got loaded last comes out first. So the expansion of LIFO is called Last in First Out. The one which came last unloads first.

Likewise, whenever the rung makes false to true transition each value unloads in a manner that which came last goes out. So the last value which comes out should be 30.


You can also notice from the figure that the empty bit goes up when the values on the LIFO address become empty.

An example of a real-time application where LIFO is used might be tracking parts through an assembly line where parts are represented by values that have a part number and assembly code.

Comments

Popular posts from this blog

PLC Program for Mixing Tank

 Create a ladder diagram for controlling a batch mixing process. Implement a PLC program for mixing tank or Mixing Process using PLC Ladder Logic. PLC Program for Mixing Tank Fig : Mixing tank A tank is used to mix two liquids. The required control circuit operates as follows: A. When the START button is pressed, solenoids A and B energize. This permits the two liquids to begin filling the tank. B. When the tank is filled, the float switch trips. This de-energizes solenoids A and B and starts the motor used to mix the liquids together. C. The motor is permitted to run for 1 minute. After 1 minute has elapsed, the motor turns off and solenoid C energizes to drain the tank. D. When the tank is empty, the float switch de- energizes solenoid C. E. A STOP button can be used to stop the process at any point. F. If the motor becomes overloaded, the action of the entire circuit will stop. G. Once the circuit has been energized, it will continue to operate until it is manually stopped. Solution...

What is Relay? How it Works? Types, Applications, Testing

 We use relays for a wide range of applications such as home automation, cars and bikes (automobiles), industrial applications, DIY Projects, test and measurement equipment, and many more. But what is Relay? How a Relay Works? What are the Applications of Relays? Let us explore more about relays in this guide. What is a Relay? A Relay is a simple electromechanical switch. While we use normal switches to close or open a circuit manually, a Relay is also a switch that connects or disconnects two circuits. But instead of a manual operation, a relay uses an electrical signal to control an electromagnet, which in turn connects or disconnects another circuit. Relays can be of different types like electromechanical, solid state. Electromechanical relays are frequently used. Let us see the internal parts of this relay before knowing about it working. Although many different types of relay were present, their working is same. Every electromechanical relay consists of an consists of an Elect...

Chlorine dioxide Analyzer Principle

 Chlorine dioxide measurement Chlorine dioxide (ClO2) is an instable, non-storable, toxic gas with a characteristic scent. The molecule consists of one chlorine atom and two oxygen atoms – represented in the chemical formula ClO2. It is very reactive. To avoid the risk of spontaneous explosions of gaseous chlorine dioxide or concentrated solutions, it is generally handled in dilution with low concentrations. ClO2 is soluble in water, but tends to evaporate quickly. Typically it is prepared on site, for example from hydrochloric acid and sodium chlorite. The procedure provides solutions with approx. 2 g/l ClO2 that can be safely handled and stored for several days. Image Credits : krohne Sensor Parts : Reference electrode Applied chlorine dioxide specific potential Current needed to maintain the constant potential Counter electrode Measuring electrode The disinfection effect of ClO2 is due to the transfer of oxygen instead of chlorine, so that no chlorinated byproducts are formed. C...