FRDM-K22F INPUT CAPTURE

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

FRDM-K22F INPUT CAPTURE

1,323 次查看
zatzfara
Contributor I

Hello.

I used to use the HCS12 microcontroller and now I'm starting to use my new FRDM-K22F.

I'd like to use the Input Capture feature. I have the code that worked perfect on the HCS12 and I'm trying to pass it to the new environment.

I'm currently using the CodeWarrior 10.6 Special Edition software.

The problem is that I can't find the registers that make the equivalent.

I just want to make the driver. I mean, the initializer to define the pin as input capture, define the cases that activate the interrupt and where to define the interrupt (the function to call when the condition occurs).

Thank you in advance for your time.

0 项奖励
回复
3 回复数

1,177 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Sasha,

In CW10.6, the interrupt vector is in the "kinetis_sysinit.c" file ,

pastedImage_0.png

the interrupt function name have been there , you can directly use .

And when enable the interrupt, when need write a enable function , like this :

pastedImage_2.png


Have a great day,
Alice

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

0 项奖励
回复

1,177 次查看
zatzfara
Contributor I

Thanks, that helps a lot.

By looking at the reference manual and the interrupt table, I decided to use the FTM1 CH0 as Input Capture Interrupt for detecting any flank at the FTM1 CH0 pin. I see is the alternative 3 for the pin PTA12.

How should I initialize it and how should I use the interrupt function? (FTM1_IRQHandler if I am correct)

0 项奖励
回复

1,177 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Sasha,

I recommend you use the Processer Expert , "Capture_LDD" or "TimerInt_LDD " both are ok  .

After configuration the component , then generate code , you can see the init code .

And you can refer to the help on component , there have  input capture demo , in the "Typical Usage ".

pastedImage_2.png

The Processor Expert can directly generate code, if you do not want use it , you can refer to the generated code to write your own code.


Have a great day,
Alice

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

0 项奖励
回复