an interrupt that sets a global timing variable

JBrookes

Member
Hello
I am just checking to see if I need X2 series to do this.
I want to have an int routine which measures intervals between pulses of an optical encoder. This interval will then determine the timing variable of a main loop for a stepper motor.
This is for adapting an old lathe (1944 Logan) to do threading.
Can a 20x2 do this?
Thanks in advance.
JB
 

Janne

Senior Member
It is certainly doable, as long as the pulse rate from your encoder is not too fast. I've used a similar setint / settimer combination with picaxe in the past, to measure rotational speed of a windmill from the wild AC-frequency of the generator.
 

eggdweather

Senior Member
I recommend you add logic in the interrupt routine or main routine to guard against the timer exceeding limits, for example when there is no rotation or overflows in counting.
 

JBrookes

Member
And a few more questions, X2 etc.

It is certainly doable, as long as the pulse rate from your encoder is not too fast. I've used a similar setint / settimer combination with picaxe in the past, to measure rotational speed of a windmill from the wild AC-frequency of the generator.

Thanks tp both of you. Does anyone know whether this capability is restricted to X2 or whether it may be done with m2?
I'll check settimer doc to see, though I thought posts on this were ambiguous. (to me)
And yes, we are dealing with a binary machine - underflows and over flows need to be checked.
Thanks.
JB
 
Top