Jump to content

Bit shift


Recommended Posts

  • MVP 2014

It's a bit messy but it can be done.  It's much, much easier in the Vision family.

 

Firstly, if your bits are in Boolean registers (MB, I, O, etc) you need to convert them to MI values.  Use SI170, 171, 172; SB170, 171 (search "bit convert" in the help).  3 MI values will be required.

 

Since the U90 Ladder only works with 16-bit values, you need to shift one word at a time and repeat it 3 times for your 40-bit value.  You also need to manually carry the overflow bit from one operation to the next.  That is, if you shift the first word left, you need to capture what the left-hand bit was before the shift.  Then shift the second word to the left, and bring the captured value of the left hand bit from the first word and place it in the right hand bit of the second word.

 

I can see two ways to do this:

 

1. use Si87, SI88 and SB87, SB88 (see help file). These do the shifting.  Then use "AND" functions with masks to test and set/reset bits

2. Use multiply/divide by 2 to shift left/right.  I suspect you can only use 15 bits of each word to avoid problems with the sign bit.  Use the remainder value (SI4) to carry the overflow bit to the next word, and add it on.

 

Once the shift is done perform the opposite conversion of MI back to MB to get your individual bits.

 

I hope this helps.

Link to comment
Share on other sites

The bit shift is going to be used to track cans that are conveyed at a speed of 150 cans a minute. At that rate using the suggested method may not be accurate. Does the Jazz support vector copy instruction? If not, which OPLC would be suitable for this application? I plan to populate the bit shift register with cans that fail an inspection and point to the bit with a sensor at the reject chute to verify the can was discarded.

Link to comment
Share on other sites

  • MVP 2023

Another application hits the Jazz Wall.  Get yourself a V130-33-TR20 and learn the joys of the enhanced Vision controllers.  The Jazz would probably be fast enough but when the majority of your program uses special functions and system bits then it gets too complicated (IMHO).  Simon is correct; the Vision has standard functions to make this easy.

 

Joe T.

Link to comment
Share on other sites

  • MVP 2014

I did something similar and at the time elected to use the M91 to trade off cost with Scan time.  In more recent times, the cost difference between M91 and V130 is not as much as it used to be. 

 

The new Jazz-2 seems to scan about as fast as the V130.  However the programming is much simpler in the V130.

Link to comment
Share on other sites

I have used Jazz to perform Non Fill Detection upto a speed of 180 vials per minute. i.e. 333mSec per vial.

This was done when there was an appreciable price difference between Jazz & V130. I agree with Simon that programming on the V130 would be a lot simpler.

 

Link to comment
Share on other sites

I have successfully created a shift register using the suggested  Si87, SI88 and SB87, SB88 method after the MB to MI conversion. For now I am only using 16 bits for the shift. My next question is . How can I synchronize my Bit Sift (MB's) with ( MI's)? I have a revolving 36 station tester and I would like to record how many times each station has a reject. I will assign each station to a MI. This will allow me to flag stations that have excessive rejects. At this point I have assigned an MI for the current station. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.