PWM functionality in KV4x

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

PWM functionality in KV4x

Jump to solution
1,250 Views
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 Kudos
1 Solution
1,221 Views
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

View solution in original post

2 Replies
1,222 Views
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,219 Views
soaring_sun
Contributor III

Thank you, that helps

 

0 Kudos