Jump to content

Shift rigth


Mac9010

Recommended Posts

Hi everyone

I am looking for some information about "shift rigth" in the unilogic software, but I couldn't found anything.

I am trying to do a program with the function "shift right "  I made it in a PLC JAZZ but now we need to use a PLC unilogic USP- B10

 

The aplication is the next 

I have a machine that has a camera, and it takes a photo about a "code" if the code is correct the camera send a signal "ok" or 1. to my PLC.

and now when the camera send a signal bad or "0" , and now i would like to make the next. 

 

                                                                              final discard 

camera  bit  1    1    1    1   1    1    1      0     1

camera bit  1     1     1   1    1   1   1      1      0    

when the signal goes to cero in a specific point of the machine  , i want to activate a signal to discard the product that didn't have the correct code. 

 

Someone could help me with this?? 

or could explain to me,  how to can I use the shift rigth, or helpme with some information.

 

Thanks in advance.

pro-omeOr8Kh.jpeg

pro-gt3dC1Sf.jpeg

Link to comment
Share on other sites

  • MVP 2023

Unfortunately, even after all the years UniLogic has been around some of the function blocks haven't made it into the Help.

However, if you hover over the letter of any block a tip will appear:

image.png.914bed3bdd8b66edb03e930baaae3e10.png

You can't see it, but my mouse pointer is over "A" - the source tag or array.

"B" is the number of bits in the tag or array to shift.

"C" is the value of the bit shifted out.

@Cara Bereck Levy - could we get the Shift Rotate functions added to the Help?

 

Joe T.

  • Thanks 1
Link to comment
Share on other sites

HI Joe. 

Thanks for your help! 

I have a question, What is the largest number that can be used in the letter "B"? 

And I understand that the shift source could be a Input of the PLC, but the shift out bit, what kind of value could be ? 

Thanks in advance 
 
Link to comment
Share on other sites

  • MVP 2023

The shift source needs to be numerical tag with more than one bit, like a UINT16.   It could be an array of UINTs. 

When you speak of an Input, do you mean a discrete input?  If so, then that won't work.  You'll need to write some code to set a bit in the source tag with the Set Bit function under the Logic menu.  If you're shifting right, I'd recommend setting bit 15.

I don't know what the largest "B" value is.  I tested it by making an array of 50 INT16s and entered 512 and it took it.

The shift out is a bit.  0 or 1.

At this point I'd recommend writing some test code and playing with it online so you can see it work.  You're not going to break the PLC.

Joe T.

 

  • Thanks 1
Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.