Processor Expert components in functions and not seeing functions described in help window

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

Processor Expert components in functions and not seeing functions described in help window

Jump to solution
1,282 Views
yusifnurizade
Contributor III

Hello,

I am still relatively new to Code Warrior and Processor Expert so while I can get a project up and running, I am still learning the finer points of the IDE. Today I have two questions in particular regarding Processor Expert; how can I have a function access more than one component based on input and how can I enable functions that are mentioned in a component's help window but don't show up in the Components window?

Regarding having a function access more than one component:
I am trying to set up multiple PWM channels and want to control them using a terminal emulator. Writing the code for the first couple of PWMs is fairly simple; read a string, read the part that specifies the channel, read the part that specifies duty cycle, set duty cycle and let the user know if the channel needs to be turned on. Works fine but the code gets long and laborious when adding more channels. If I could have a single function that takes in the read string and updates accordingly that would be great, however, the case structure for PWM1_Enable, PWM2_Enable, etc. still takes up a lot of space. Is there a way to keep the component function and auto-update the number? That is, could I keep the PWM_Enable() function and update the number based on the input string going into the function?

Regarding enabling functions I see in the Help window but not in the Components window:

To be more specific, I am using a FRDM KE02Z and CW 10.5. For example's sake, I am trying to add the PWM_LDD component. When I right click the component after adding it to the project and select the Help On Component option, under methods I see the Deinit function. Expanding the component in the Components window, however, I only see Init, SetDutyMS and SetRatio16. How do I get Deinit as a usable function? Could it be tied to the microprocessor I'm using?

Hope to hear from you,
Yusif Nurizade

Labels (1)
0 Kudos
1 Solution
548 Views
Petr_H
NXP Employee
NXP Employee

Hi Yusif,

Regarding missing functions - Some function might be MCU specific, but this would be probably written in the help page. You have probably "Basic" visibility set in Inspector view. Please click on the "Expert" button to see all possible functions provided by the component.

Regarding accessing more PWM components by indexing with variable - unfortunately, this is not possible.

However, for the situation where you can use the whole timer and you want there more channels, I recommend to use directly TimerUnit_LDD component instead. It's more complex, but it's more flexible and you can control all channels using one component.

The PWM_LDD is using the TimerUnit anyway. The PWM_LDD is a component that allows to use individual channels of the timer for the PWM and leaving other channels from for other components.

Please see the Toggling Pin on Kinetis Using a Timer Output that should give you an idea on how to setup the TimerUnit_LDD to produce the square signal on a channel of a timer.

Using this approach you can configure as many channels as you need for producing PWM.

Then, in your code, you can control the width of the pulses using the component's method SetOffsetTicks that has one of the arguments a number of the channel to set .

Best regards

Petr Hradsky

Processor Expert Support Team

View solution in original post

0 Kudos
2 Replies
549 Views
Petr_H
NXP Employee
NXP Employee

Hi Yusif,

Regarding missing functions - Some function might be MCU specific, but this would be probably written in the help page. You have probably "Basic" visibility set in Inspector view. Please click on the "Expert" button to see all possible functions provided by the component.

Regarding accessing more PWM components by indexing with variable - unfortunately, this is not possible.

However, for the situation where you can use the whole timer and you want there more channels, I recommend to use directly TimerUnit_LDD component instead. It's more complex, but it's more flexible and you can control all channels using one component.

The PWM_LDD is using the TimerUnit anyway. The PWM_LDD is a component that allows to use individual channels of the timer for the PWM and leaving other channels from for other components.

Please see the Toggling Pin on Kinetis Using a Timer Output that should give you an idea on how to setup the TimerUnit_LDD to produce the square signal on a channel of a timer.

Using this approach you can configure as many channels as you need for producing PWM.

Then, in your code, you can control the width of the pulses using the component's method SetOffsetTicks that has one of the arguments a number of the channel to set .

Best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
548 Views
yusifnurizade
Contributor III

Petr,

Thanks for clearing up the functions issue, that was the problem.

I took a look at your timer suggestion but since I need to control, not just set, the different channels individually and dynamically, I don't think this fix will work. I've been working on the PWM problem a lot over the holidays and am updating the thread I have dedicated to it. Would appreciate your input.

Thanks again,

Yusif Nurizade

0 Kudos