MKM14Z128ACHH5 PWM duty cycle read

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

MKM14Z128ACHH5 PWM duty cycle read

Jump to solution
822 Views
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 Kudos
1 Solution
637 Views
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
638 Views
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 Kudos
636 Views
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 Kudos
636 Views
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.
-------------------------------------------------------------------------------