PWM functionality in KV4x

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

PWM functionality in KV4x

跳至解决方案
1,262 次查看
soaring_sun
Contributor III

Hi,

I am a fresher to eclipse series of micro and would like if someone helps me out with the PWM functionality. I have been referring to the datasheet and the TRM of the micro-controller MKV42F256VLL16. (I have attached them to this thread)

I have installed MCUXpresso IDE and have found an example project regarding the same. But when I compare the PWM registers mentioned in the manual and the example project, I just am not able to relate one to another.

1. There is an internal function, "BOARD_InitPins();" which initializes PORTA pins for sw0. Is this necessary/mandatory function for all programs? (This initialization is not present in the example project. Only the required pins are used.)

2. Using the functions, how will I be able to set the compare values to the registers? (Though I understand I could manually set them, I'm thinking using the inbuilt functions would be easier for me.)

3. If I'm using the inbuilt functions, should I be changing them according to the settings that I require? If the settings that are used in the inbuilt function are not what I need?

 

I'll apologize beforehand if my question looks silly, but I'm desperate for learning them better. I'll look forward to your reply. 

Thanks in advance.

0 项奖励
1 解答
1,233 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi soaring_sun,

1. No, it's not mandatory. Just initialize required pin in BOARD_InitPins(). Of course you can initialize them in any place you like. Keeping unused pin in default state is no problem. 

2. In the example project, you can see that it use PWM_UpdatePwmDutycycle() to change PWM duty.

3. Yes, of course.

 

Regards,

Jing

在原帖中查看解决方案

2 回复数
1,234 次查看
jingpan
NXP TechSupport
NXP TechSupport

Hi soaring_sun,

1. No, it's not mandatory. Just initialize required pin in BOARD_InitPins(). Of course you can initialize them in any place you like. Keeping unused pin in default state is no problem. 

2. In the example project, you can see that it use PWM_UpdatePwmDutycycle() to change PWM duty.

3. Yes, of course.

 

Regards,

Jing

1,231 次查看
soaring_sun
Contributor III

Thank you, that helps

 

0 项奖励