Hola.
Estoy desarrollando un proyecto en Keil, usando la placa LPC2129, para medir la velocidad de dos motores cuyos encoders tienen dos canales y 7 pulsos por revolución.
La única forma que se me ha ocurrido ha sido usar las interrupciones externas (EINT) para cada canal y detectar los flancos de subida y bajada.
Si existe alguna forma mas optimizada y fácil de implementar, que alguien me ayude, por favor.
Muchas gracias de antemano.
Un saludo
Solved! Go to Solution.
Hi Alessandro,
Knowing that your encoder has an output of two channels, it is very likely that a comparison of the phases between the two signals can tell you the direction of your motor rotation.
Please check the following link where it explains this: https://www.rs-online.com/designspark/quadrature-encoder-basics-part-1-theory. It is important that you also check the specifications of the encoder you are using just to be sure that it will be able to detect speed direction.
If the previous option is not possible, another thing you could try would be that you use ADC to detect the voltage polarity that is controlling the motor (I'm assuming that you are using two voltage inputs to set the direction of the motor with an H-Bridge driver).
Best Regards,
Ricardo Delsordo
Hi,
You can try one of the following options for the reading of the frequencies of your motors:
Best Regards,
Ricardo Delsordo.
Hi, thank you for your quick answer.
I have alredy tried the first option, getting the engine speed quite well, but the problem is that there is not way to get the speed direction, because I need it too, or I do not know how to get the direcction using the Capture function.
Talking about the converter, I discard that option, because we are trying to avoid the most hardware as is possible, but thank you for the idea.
Returning to first, if you know a way to get the direction of the speed using capture it will be very helpful.
Thanks for all,
Alessandro
Hi Alessandro,
Knowing that your encoder has an output of two channels, it is very likely that a comparison of the phases between the two signals can tell you the direction of your motor rotation.
Please check the following link where it explains this: https://www.rs-online.com/designspark/quadrature-encoder-basics-part-1-theory. It is important that you also check the specifications of the encoder you are using just to be sure that it will be able to detect speed direction.
If the previous option is not possible, another thing you could try would be that you use ADC to detect the voltage polarity that is controlling the motor (I'm assuming that you are using two voltage inputs to set the direction of the motor with an H-Bridge driver).
Best Regards,
Ricardo Delsordo
Hello Ricardo.
Yes, they are quadrature encoders, but the problem was that I could not measure the level of the other channel using just EINTs.
Now I am using EINTs (to detect rising or falling edges) and GPIOs (to measure the level of the other channel and know the direction). With this solution I could solve the problem.
Thank you very much for the help.
BR,
Alessandro.