Jump to content

Shifting Large Bit Arrays


Recommended Posts

  • MVP 2023

I went to help a customer the other day and he wanted to track part presence around a 50 position indexer.  No problem (I thought), we'll just use the SHL instruction.

 

Nay, Nay!

 

I discovered SHL and SHR only work with one MI, not a block.  I needed to shift the bits through 4+ words.  Moving on to the "Shift Left" instruction (VEC. SHIFT) I determined that it moves whole bytes at a time.  I was out of ideas for an easy solution, and envisioned a convoluted multiple network mess that AB can do with one instruction.

 

We are blessed with a good team at Support HQ here in the US.  I called them and they got back within an hour with a solution.  Turns out the Vector Copy commands will take MB as an argument even though they default to MI and all the Help shows examples with MIs.  So it can be done with one block.  

 

I never thought to slide up and look for MB on the source of the block.  Turns out you can teach an old dog new tricks.  Thanks, Unitronics Support!

 

I've attached a sample program if anybody wants to see the magic in action.

 

Joe T. 

Bit Shift Register.vlp

  • Upvote 1
Link to comment
Share on other sites

  • 3 months later...

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.