Posted 24 Jun 2014 I'm trying to understand the use of the UL bit in a BSL we're using. I've read the PLC5 help file and I've looked at the useful info on here to no avail. When we get a weight greater than zero and it is within a band it triggers the bad bag if the counter hasn't reached its preset. Also, when we get the weighter greater than zero it triggers the BSL. At the same time we count down when the UL bit goes true (XIC). When does the UL bit go true as this is the piece of info that seems to be missing from the help files, etc? Thanks in advance. Packer BSL.pdf Share this post Link to post Share on other sites
Posted 24 Jun 2014 The UL bit is true when any bit written into the bit array reaches the last position of that array. Steve Share this post Link to post Share on other sites
Posted 24 Jun 2014 See Picture and PDF BSL_ULBit.pdf Share this post Link to post Share on other sites
Posted 24 Jun 2014 (edited) That's almost correct, but not quite. When your array is full (i.e. you've shifted a value right up to the highest bit of your array), the UL bit will not be on. However, the next time you execute the instruction, the UL bit will turn on if the bit that was in the highest position of your array was a 1. Basically, the UL bit tells you the status of the bit that just fell off the end of the array when you shifted it. I use this for counting up/down - e.g., I was asked to monitor the number of rejects from a line, and if more than 10 of the last 100 have been rejected, stop the line. So I monitor each time a product goes past the reject point, and if it is rejected, I increment 1 in a counter. My counter counts how many rejects were made out of the last 100 products, but then I need some way of counting down when the rejected product was more than 100 products ago. That's where my array comes in. So in addition to my counter, I create an array of 100 BOOLs, and every time an item indexes past, I bit shift left. If the product is not rejected, I shift a 0 into the array. If it is rejected, I shift a 1. So then my array looks something like this (shortened to 16 bits): 0000 1000 1001 0011. So I can look at this and know out of the last 100 products (or 16 in this case), which ones were rejected. Each "1" represents a rejected product. When a 1 gets to the end of the array, and falls out, I no longer need to count it as it's no longer in the past 100 products. So every time product goes past the reject point, my PLC basically follows this logic: Was the product rejected? If not, shift a zero. If it WAS rejected, increment my reject count, and shift a 1 into my array. Having shifted my array left, was also check the UL bit from my BSL instruction. If it is a one, subtract one from my reject count. From your post, I would imagine that your system is doing a similar thing. Counting bad bags, and tracking how many have occurred in the last however many bags. Hope that helps! Edited 24 Jun 2014 by ASForrest Share this post Link to post Share on other sites
Posted 25 Jun 2014 Thanks for the info, very informative. We're looking for the 3rd 'bad bag' in 40 which is then rejected. The BSL the forms a rolling 40 instead of every fixed 40 bags. Cheers, much appreciated. Share this post Link to post Share on other sites
Posted 26 Jun 2014 Yep, sounds like exactly the same application :) glad I could help! Share this post Link to post Share on other sites