g.mccormick
Lifetime Supporting Member
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?
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?