cancel
Showing results for 
Search instead for 
Did you mean: 

how to transmit the CNT in interrupt upon encoder interface mode

wu hui
Associate
Posted on August 29, 2017 at 11:32

hello:

i use the encoder in encoder interface mode of TIMER,it can read the CNT of TIM4  correctly in main ,but this is not my target. i want to get the CNT when the TIMER count up or count down, so it must in a interrupt.

so i enable the capture/compare mode of TIM4,but in the capture callbak function,the printed CNT is wrong。0690X000006083HQAQ.pngthe wrong;0690X00000607vFQAQ.png the correct。 

now how can i transmit the CNT in interrupt upon encoder interface mode,i think the capture/compare mode is a wrong way.

Look forward to your reply

2 REPLIES 2
Posted on August 29, 2017 at 11:44

Do you read the CCRx for the channel you are capturing? 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 29, 2017 at 12:04

Actually,if i look for the CNT in main function ,it is correct。but it is wrong in capture interrupt。so i think Whether it can not transmit in that interrupt。

________________

Attachments :

2C05FB0B@5FEAA046.0A3CA559.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyHj&d=%2Fa%2F0X0000000b8E%2Fxp3z779JPjHmJ2njJmrV8fl.CaKyvqgrsS2xVvKtsfo&asPdf=false