Meet in the middle

Recommended Posts

I have an issue with finding the most efficient way to measure the amount of time a input is high, then divide by 2, then load the time on top of a preset time delay coil.   This part of the logic is to locate the middle point of a sheet to fold it in half.    Any direction is much appreciated:-)

thank you,

JayC.

Share on other sites

May I ask, are you using time/speed to determine distance? To be more accurate, have you thought about an encoder?

• 1
Share on other sites

I have considered and encoder and could still go that direction but being that the sheet folder that we are upgrading is one set speed I didn't go that direction.  Geez these newbies huh:-)..

What would be the best way to set that up in the net?

Share on other sites

Well, you could put SB15 (transition contact for 100ms pulse) and input in series and use it to increment a counter. When input goes low multiply counter value by 10 (because timer value is in units of 0.01s) and store the result in timer via "Store Timer" function block (under "Store" tab).

I'm not sure about precision you can get from this. It may work ok for your application or it may be way off.  As Visco said encoder is the best solution.

Share on other sites

• MVP 2023

Look at the Help on the 1.25 ms interrupt routine.  If the input is on the main PLC board you can insert an immediate input into the interrupt routine and count the number of times the interrupt runs while the input is high.  You'll have to scale it, as the interrupt runs 800 times per second.  This is by far the fastest way to measure input ON time if you don't have an encoder.

Post your code and I can put one in for you.

Joe T.

• 1
Share on other sites

Thank you Joe,

I have a corporate PLC guy that steered me the same direction by using the SB 13.   The only issue I have now is after counting the 1 second pulse dividing it by 2,  I have it loading in to a TD.

At this point I'm looking to set up a set coil to power the TD when the input goes low.  Then reset after the output coil goes high.  I will post the logic when I get to the desktop??

thank you for any help:-)

Share on other sites

Isakovic,

Thank you,

You and Joe are on the same wave link or just good at what you do:-).  I may be going the encoder route by the end of this but being its folding linen and not running something like a CNC milling machine I'll try using time to start with.    I'll post the logic as soon as I get to the desk top.

thanks again,

JayC.

Share on other sites

• MVP 2023

Hi JayC

Don't use SB13........Joe's suggestion about the1.25ms interrupt is worth looking at....I use it a lot.  It is dead easy to do and offers very precise counting.

Even for "just folding linen", precise timing will make it even better.  Have a look at my post with an example, not exactly what you need but will give you the idea, and also the discussion around:........

cheers,

Aus

Share on other sites

Ausman,

Right on thank you!  I have found that the SB13 is not very accurate and has been inconsistent in its rythym.

I will post the finished working logic once I get this reworked??

thank you,

Jay

Share on other sites

Gentlemen,

I have only been learning this stuff for a month please be kind hehe:-).  Net 86 through 90 are the first fold that I am referring to that I am trying to use time to find the mid position of a sheet with.  The fallowing folds will fallow suit when this one is worked out.

The rest of the project is still a work in progress although I have worked out the Fold 1 jam circuit and have yet to make the same changes to the rest of the jam nets.

Anyway, I wrestled with posting the whole program but figured being my first one its a learning project anyway.

Thank you for any help guys,

JayC.

Sheet folder.vlp

Share on other sites

• MVP 2023

HI again JayC,

I was going to have a look at your vlp, but owing to hearing here about some issues with 9.8.64 I can't open it because I haven't upgraded yet from 9.8.31, and don't yet want/need to.  So others will have to chip in on this, which I'm sure they'll do soon.  Could you perhaps post a screenshot of those nets?

cheers,

Aus

Share on other sites

I tried breaking NET 86 into several smaller ones and making it simpler, It couldn't been done in one NET anyway. It's always better to have simpler nets, I learned it the hard way.

I don't have much free time now to work out the logic of the whole thing (like when should T1 start counting), you'll have to test if this is what you were looking for. I'd also suggest breaking programs into smaller subroutines, so you'll have Main routine (with optionally couple of nets for config blocks) calling other subroutines. Much less scrolling.

Also, I see you went with SB15. Tell us how it works, and what precision you got.

All the best,

59c0a61fb1bec_Sheetfolder.vlp

Share on other sites

Very cool,  I will look at this tonight:-)

thank you very much!!!!

Create an account

Register a new account

×