Jump to content

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.

Link to comment
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.

Link to comment
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.

  • Upvote 1
Link to comment
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:-)

 

Link to comment
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.

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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

Link to comment
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...