 Hello everyone, welcome to this session on PLC shift registers. At the end of the session, you will be able to examine symbols, basic usage and types of shift registers used in PLC programming. You will be also able to write simple ladder run diagrams with shift registers for basic operations like detecting faulty objects, etcetera. Registers can be used to store and shift data, used when a sequence of operation is required to be controlled. Registers can be used to keep track of particular items in a production system. So, for example, you can keep a track of faulty items in a production system, whenever the faulty item gets detected you can trash them at appropriate time. In PLC registers are nothing but a number of internal relays grouped together normally group of 8, 16 or 32 to store data in terms of relay state. Each internal relay is either effectively open or closed. These states being designated as 0 and 1 and these states are also termed as bits. An example is shown here, a structure of 8 internal relays is shown with their associated states. So, here for example, relay 1 is on, relay 2 is off, relay 3 is on, relay 4 is on, relay 5 is off and so on. Shift registers are normally used to shift data towards left side or right side or you can use shift register for rotating your data in circular fashion. Shift registers required 3 inputs, basically they required minimum 3 inputs. One input to load data into the first location of the shift register, another input as a command to shift data along by one location either left side or right side. Third input is required to reset or clear the register data. Here is one example is shown, consider this 8 bit shift register with shown relay states. So, here you will see relay 1 is on, 2 is off, 3 is on, 4 is on and so on. Now, suppose if an input signal 0 is received and this 0 is an input signal to the first internal relay shown with this red circle. Then what happens? The input signal enters the first location in the register as shown here and all the bits shift along one location and the last bit overflows and is lost. So, this status of this last internal relay is lost here. You can see here and it is considered as a overflow. Let us understand shift register with the help of this ladder diagram. Here you will see a ladder diagram shown with inputs, input switches and output coils. Here input 1 is used to input the first internal relay in the register whereas the input 2 is used to shift the state of internal relay along by one either left side or right side and input 3 here is used to reset the shift register. So, IR1 to IR4 internal relays used to demonstrate the shift operation whereas, OUT1, OUT2, OUT3 and OUT4 these all outputs are controlled by each one of the internal relay. So when there is a input 2 IN contact of internal relay IR1 closes, OUT1 gets energized. Now the status, new status of internal relays becomes 1 triple 0. At T0 a momentary input is applied to shift signal which will cause contact of internal relay IR2 to close which causes output 2 to energize. Now the status of internal relay becomes 1 1 0 0. Relay at T1 again one momentary input is applied to IN2 that is shift which will cause contact of internal relay IR3 to close which in turns energizes the output 3 and the new status now becomes triple 1 0. Here you should note that IN input is true throughout this duration. At T2 again one more momentary input is applied to shift input which will cause contact of internal relay IR4 to close which in turn energizes output 4 and the status of the internal relay becomes 1 1 1 1. So here you can see that this input IN is shifting towards output 4 after each shift input pulse. Now grouping together of internal relays to form a shift register is done automatically by a PLC when the shift register function is selected. Shift registers are predefined as a standard bit shift functions or instructions in IEC 61131 part 3 standard. So this is the summary available in IEC 61131 part 3 standard. Here you will have 4 shift operations shift left shift right rotate right rotate left. So here you will see 2 inputs are there the stream which you want to shift and the integer value how many bit shift you want at the output you will get the shifted version of this input. Here is the structural text statement looks like for a left shift operation A is assigned SHL in bracket IN assigned B N is 5. So 5 bit shift will be achieved with this particular statement. So left shift output is the left shifted version of input by N bits 0 will be filled on the right side. Right shift output will be the right shifted version of input by N bits and 0 will be filled on the left side ROR rotate right here output will be right rotated version of your input by N bits and it is in circular fashion. Similarly rotate left output will be left rotated version of input by N bits and again this is a in circular fashion. Remember that the value of N should not be less than 0 otherwise error will be occurred. Let us see one example how you can use shift register for detecting defective products. Detecting the defective products in this case taller than the normal dimension on the conveyor belt by a photoelectric sensor and pushing them into the recycle box at the fifth location. So here you will see a conveyor belt is shown on the start you will see photoelectric sensor used for detecting the defective product. After fifth position you will see a valve is shown here for pushing the defective product into the recycle bin. In the recycle bin also you will see one more photo sensor is used for detecting the falling of defective product in the box. And here we have a reset master reset which is used to reset whole the system at once. Let us understand the solution for this particular problem. So here X0 is a photoelectric sensor used for detecting the defective products. X4 is another photoelectric sensor used for monitoring the cam. As the cam rotates each product moves from one place to another place. X5 is one more photoelectric sensor for detecting the falling of defective product in the recycle box. X6 is the master reset whereas Y0 represents the electromagnetic valve for pushing purpose. Now for this problem we are going to use shift left instruction which is available in PLC. So here when shift gets input pulse n bit data string starting with the source device S1 is shifted towards left by the quantity of n bits. So here nb represents the number of bits available in the shift. So for a 16 bit shift operation nb should be 16, 8 bit shift operation nb should be 8 and so on. Bits value represent how many bit shift you require 1 bit shift, 2 bit shift, 3 bit shift and so on. Let us use this shift left instruction for detecting the defective product. So let us understand this solution. So when every time the cam rotates the product will be moved from one position to another position. So because of this X4 will be activated to execute shift left instruction every time. So the contents of m0 through m4 because k value defined here is 5 will be shift to the left for 1 bit because k defined here is 1 for bits value. And the state of X0 will be sent to m0. When X0 is 1 or true means defective product is detected the value 1 will be sent to m0 and after 4 times of the shift electromagnetic wall Y0 will be activated to push the defective product into the recycle box. When the falling of the defective product is detected by X5 sensor, X5 sensor will be activated to execute reset Y0 function and reset m4 function means m4 will be reset and electromagnetic wall Y0 will be off till the next defective product is detected. When the master reset X6 is pressed it will activate reset m0 through m4. So as to ensure that the system restart the detecting process fresh. These are textbooks which you can go for the further reading thank you.