Sign in to follow this  
Followers 0
smichalo

Programming a bit shift

6 posts in this topic

Hello, I've just downloaded a copy of Sysmac Studio 1.04 and I'm just trying to get myself used to the new Omron software. I have experience programming with CX-Programmer and programmed many bit shifts using this software. For some reason I'm having a brain fart trying to program in the new software. I think it's more related to my unfamiliarity of the software but I have to admit I'm losing my patience. The function I'm using is "AryShftRegister" And this is how I got it configured Shift - Bool - I'm simulating the shift using a flash bit ( This is O.K. ) Reset - Bool - The tag is called Reset ( This is O.K ) In - Bool - The tag is called Reject ( this is O.K. ) Size - I put in UINT#1 I beleive this is to shift one bit at a time ( No error comes up here ) InOut - DWORD - I tried a tag called "dword_test" ( I get an error " DWORD type cannot be converted to 'ANY_BIT[]' Type" ) I tried another tag called "dword_test[0]" ( I get a different error called "The array dimension is not correctly specified" ) I tried many different data types. I also tried creating a global tag none of this worked. I'm a liitle confused with Omron data types. I thought they would be the same as rockwell as they follow the same engineering standard. Again I'll chalk this up to my unfamiliarity of the software but that is why I downloaded it. So I could learn it from the comfort of my couch rather than on the factory floor. Thanks for your help Steve

Share this post


Link to post
Share on other sites
I use SHL this take up to LWORD 64 bits then i create i datatype tex uShiftregister as UNION add i member tex text as LWORD, add member tex bit as ARRAY[0..63] OF BOOL then create a global variable text as uShiftregister, in program SHL take in parameter text.text and num parameter ULINT#1 fore shift 1 bit and lock at bit text.bit[0] up to text.bit[63] you can se the result sorry fore the bad English Roger

Share this post


Link to post
Share on other sites
Hi Roger and thanks for the reply. Your solution put me in the right direction. I kept the "AryShftRegister" function but I made these changes For the size I changed that to UINT 16. - This represented the size of shift register ( 16 bit ) I then created a data type called "Shift_Register" Basetype is UNION I created a new member under "Shift_Register" Called "Bit_Shift_Array" with a base type of Array[0..16] of Bool Then under global variables I created a tag called "My_Shift_Register" the data type is "Shift_Register" Which I created earlier. At the "InOut" of the function I put "My_Shift_Register.Bit_Shift_Array[1]. Now when my reject bit goes true Bit_Shift_Array[1] goes true and shifts one bit everytime the shift input on the command goes true. I added this rung of logic: My_Shift_Register.Bit_Shift_Array[6] Shift_Output |--------------------------------| |-----------------------------------------------------------------------------(O)---------| When it shifted to bit 6 in the array the " Shift_Output " would come on. This ended this little exercise and now I'm on to the next challenge. Wow! even with my relatively good english I still managed to confuse myself... No need to apologize for the bad english I got what you were trying to say... I hope this helps someone one day. Thanks Roger Steve

Share this post


Link to post
Share on other sites

Attached is example of two shift registers in NJ. Both shift registers use a common STRUCTURE that contains a BOOLEAN array of 0-999. The rising edge of the NJ 1 second clock pulse shifts both shift registers. Shifts a single bit Shift0_IN or Shift1_IN if true. Note:- CPU is NJ501-1500 V1.09 using Module Version 1.1.0.80 and Sysmac Studio Version 1.10 Shift_Register_Example.rar

Share this post


Link to post
Share on other sites
On 9/8/2014 at 2:53 AM, BITS N BYTES said:

Attached is example of two shift registers in NJ. Both shift registers use a common STRUCTURE that contains a BOOLEAN array of 0-999. The rising edge of the NJ 1 second clock pulse shifts both shift registers. Shifts a single bit Shift0_IN or Shift1_IN if true. Note:- CPU is NJ501-1500 V1.09 using Module Version 1.1.0.80 and Sysmac Studio Version 1.10 Shift_Register_Example.rar

Hello

in your post i did not find any attachment!

Share this post


Link to post
Share on other sites

@mehdi4467 The link was broken due to a site upgrade a while back.  I have fixed it.  

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
Sign in to follow this  
Followers 0