I need to keep track of the position of a stepper motor. I intend to do this by monitoring the step and direction lines that are controlling the motor (it's a normal step and direction stepper driver). Critically, I have to display the result on a serial LCD.
I have set up a system with an 08M running at 8MHz that uses an interrupt to check the status of the step and direction lines and at low frequencies this works fine. As soon as the step frequency gets higher it seems that while it is writing to the LCD there is enough time for a step to occur without it being recorded and it therefore the chip loses track of the stepper motor's exact position.
Is there a better way to do this or should I just use a faster chip (a 20X2 for example) and a higher baud rate?
(The steps occur up to 400 Hz. I do not want to use an optical encoder.)
Cheers,
Nigel
I have set up a system with an 08M running at 8MHz that uses an interrupt to check the status of the step and direction lines and at low frequencies this works fine. As soon as the step frequency gets higher it seems that while it is writing to the LCD there is enough time for a step to occur without it being recorded and it therefore the chip loses track of the stepper motor's exact position.
Is there a better way to do this or should I just use a faster chip (a 20X2 for example) and a higher baud rate?
(The steps occur up to 400 Hz. I do not want to use an optical encoder.)
Cheers,
Nigel