¿Capture_LDD work?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

¿Capture_LDD work?

478 Views
ricardcomas
Contributor III

Hi everyone,i 've a question about this component, i need measure the pulse width (high) of a input PWM, i thought that setting it with rise edge, this component would return a value (in miliseconds) of measured,pulse width,but, when i display this value returned by this component, i get a wrong value, for example, if the input PWM is simetric 50Hrz (duty of 50 %) the capture component return 38000, what is 38000?¿ i want a periode of PWM (it whould be 20000 milisecond, not 38000) i don't understand why Capture component return a number that doesn't corresponds with a periodic of input PWM, it would be 20000 miliseconds.

My microcontroller is MKE04Z128, i show you my code, by the way, when i create  a Capture component, i get this message: "The component "Capture_LDD" uses another shared component for item "Linked TimerUnit". You can use existing component or create a new one., i select "New component [Kinetis/TtimerUnit], its same select a existing timer?¿, this is my Capture component configuration,

- Capture Device: FTM0_C0V

- Capture input pin: some pin correspond 0 channel

- Edge:rising edge

- Maximum time of event:87 ms (What does it mean??)

This is my code:

Main.c

uint16_t data = 0;

Cap1_Reset();

for(;;){

Display(data);

}

Events.c

extern uint16_t data:

Cap1_OnCapture(){

   Cap1_GetCaptureValue(&data);

   Cap1_Reset();

}

Thanks so much again!

Tags (2)
0 Kudos
1 Reply

363 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ricard Comas,

TU1_GetCaptureValue just return the value of FTMx_CnV.

TU1_GetCaptureValue.png

Input Capture mode.png

Please try to use the Init_PWT, you can find the Pulse Width Timer (PWT) module in Reference Manual.

Init_PWM.pngPWT.png

Best Regards,

Robin

 

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

0 Kudos