Jump to content

Recommended Posts

Posted

To accomplish a bit shift in sysmac studio, you need to:

1. Create a 'UNION' data type. I called mine SFT, then added 2 members - 'Ary' is of type ARRAY [0..15] OF BOOL, 'Wrd' is of type WORD.

2. Create a global variable for your shift. For this example, let's call it BitSft, of type SFT.

3. Add a function block to your ladder program - 'AryShiftReg', call the instance whatever you want.

4. Execution condition goes on the >Shift input

5. Reset condition on the -Reset input (usually emergency stop etc)

6. If you put '1' on the 'In' input, the register will hold the previous bits on as it clocks - eg 00000001 > 00000011 > 00000111

   If you put '0' on the 'In' input, the register will shift a 1 through the word - eg 00000001 > 00000010 > 00000100 BUT only if you use the function MOVE 16#1 BitSft.Wrd to get it started **.

7. 'InOut' should have BitSft.Ary[0] in it

8. 'Size' should have '16' in it.

9. Use 'BitSft.Ary[0]' as the first boolean contact in your ladder program to execute conditions for step 0

**: you can use the move function to move a BCD number into the BitSft.Wrd to change its position at any time, but remember it will need to be 1>2>4>8>10>20>40 etc

Posted

This works perfect, However my question is what if you need  the shift register to be 32 bit long. What do you have to modify for that  to function.

 

Thanks!

Dino

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

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