How to Use a Shift Register for Rejecting Items: Step-by-Step Guide for Beginners

Question:

I am seeking guidance on how to create a program for rejecting items using a shift register or bit manipulation. In this scenario, there are 3 digital inputs (DIs) involved. DI1 detects defects in items, DI2 acts as a sensor for item entry and handles bit shifting, and DI3 also performs bit shifting to connect the cylinder for ejecting rejected items. The process involves scanning defects on a bottle (DI1), shifting bits with each trigger (DI2), and ultimately triggering the cylinder to kick out rejected items. I am using an S7-1200 PLC as a beginner in programming. Any assistance or suggestions would be greatly appreciated. Thank you in advance.

Top Replies

If you're looking for videos discussing this specific topic, you'll find a variety on YouTube. Enjoy exploring!

To ensure efficient bottle movement on the conveyor, it is essential to have a reliable tracking system in place. Utilizing a sprocket with sensors on the conveyor can provide the necessary pulses for effective fault detection and bottle repositioning. For example, by receiving pulses from the conveyor sprocket sensor, the fault detection data is shifted along a bit array, indicating the position of each bottle. When a faulty bottle is identified, a "1" is placed in the shift register array, and as each pulse is generated, this data is shifted accordingly. This method allows for precise control over bottle placement, ensuring that any defective bottles are directed to the reject station. By implementing this tracking system, production efficiency can be significantly improved.

Why do DI2 and DI3 shift the bits in opposite directions? Are these bits in separate arrays, one for DI2 and another for DI3? If they are in different arrays, how are bit values written into the second array (DI3)? Can you provide clarification on a few points? When DI1 is 1, it indicates a defective item at a specific location; otherwise, it is 0. DI2 seems to trigger when all items have moved a fixed distance since the last trigger event. For example, DI2 could be a proximity sensor on a gear sprocket that controls a conveyor transporting items. It does not specifically relate to individual items but instead represents overall movement of items on the conveyor. The value of DI2 changes back to 0 before the next trigger event. DI3 is unclear to me. Are items transferred between conveyors? Is the reject cylinder station a set distance from the DI1 location? How many DI2 trigger events (and possibly DI3) occur from when a defective item triggers DI2 to when it reaches the reject cylinder station? What is the frequency of DI2 trigger events? How many DI2 triggers occur between items on average? How long does it take for the reject cylinder to reach the defective item? How long does it take for the reject cylinder to fully extend and complete one extend+retract cycle?

When using Rockwell software, you can rely on the BSR (Bit Shift Right) and BSL (Bit Shift Left) functions to perform the specific bit shifting operations you require.

Drbitboy asked why DI2 and DI3 shift bits in opposite directions and inquired if they are part of different arrays of bits. DI1 indicates a defective item while DI2 triggers when all items have moved a certain distance. DI2 acts as a proximity sensor on a gear sprocket, detecting movement of items on a conveyor. DI3 remains unclear. In the program using TIA Portal, DI2 and DI3 monitor the input and output of bottles or items. DI1 sets a byte to 1 when a defect is detected, with DI2 shifting the bit as items pass through. A move block transfers values between arrays. DI3 also shifts bits as items pass through, triggering a cylinder with a time delay. Items do not transfer between conveyors, and the reject cylinder is located at a set distance from DI1. The number of trigger events and speed of triggers depend on conveyor speed. The cylinder extends in less than 1 second, retracting quickly for the next rejection. If you have alternative methods for achieving this, I am eager to learn. Thank you for your patience and understanding.

It sounds like a fascinating project! One approach could involve a form of a parallel array set up. Each digital input (DI1, DI2, and DI3) would correspond to an element in a parallel array, meaning you'd have one column for defects, one for item entry, and one for rejection. Add bits to the array every time DI2 and DI3 spots an item and shift bits when DI1 detects a defect, then correspondingly add a '1' to DI3's array to trigger the rejection. For programming, I would suggest using Ladder Logic given your S7-1200 PLC; it's quite newbie-friendly and an industry standard. Consider exploring TIA Portal by Siemens, it's a great tool for configuring and programming S7-1200 PLCs. Remember, practice and patience are the keys to learning programming. Good luck!

Sure, I'd be happy to lend a hand! In the context of your S7-1200 PLC, you should be looking into the Shift Register function, which allows you to track individual items through your process. After DI1 detects a defect (you'll probably set this into a bit), you could use DI2 as a clock pulse to shift this bit along the register. When a defective item reaches DI3, the corresponding bit in the register should be in the position that corresponds to the actuator that triggers the physical ejection mechanism (cylinder in your case). It's important to take into consideration the delay between defect detection and ejection point. Don't get discouraged if it seems complex at first, PLC programming has a bit of a learning curve but is extremely rewarding!

While I don't have the exact code you need, I can give you the general outline of how you might approach this. Consider writing a program that shift-bits on DI2's signal. Each time an item enters, shift each bit in your memory register to the left. This will make space for the next item's defects. Then, if DI1 detects a defect, record a '1' in the least significant bit in your register (this will be on the right). If no defect is detected, just record a '0'. Then, using DI3, look for a '1' that has been shifted to the end of the register. When you find one, trigger the cylinder to eject the item. Since you're a beginner, don't forget to look up the specific syntax and functions needed for your PLC, such as "BIT_SHIFT_Right", "BIT_SHIFT_Left", and "SET_BIT" in your PLC's programming guide. Programming is very specific, so take your time and consider working on small parts of the program and testing those before moving on to the next. Good luck!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: What is the purpose of using a shift register for rejecting items in a program?

Answer: A shift register can be used to store and manipulate data as it moves through a series of stages, making it useful for tasks like tracking defects and triggering actions based on specific conditions.

FAQ: How many digital inputs are involved in the process of rejecting items using a shift register?

Answer: There are 3 digital inputs (DIs) involved in the scenario described: DI1 for detecting defects in items, DI2 for handling bit shifting during item entry, and DI3 for connecting the cylinder to eject rejected items.

FAQ: Can you explain the step-by-step process of rejecting items using a shift register and bit manipulation?

Answer: The process involves scanning for defects on items using DI1, shifting bits with each trigger using DI2, and triggering the cylinder to eject rejected items by performing bit shifting with DI3. This sequence helps in making decisions based on the detected defects and taking appropriate actions.

FAQ: What PLC model is being used in the described scenario for rejecting items?

Answer: The S7-1200 PLC is being used in the scenario described, making it suitable for beginners in programming and automation tasks involving shift registers and bit manipulation.

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’