Quadrature encoder Kinetis k64

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Quadrature encoder Kinetis k64

1,707 次查看
Edrianocarlos
Contributor IV

Hello,

I would like to ask to you guys.

if i have to deal with counters higher than the 65535 from the 16 BITS counter.

how do you normally deal with that? use the overflow interrupt? 

what other way can i deal with that without loosing counts?

thank you.

标签 (1)
0 项奖励
4 回复数

1,378 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

The overflow interrupt should be used to deal with it.
TOFDIR indicates the counting was up when the FTM counter overflow occurred.

FTM Counter overflow in up counting for Quadrature Decoder mode.png

FTM counter overflow in down counting for Quadrature Decoder mode.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,378 次查看
Edrianocarlos
Contributor IV

Thanks for your answer.

Yes that is one way i thought how to implement.

My only concern is that lets suppose an overflow happen while i am reading the counter and updating the variable.

as i have a bigger variable i would need to increment it somewhere inside or outside the interrupt handle. 

my encoder can generate 1MHz frequency 4 edges.

it is really hard to simulate it and trying to realize if this can even happen.

0 项奖励

1,378 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

The KV4x and KV5x contain Quadrature Encoder/Decoder (ENC) module which support 32-bit position counter.

You can check if these MCU meet your needs.

Quadrature Encoder Decoder (ENC).png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励

1,378 次查看
Edrianocarlos
Contributor IV

Thank you Robin.

I was able to make this one work.

running the core at 100 Mhz reading the counter and inc or dec one variable.

0 项奖励