max with a rotary encoder

OK, I see.
Now, I think you would need some feedback for the rotary encoder setting anyway, on an LCD, or some flashing light or something. In this case, can't you have just a push button, and handle the setting through software? (That is, push the button until you reach the desired frequency, and when you reach maximum go back to 0).