John,
If 90 RPM (strokes per minute) is your target speed, and your system generates one pulse per revolution, the the time between pulses is 0.667 seconds.
There is no reason to attempt to measure your system RPM more often than once every 0.667 seconds. I'd check the pulse frequency no more often than once Per second. If you call PULSEPERIOD() at a faster rate, say once every 0.1 second, then one of two things must happen:
1. The pulseperiod() function locks up the custom function for a minimum of 0.666 seconds waiting for two consecutive pulses from your sensor.
OR
2. Pulseperiod() returns the same value as the previous call. No new information received! Useless information for the purpose of changing a PWM OUTPUT.
I have not tested the behavior of this function to figure out exactly how it behaves.
In either case it makes no sense to check the speed more often then rate that your transducer sends pulses to the PMON system. You are either wasting CPU cycles or fooling yourself that you have measured something REAL.
If you are doing some sort of speed control, especially if you are using a PID computation, you should make your measurements and the output adjustments on a consistent time interval. In your case, once a second is about as often as your system will allow. It's your system is slows to respond to Input changes, you may want to slow down the measurement/adjustment rate to something that makes sense for your system.
I'm a big proponent of measuring stuff to determine how much time your custom functions take to execute. I use the status(21) function at the beginning and end of custom functions as part of my debug. I have found many surprising things this way. Plus, if you ever get the urge to "optimize" your code, it makes the most sense to fix the stuff that wastes the most tine, first.
Another simple thing that you can do is drive a PLC OUTPUT from the 1 second clk signal. Watch the LED (better yet hook it to a logic analyzer or an ossicoloscope). If you can "see" that this output is anything other that a nice even pulse every second, then you may have a serious problem with your custom function usage and coding.
Gary d