Jump to content

Recommended Posts

I wrote a program using a shaft encoder (x2) high speed input. I have logic in my programming converting input pulses from the encoder to display length of material. On the display the length will only go up to 94", when it reach 94" it starts counting down to 0. Why won't it go past 94"?

Share this post


Link to post
Share on other sites

MI2 & MI3 should be able to range from 1 to 240, with MI2 being less than MI3.

The question was, what do YOU have them set to?

Anyhow ........

MI0 is your encoder count. All MI have a range of -32768 to +32767.

That means the largest value you can measure in MI0 is 32767.

In your code you multiply that by 0.00293

So, 0.00293 * 32767 = 96.00731

Once it passes 32767 it will jump to -32768, so you immediately jump to negative numbers. So it is NOT counting back down. It is infact counting back up from -96.

You need to set the encoder rollover point and then either have it automatically reset, or use the marker pulse on the encoder to reset it.

You then need to keep track of the rollover times separately.

For example, if you have a 1000 line encoder you will get 4000 counts/rev. Set it to roll over at 4000. Everytime it goes from 4000 to 0, increment an MI or ML integer. Your total distance will now be that integer + the fraction that remains on the encoder.

Also, a word of caution. You have your screen set up for 9 decimal places. The floating point arithmetic in the PLC is not anywhere near that precise.

Share this post


Link to post
Share on other sites

And this is a question for Unitronics. Why can we not assign an ML to the encoder count?? Heck, I've used encoders before that have more than 90000 counts in one rev. An MI doesn't get it done.

Share this post


Link to post
Share on other sites

Damian - good description of the mystery maximum value.  We still need to know a few things to be really helpful:

1.  What is the encoder counts/rev?
2.  What is a typical pre-scale value?
3.  What is the implied precision of MI 2 and MI 3; you mention 1 to 240, but are these indeed supposed to represent integer values?


If you don't use a reload type high speed input then you can use an ML as the accumulator.  This application looks like a feed-to-length program and you probably won't lose a lot of precision if you reset the counter in ladder logic.  You're not using the reload event MB 18 anywhere, and you enable the reload MB 19 with a real input.  This tells me that you don't need the micro-second timing the reload function provides, and it's really not the right way to use this function.  The "Enable" input on a reload high speed input does just that - if the counter is > the preset then it resets.  I think you're treating it as a straight reset input, which it isn't.

I'm going to go on the assumption that 1 to 240 represents inches with no decimal place.  I'm also assuming that MI 2 is a slowdown preset and MI 3 is a cut preset.  This is a typical method of feeding.

Since the reload type high speed input really isn't needed, I've moved the input to a regular high speed input and used an ML.  I've modified the shear logic to reset it when I7 comes on.

Also - high speed inputs do not remember their value when power is cycled- they always go back to zero.  I've got a standard bit of logic I put in to handle that.

Joe T.

J3920 Trim Line HMI Touchscreen - no home position JT.vlp

Share this post


Link to post
Share on other sites

And this is a question for Unitronics. Why can we not assign an ML to the encoder count?? Heck, I've used encoders before that have more than 90000 counts in one rev. An MI doesn't get it done.

Looking into it...will let you know why, why not, and if it can be offered as an option.

Share this post


Link to post
Share on other sites

Hi Damian and other participants to this discussion,

First - I want ot thank Damian and Joe for their very useful notes and advices.

About "MI" limitation in function HSC (Reload) - in some Vision models this is hardware limitation, which cannot be ommited.

In some newer models, like V130/350 "TR" ones - you alrady can select both for the counter and the target MI, ML or DW.

Share this post


Link to post
Share on other sites

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