×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Plc counter code

Plc counter code

Plc counter code

(OP)
Could someone give me some ideas I would like to capture the pulse time for a pulsing input to A PLC, and would like to maitain the time for evaluating untill the next pulse.Just need some help with ladder instructions.

RE: Plc counter code

probably not possible. Most PLC will have a scan or cycle time of several miliseconds (at least). So your resolution of time will be on the order of 10 msec or greater. In addition to that most scan times are not fixed, so will vary from one scan to another. The only good way to measure pulse time is via hardware.

RE: Plc counter code

As long as you can sample the input at 2x as compare to the scan time you should be ok.

example
input pulse change over 40msec
scan time less than 20msec
This example will work

Are you asking to check for a fault if missing pulses?
If so, then use the pulse to reset a timer over a length of time.  If the timer times out you set a latch bit, flag an alarm bit.

or
start a timer on transistion of the pulse going true, when it goes true again move the accumulated time into the beginninng of an array.  Copy block the array down 1 position for the whole array.

rinse repeat

what you should see is the array filing up with the time between pulses, if the plc is able to capture it.

RE: Plc counter code

If you can assign an interrupt subroutine to the input, then you can set up a timer in the ISR to reset each time the interrupt routine is called.  

So the first command in your ISR would be to move the timer accumulator value into a word, the second command would be to reset the timer.  The word value would contain the most recent pulse interval.   

RE: Plc counter code

(OP)
Thanks for all of your responses, to give you A little more insight I am trying to troubleshoot a shrink wrapper and problem is that on an intermittent bases the knife that cuts the film should only make one revolution. It is triggered by a Photo Eye. Once the film is feed via servo drive, there is a pulse generated from the drive which is feed to a module that makes the 24v out put to the mac valve pulse low. which allows the knife through a clutch to make one revolution. I jumped this 24v over to a plc input hopping I could capture the time and compare it to the time of normal operation. What is happening is instead of one revolution it will make 4 or 5. The mechanics that have been working on it have replaced and made the necessary adjustment to the mac valve, cylinder clutch ect. they are convinced that it is not mechanical and since it only happens once or twice a shift "which i cant sit there and watch it all day" i thought i would capture the output time to the mac valve and determine if it is a longer than normal negative pulse.

The code I added was like what i have in the link below. the problem is the reset does not reset the ACC of T4:10. In fact when I test that rung the count never makes it to my N7:2 file, If I AFI that rung my counter continues to count and shift the values to my two N7 files.
http://picasaweb.google.com/gonehuntingalbum/DropBox?authkey=Gv1sRgCOrNt76f3uClVw&pli=1&gsessionid=l2qVSIqh8P6gch523qxo9A#5548069283283540514
 

RE: Plc counter code

gonehunting,

Does your knife have a "home" position sensor?  It should not go several revolutions, if you stop it at the home.

RE: Plc counter code

at the rto, you latch in the input with the enable of the rto.
Right before it triggers the rto during the transistion, do the reset (use a oneshot of the input), its a rung order problem.  You would also break the enable on the rto with the reset right before.  Also move the data at the reset rung of the rto.

You might be missing the pulse on the plc input like someone was saying, is why you think it went 4-5 revs and you did not see it.  Look at the specs on the input card see if it is even capable of seeing a pulse at this speed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources