Plc counter code
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.
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 ********filter
what you should see is the array filing up with the time between pulses, if the plc is able to capture it.
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.
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.
MORE NEWS