2025-05-21 3:41 AM
Hi,
I am working on the STM32G431RB and implementing ABI/Z quadrature signal generation. I’m using a sensor that provides sine and cosine signals, which I read using the ADC to calculate the angle from 0° to 360°. The angle measurement is accurate and working perfectly.
Now, I want to generate 1024 ABI pulses per revolution (PPR) based on this angle.
The A and B signals are square waves generated as the encoder shaft rotates.
Due to the 90° phase shift between A and B, the direction of rotation can be determined:
If A leads B, the rotation is in one direction (e.g., clockwise).
If B leads A, the rotation is in the opposite direction (e.g., counter-clockwise).
To generate 1024 pulses per revolution (0–360°) using the measured angle. If some one already work on this then please let me know the logic for this one: