You have asked our question in the Mach4 section of the forum, but the answer
for Mach3 is the same as for Mach4. The thread tracking is accomplished by
controlling the Z axis travel rate, not by altering the spindle speed. Feedback
from the spindle speed sensor is used by Mach to calculate the needed travel
rate to make the threads and adapts within reason if the spindle speed changes
while cutting.
The typical Mach3 setup cannot use a true encoder, and instead uses a single
pulse per revolution to measure the spindle speed. Many encoders have an
"index" pulse which can be used for this purpose.