MKM14Z128ACHH5 PWM duty cycle read

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

MKM14Z128ACHH5 PWM duty cycle read

跳至解决方案
1,101 次查看
raununmar
Contributor I

Hi,

I'm starting a proyect with this microcontroller.

In that proyect I need to set a PWM and read a different one duty cycle's. Is that prossible with this model?

I have found that to generate the PWM signal I have to use the TMR0 output, but there is only one Timer I/O avaible and I dont know if there is other way to measurement the duty cycle.

Thank you in advance,

Raúl.

0 项奖励
回复
1 解答
916 次查看
nxf56274
NXP Employee
NXP Employee

Hi,

I will give you a thougnt to measure the duty. Configure a gpio as a external interrupt source. The rising edge and falling edge is active. When the PWM's rising edge comes, we start the PIT. When the PWM's falling edge comes, we stop the PIT. Calculate the difference. Then the results is multiplied by the PIT's period. It is the high level duration. If you set the gpio that the rising edge only  is active, you will get the PWM's period. We have the high level duration and PWM's period. Then we can calculate the duty.

Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
3 回复数
917 次查看
nxf56274
NXP Employee
NXP Employee

Hi,

I will give you a thougnt to measure the duty. Configure a gpio as a external interrupt source. The rising edge and falling edge is active. When the PWM's rising edge comes, we start the PIT. When the PWM's falling edge comes, we stop the PIT. Calculate the difference. Then the results is multiplied by the PIT's period. It is the high level duration. If you set the gpio that the rising edge only  is active, you will get the PWM's period. We have the high level duration and PWM's period. Then we can calculate the duty.

Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励
回复
915 次查看
raununmar
Contributor I

Thanks you so much for your reply.

 

How do I know which pins have an interrupt? I have found in the manual the register to configure it and it seems that not all input support that function.

 pastedImage_1.png

 How do I know which pins support it?

 

Thanks you in advance,

Raúl.

0 项奖励
回复
915 次查看
nxf56274
NXP Employee
NXP Employee

Hi,

pastedImage_1.png

Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------