How to use an incrementing value to trigger a counter?

anthony.v3a

Member
Join Date
May 2016
Location
Bakersfield
Posts
16
I'm sure this is an easy one for the experienced guys, how can I use an incrementing dint value to trigger a counter to count? It seems like it would be easy but I can't get it to work. I'm just trying to get a counter to count every 7 days then trigger the done bit and reset. I have the whole resetting part down. It's just the dint that is counting the days in a month that i can't get to increment the 7 day counter.

Any help would be greatly appreciated.

Thanks,
Anthony M
 
Hey Anthony, welcome to the forum!

You didn't mention the PLC but if you just want to trigger a counter purely when a DINT changes value, do some thing like this:

If DINT <> TEMP Then Count
TEMP = DINT

So in the Logix platform (Compact/Control) you might have a NEQ OTE MOV on a rung all in series. NEQ will have DINT and TEMP, OTE will trigger your counter and the MOV will make DINT into TEMP. Basically your OTE will trigger for one scan, which you can trigger your counter with.

Or you could have NEQ ONS MOV with a similar setup descirbed above and use a XIC from the ONS to trigger your counter.

Or you could use a GSV to get the PLC time, which will store in a 7 DINT array, one element being the numerical value of the day of week. When the day is = the day you want, trigger your counter

If you happen to be using the Logix platform, try them all and see which one you like. I'm sure there are plenty of more ways to do it. If not the Logix platform, hopefully this will get you close

edit: Or I guess you wouldn't even have to use a ONS or OTE in my first two examples, you could just put the NEQ in front of your counter, then on the next rung, just make TEMP equal to DINT.

edit2: if none of that made any sense, let me know and I'll try to do better!
 
Last edited:
Thank you for taking the time to help me out, I've been trying to understand your methods but am having some difficulty. (Sorry, I am using Studio5000 Controllogix)

"you could have NEQ ONS MOV with a similar setup descirbed above and use a XIC from the ONS to trigger your counter."

The NEQ would use the dint "DATETIME[4]" as source A and Source B could just be 1? Then use a ONS next in series and then a MOV with what as the source and destination?

Thank you, I really appreciate it.
 
Sorry, I should've included what I am trying to do. With logix 5000, I'm trying to count the system value of days (7) to have some scanner values reset every sunday. So I don't think I would be able to have the preset equal day 7, 14, 21, or 28 because the number that equals every Sunday is not constant. What is constant is every 7 days being a Sunday where sundays relative to the numbered day of the month is not constant because not every month has the same number of days.so I figure I need to count 7 and the .DN resets scanners on Sunday but then doesn't set the .DN bit fill the next 7th day. That's as clear as I can make the issue.

Thanks!
 
I'm trying to count the system value of days (7) to have some scanner values reset every sunday.
If you need to determine what is the day of the week, go to RA site, Sample Code Library section, and look for "day of week". You'll find a bunch of code ready to use there.
 

Similar Topics

Hey everyone, I am hoping that i can get an answer on this matter... I have a micrologix 1100 hooked up to a signal conditioner (Omrga DMD-466-DC)...
Replies
4
Views
1,572
So, I get sent a heartbeat, an int that goes from 0-9 every second and then restarts, I need to detect if it stops after 3 secs. Any simple way...
Replies
11
Views
3,070
Hello World, I am having difficulty incrementing a serial number that needs to start at 0, and go through Z. (After 9, comes A). The serial...
Replies
11
Views
1,844
Hi guys, Im about to add a new flowmeter which pulse every 0.1 cubic meter to my Micrologix 1400. I would like to increment of 0.1 everytime i...
Replies
13
Views
1,986
Good Morning, I have a sort of easy problem that is driving me nuts. I have an application where I'd like to take a set point, lets say it...
Replies
4
Views
2,257
Back
Top Bottom