Jump to content

Recommended Posts

Posted

Hi guys,

i have increamental encoder that connected to Vision130 .

i have configured the input to "high speed input(reload)" and set the reload value to 1000 .  it is work fine clockwise.

but i need to reload also when it get to -1000 (counterclockwise)

how can i do it?

 

Thanks for the help!

 

Meir 

Posted

I'm trying to calculate lenght of a bar on conveyor.  i can do it with the ladder for the counterclockwise direction with interrupt but i wonder if to do it  with the means of hardwre would be more accurate.

ENC1.vlp

  • MVP 2023
Posted

Looked at your code.  You're using Immediate inputs but not the high-speed Interrupt routine - go look at the Help on how to do that.  It will be faster.

The Counter Target Value can be an MI or an ML.  I would write some code to load it with the value you want as opposed to hard coding it.

The bits triggered by the HSC hardware will be a bit faster, but you still have to write code to interpret them.  Once again, look at the high-speed interrupt routine.

Joe T.

Posted

Thanks Joe.

so as i understand it is not possible to define 2 reload  values on the hardware configuration. 

i must write the second reload value (negetive) in software.

if i understand that the positive- clockwise the  accuracy wil be better because it hard coded. even if i use  high-speed interrupt routine?

 

  • MVP 2023
Posted

Meir-

You need to put an MI in the hardware configuration and set all the reload values that way.

The accuracy is not a function of the direction.  Are you turning a real output on or off when the reload event is triggered?  If so, you will still run into a scan time issue.

Speaking of accuracy, there is a lot more to consider-

1.  How are you sensing the bar length - with a wheel?  What is it's size?  Can it possibly slip?

2. What is the specification on the encoder?  Is it quadrature or single channel?

3. Are you trying to cut the bar?  What is the response time of the shear?  How much does the material move when you try to cut it?

 

So often people post here and pick on the "accuracy" of the PLC when actually their machine is not capable of doing what they want.  All the PLC can do is read pulses and react in about 2 milliseconds under the best of circumstances.  It's up to you to provide the rest of the physical ability to get the "accuracy" you are looking for.

Joe T.

Posted

Hi Joe ,

Do you have a ladder example how can i use the _interrupt HSC subroutine with 2 different reload value ?

when the counter reach the reload values it sould go to zero.

Thanks

Meir 

  • MVP 2023
Posted

Reload only happens when the Reload Event is triggered - MB 1 in your case.  You don't have it anywhere in your logic.  Nor is the Reload Enabled (MB 2). 

I've attached something that may work, but not tested.  Let me know if it does.  Look over the Help on "Reload" again, too.

Joe T.
 

 

ENC1 JT.vlp

Posted

Hi Joe ,

Thanks but it dosen't work...

i have tried to read in the help . but it is not very clear.

what i see that when i set reload enable bit to HIGH . the HSC go to 0 . no matter what the conter value is.. 

also the "reload event" dosen't change during reload.

i think there is a "bug " here.

  • MVP 2023
Posted

OK, I had it backwards.  I got a PLC out and loaded it up to check the operation for myself.

The Reload value is a target, not a preset.  The counter counts up from 0, not down from the reload value.

When Reload is reached, the counter reset immediately to 0 and counts up (or down) to the reload value.  The Reload Event bit (MB 1) comes on for one scan when this happens.

image.png

I personally never use Reload, as I prefer to have exact control over what happens.  I use compare blocks in an interrupt routine.

What is it exactly that you are trying to do?

Joe T.

 

ENC1_JT1.vlp

  • 5 weeks later...
Posted

Hi.

This is a bit similar to my project.
My question is:
Can you assign multiple MI to one encoder input (0,1), or do I have to  connect one encoder to multiple inputs parallel? ( might cause glitches in counting because B is connected to interrupts?)
Or do I have to try it manually whit positive edges of HS Inputs 0 and 1 connected INC increment function?

I'm asking because I have 1 encoder, and I have to use its measurement for distance, but I have to use it on 3 different tools,  so 3 different MI that need to count the distance separately, and be reset separately (but still take input from one encoder)

Did this make any sense to you? Sorry my command of English is not the best.

Marko


    
 

  • MVP 2023
Posted

You can only assign one MI to the encoder in the hardware configuration. 

Depending on the precision of the encoder and the precision needed of your feed operations, you may be able to have the encoder count to a small value (like 10) and generate a pulse in an interrupt subroutine that would increment other MIs that you could independently manipulate.  Is this possible?

Joe T.

Posted

Basicly something like this? One encoder to multiple MI that I can manipulate independent of one another.
Would this work in a same or similar way to normal configuration of encoder? 
 

1 encoder to multiple MI.png

  • MVP 2023
Posted

No,  that won't be fast enough as the inputs are limited by the scan time if you use them this way.

Post your code the the model of the PLC you're using and give us the details of the installation-

Encoder make and full model number, especially pulses / revolution

Max RPM of the input shaft of the encoder

Scaling of the encoder pulses to length

Desired precision of the lengths you are feeding

Joe T.

 

Posted

Ok, I will try to explain the best I can.

PLC V430-J-R34, Encoder and picture of the machine is in the files.

Basicly machine is making metal blinds. Rollers pull and form metal sheet, up to the tools. Metal blind has multiple holes punched by tools. Tool number 2 always punches first and the last hole, while toll number 1 punches a set of holes in between. Toll number 3 cuts it to desire length. Motor stops every time toll has to activate.
Exact  positions when tools should activate is calculated and stored in different MI's (table is also in files, but in croatian, Its translated partaly)
Setup has only one encoder. And no other sensors I can use as a position for metal sheet. 

So my idea was to use 3 different independent MI for 3 different tools. 

Now here is the funny part. I don't know max rpm (they told me its slow -_-), or scaling. I haven't even seen the machine, or PLC. I still don't know distance between tools.
I will have to go there and calculate all that, il be there in 2 days.
Precision has to be exact in mm so I can loop the program preset number of times to make same metal blinds.
As for my code, for one its incomplete, 2 all of explanations and notes on it are in croatian, and I would have to convert all that into english and mail it to you cozz its more than I can post on forum atm.

And as a side note, im doing this for free so I could get more jobs and  learn faster. But that does not mean that I don't wanna do it right.
Thank you, again, Joe. And sorry for my english and lack of info.

Best Regards
Marko

encoder.png

machine.jpg

Holes.xlsx

  • MVP 2023
Posted

Marko,

Thanks for the picture and the explanation.

If I understand you correctly, the machine is only working on one piece of metal at a time.  I recommend you re-consider your approach - could you do calculations on your hole location dimensions to reference them all from a common point and go back to only considering a single encoder number?  The distance between the tools looks fixed, so you should be able to do this.  

I would write a state machine sequence that had a separate step for each hole.  I'm guessing you store all the hole locations in a data table based on the part number.

Then you run it out to the cut and reset your encoder at that operation.

Joe T. 

Posted

Thank you for your reply Joe.

Yes, one piece at the time, then repeats steps set number of times(number of metal blinds in XL table), for the sake of argument let's say that number is 20. 
And metal sheet is coming from left to right.  So if I cut whit tool3 and set 0 after that, it would work. But it would leave all of that metal sheet in, from rollers to tool3 unusable, and rollers can not go backward to set it back to some 0 point. They would have a lot of discarded material.

Table is provided by customer (Holes.xlsx table, attached below picture in previous post), because the make custom blinds on that machine, and its now calculated in plc as part of subroutine. Subroutine is not always active, so it does not calculate all of the values each program cicle. Instead its called with a button to calculate when machine is on standby, and then stores values. I would attach pictures but I am out of MB-s.

I do have to add difference between 0 and tools (yes they are fixed position), but then I still have same problem, unusable metal sheet as soon as i reset the encoder value. 
I don't think I can recalculate all the values, for each hole, for multiple pieces of blinds.. simple multiplication would not work and program would be endless.

Aside of connecting 1 encoder to all 3 HSC input and assigning 3 different MI, I have 0 idea, and I'm at it today for 10-12 hours. I was hoping that there is some other way in program.

Best Regards; 
Marko

 

  • MVP 2023
Posted

As you've gathered, there's more to this program that meets the eye and it's not simple.  It's not just a cut-to-length application.  It's a do multiple operations on the same part and keep track of the one behind it at the same time application.

Your idea of connecting the encoder to all three HSC inputs in parallel may be the simplest solution.  The -R34 will definitely support it.

The idea I suggested before only used one encoder input, but the encoder must have at least 10X the precision of your 1 mm tolerance once all the mechanical connections are taken into consideration.  You're trying to write a precise program without all the data, and that's why you've spent so long on it - you're trying to solve a problem that can't be solved yet.

 

The encoder data sheet you posted is 100 ppr, which is not very precise as encoders go.  Before you do anything else you need to verify this is true and get the RPM of the shaft the encoder is connected to.  If the machine is as slow as you say, you may be able to increment a register in logic as you show in a previous post in an interrupt routine.  If you put that in a 1.25 mS interrupt routine you can see a pulse train at 400 Hz or less.  This translates to 4 rev/sec  or 240 RPM or slower.

Let us know what you find after you examine the machine.

Joe T.  

Posted

Hi Joe!

I work with samba SM35-J-T20 and encoder on HSC0 configured  as  high speed input reload.

I have MI1 as counter target value and interrupt is working fine on number of counts in MI1 , but only on the value which is loaded on the power up reset.

If I change MI1 during the program runs it makes no effect on the number of counts  on which interrupt is desired. It will change only on next power up reset.

Is it normal ? Can't I change this parameter on the go , must I every time  restart samba  or what?

 

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.