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





I'm developing some ladder logic code to read a square wave duty cycle, and am having a problem with OMRON's counter implementation. My background is embedded C and HDL, and this is the first time I've developed in ladder logic. Basically the 8-bit counter isn't counting; apparently there is some kind of counter enable that I haven't found in the manual or any googling.

The counter part of the code is pretty simple:
M1 F0
-||---------(R)- <<< this line resets the counter when M1 is asserted.

------------(C)- <<< this line is the counter which should be counting whenever the program is running (plus-one increment per "scan" of the ladder logic).

I'm not using the "Preset" value for the counter; instead I'm using four comparators to observe the counter and actuate independent events based on various values of the counter. M1 will be asserted at various times to reset the counter. The Preset value of the counter (which asserts F0 when the count exceeds it) is just left at the default 1, which I know isn't a problem because I've also set it at very large values just to check.

Both on the PLC, and the simulator software, show the counter incrementing once when the program starts, then nothing else. If I press start and stop repeatedly in the simulator, the counter slowly increments.

So far I've only come up against a blank wall; any help would be much appreciated.


You cannot use:

Counter's usually increment on the rising edge. From a PLC's point-of-view there is only ONE rising edge in the above case. Hence your one count per restart.

I suggest you look for a better input toggle. Most PLCs have a list of system functions you can tap. For instance the CLICK PLC, I'm writing a filter program on right now, has a _scan value you would run as:

Which WOULD work in your case.
Other things offered would be _100ms, _1sec, _1min, _WDreset, etc. etc.

Or you could set up a timer of any time interval you want and have it toggle your counter and be reset by your logic or itself.

Keith Cress
kcress - http://www.flaminsystems.com


Thanks... that makes perfect sense.

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!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close