cancel
Showing results for 
Search instead for 
Did you mean: 

how to make pulse encoder output for simulation

omid hamdi
Senior

hi

any one can help me how to setup timer stm32 for encoder out put

i need convert endat encoder to incremental encoder

2 REPLIES 2
phase  pin1  pin2
0      0     0
1      0     1
2      1     1
3      1     0

Perhaps the easiest is to run a periodic interrupt and keep track of the "phase" (there are 4 phases in the encoder) in a variable. In the interrupt, increment or decrement the phase depending on where do you want to move, mask the bottom 2 bits, and use those to look up the pins output values in the table above.

There are of course many ways how to tackle this.

JW

omid hamdi
Senior

I NEED used timer for make encoder output

i have 32bit is my position when motor rotate this number go up or down need send out to incremental encoder old cnc system can work with this exactly same used incremental encoder

i try fined way used timer stm32 for output encoder