Im aware that using some kind of timing routine could be a solution to this but Im not sure how to accomplish it.
How would YOU detect that nobody (was going to) reply to your post? Would you assume that 10 years was a reasonable time to wait? 10 weeks? 10 days? 10 minutes? 10 seconds? 10 microseconds?
Pffabrications:
Using an interupt to detect incoming PWM signal then a loop to calculate duty cycle and translate that to desired rpm.
This works well until the 0 rpm is requested (which drops the incoming PWM signal back to 0 volts)
0 is not detected and the target rpm remains at the last positive value.
If you note the time of each interrupt and if the interval between interrupts is too long you will know that the stream of pulses has stopped. I use that to detect when a small DC motor stalls.
You have not told us what computer is interpreting GRBL and producing the PWM signal? If you could modify the program so it just sends the number - such as 0 - 255 - it would make life much easier.