vasekd

transfer from cx-programmer to sysmac studio

6 posts in this topic

I am new in sysmac studio programming. I used WSFT function (word shift) in cx-programmer. What function I will use in Sysmac studio? Thanks.

Share this post


Link to post
Share on other sites

I would use an array and use the Stack commands.  What is your end goal?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Thank you,

I will try it as soon as possible. This is exactly the type of instructions for me :-)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Change the union to a DWORD and make the bit array 32 bits long.

Change the size on the AryShiftReg input to 32.

Share this post


Link to post
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