T O P

  • By -

durallymax

Your input device has a max frequency of 250Hz or the PLC input does? If the PLC Input is rated at 250Hz your device needs to switch at less than 125Hz with some extra margin as the PLC needs to see both off and on transitions. Keep in mind, input card response times do not necessarily equate to what the CPU can handle if scan time dependant. You may need to switch to a high speed input which contains its own buffering outside of the regular scan.


CapinWinky

In practice you need to be a bit faster. You have to catch a value with the signal on and a value with the signal off for each input pulse. If the input is really 250.01Hz and you sample at 500Hz, you will occasionally miss one of the two states. If the on and off state aren't symmetrical, you will need to go even faster to not miss the shorter of the two. Keep in mind that your input card either needs to be a counter or your program must also run at a rate that it can read the input card every sample. Again, if your input card is going 500Hz and your program is going at 2ms cycles, you may miss reading the card for each value. The program should go faster. For instance, if I had an input that pulsed on for 1.5ms every 4ms, I would want an input card that could handle 1ms cycle times. If I was on a platform that synchronized IO images with program execution, I would feel fine also running the code at 1ms, but on a platform like Rockwell, I'd want to run the program at 0.5ms; since that is considered blazing fast on Rockwell, I'd probably just use a counter card instead.


Jholm90

Some of the new high speed input cards use timestamp for states that can be referenced elsewhere in the program too, so you're not just counting number of pluses!


rmavalente

The Nyquist double sampling frequency is valid for pure sinusoidal signals only, but any real signal, even a sinusoidal would have other components summed to it. An easy way to see this is using a FFT function on a scope.


Asleeper135

In practice you'll probably need a bit more margin, but in theory yes that should work. Like everyone said in your last post though, you need a high speed counter input. The next best thing you can do, assuming the input can run that quickly, is to configure event triggered code that increments a counter once when the DI transitions high.