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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...