Derek,
Therefore, your ON time is 30 inches x (1ft/12inches) x (1sec/15feet) = 0.1667 seconds = 166.7 milliseconds. Your OFF time is only 4 inches x (1ft/12inches) x (1sec/15feet)= 0.0222 = 22.2 milliseconds.
You meet Bernie's requirements, but just barely. You scan time could vary enough to go from 20 to 22 miliseconds, where you would miss a count.
You could look at decreasing the scan time. There are probably rungs in the program that could be changed to reduce scan time. The easiest way is to delete rungs, delete or combine subroutines.
Because you are using a SLC 5/04, another possibility is to use a DII routine, with regular old Inputs, as explained below.
Rockwell Software 2000
Discrete Input Interrupt Function
Use with processors SLC 5/03, SLC 5/04, SLC 5/05
Description
Use the Discrete Input Interrupt (DII) function for high-speed processing applications or any application that needs to respond to an event quickly. This function allows the 5/03 processor to execute a ladder subroutine when the input bit pattern of a discrete I/O card matches a compare value that you programmed.
The status file contains six bit values and six word values used to program and monitor the DII function. The DII does not require ladder logic instructions for configuration. You program the DII to examine the input bit pattern of any single I/O slot which contains any discrete input card (IG16, IV16, IB8, IB32, etc.) When the input bit pattern matches the compare value, the accumulator is incremented. The DII accumulator counts to the preset value, and once the interrupt is generated, it immediately wraps around and begins counting again at zero.
While scanning the DII subroutine, you can reconfigure the DII to look for an entirely different event. This facilitates DII sequencing. The DII can be programmed to compare each input point to either a high (1) or low (0) state. The accumulator is incremented on the input transition that causes the input points to match the compare value.
Program IIM and IOM (Immediate I/O instructions) in the DII subroutine so that the subroutine will have access to physical machine states.
Programming Procedure
1 Create a subroutine file (range 3-255) and enter the desired ladder rungs. This is your DII subroutine file. . Make sure that the INT instruction is the first instruction in this file. You can program any instruction inside this file except a TND, REF, or SVC instruction. Terminate your DII subroutine with a RET instruction. You may call other subroutines to a level 3 deep from within the DII subroutine.
2 Enter the Input Slot number (Word S:47).
3 Enter the Bit Mask (Word S:48)
4 Enter the Compare Value (Word S:49)
5 Enter the Preset Value (Word S:50)
6 Enter the DII subroutine file number in word S:46 of the status file. A file number of zero disables the DII function.
7 Restore your program and enter the REM RUN mode to begin operation.
Counter Mode - When the preset (S:50) contains a value greater than 1
1 The DII reads the first byte of input data of a selected discrete input card at least once every 100 microseconds. (Interrupt latency will affect the time between the last count and DII execution.)
2 When the input data matches the programmed masked value, the accumulator is incremented by one. The next count occurs when input data transitions to non-matched and then back to matched.
3 When the accumulator reaches or exceeds the preset value, between 1 and 65535, the interrupt is generated.
4 The DII subroutine is executed.
5 The cycle repeats.
Rockwell Software 2000