Counters, rising triggers, resets with plc scans in TwinCat2

g.mccormick

Lifetime Supporting Member
Join Date
Jul 2012
Location
IN
Posts
961
Here is something that I am trying to wrap my head around.

The short story is that I have a CX8090 with a fairly small amount of code on it. The terminals that are connected are a el5151 and el5152. I am using counter and latch on the 5151 and a period (triggered by the same signal as the latch on the 5151).

Basically, this system averages counts per cycle of a shaft. The shaft is triggering a once per revolution to the latch and period measurement. There a a frequency signal going to the counter input on the 5151. This system is for doing torque measurement over n number of revolutions on an engine.

Every revolution of the shaft triggers a latch value, I add that value into a totalizer, and reset the latch, and increment a counter. I am using a rising edge on the latch dn to do the adding and incrementing. When the counter has expired (for instance 2 revolutions of the shaft) I do simple math of total counts / total period to get an averaged frequency.
I then reset the counter by setting my counter reset = true.

My question is does doing all of this, resetting the counter, etc waste 1 scan of the PLC?

If I think about scans etc, is this how the plc scan would work.
Scan 1. Rising trigger true, counter increments
Scan 2. Rising trigger false, counter nothing
Scan 3. Rising trigger true, counter increments & becomes true?, math happens, counter reset = true
Scan 4. Rising trigger false, Counter becomes false due to reset, counter reset = false
Scan 5. Rising trigger true, Counter increments?

Does this make sense? Would the counter reset in 1 scan, and be ready the next?
 
After typing this out and thinking of it during that time, I believe I have answered my own question. There would need to be a scan between the counter being done, and it being able to count again (ie. scan 4 where it sees the reset).
 

Similar Topics

Hi Hope you all are doing well. Iam working on a project with some AOI. I also hate no online edits... lol. My problem occurs when I use a UDT...
Replies
2
Views
170
Hey guys, thanks for reading. I am trying to use a micrologix(1000 or1500) to control 3 hydraulic pumps. I have a time clock to give a signal to...
Replies
38
Views
3,487
iFIX 5.5. We have alarm count database tags with SIM driver and I/O address = "C:AREA-SD:ACK" which is suppose to count the acknowledged alarms in...
Replies
16
Views
1,424
https://www.youtube.com/watch?v=zTOOYWMJg9M . Specifically see 1:46 to 2:11. 3. The Cell PLC is in constant communication with two other field...
Replies
14
Views
3,183
Does the 1100 only have 1 high speed counter, but it can have multiple inputs? And so then the 1400 has 6 HSC and you have a choice of multiple...
Replies
1
Views
1,723
Back
Top Bottom