<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDE中的主题 Re: LPC1769 : using the MCPWM</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591524#M29633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ethankhoo on Thu Sep 20 07:11:14 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: fjrg76&lt;/STRONG&gt;&lt;BR /&gt;It maps the timer registers to a struct, so the programmer can write to or read from them through a pointer.&lt;BR /&gt; &lt;BR /&gt;No code available, but you can check its internals here:&lt;BR /&gt; &lt;BR /&gt;&lt;A href="http://"&gt;http://www.ethernut.de/api-beta/lpc176x_8h_source.html&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;(Inside the webpage find "LPC_MCPWM_TypeDef".)&lt;BR /&gt; &lt;BR /&gt;This is kind of object programming in C. The LPC_MCPWM_TypeDef struct is the "class" from which several objects (pwm channels on the MCU) instantiates. So, if the MCU has 3 identical timers, you'll have 3 objects: pwm0, pwm1 and pwm2, or whatever name you choose. This objects have attributes (the fields onto the struct) and operations on those attributes (_init(), _configure(), _get(), and so on). &lt;BR /&gt; &lt;BR /&gt;From here you can implement simple inheritance and polymorphism.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i know it is suppose to be a struct type variable, i tried doing this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_MCPWM_TypeDef dummy;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][B]MCPWM_Init[/B]([COLOR=#005032]&amp;amp;dummy[/COLOR]);[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]but it doesn't seem to work. what exactly am i suppose to declare in dummy??[/SIZE][COLOR=#7f0055]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 21:28:31 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T21:28:31Z</dc:date>
    <item>
      <title>LPC1769 : using the MCPWM</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591522#M29631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ethankhoo on Wed Sep 19 01:31:19 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi everyone, i would like to ask about the cmsis library available for the MCPWM function in LPC1769.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i am having problems understanding certain requirements of the function,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in all the functions, there is a requirement to put in a *MCPWMx&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][COLOR=#7f0055]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR][/SIZE][SIZE=2] [B]MCPWM_Init[/B]([/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032][U]LPC_MCPWM_TypeDef[/U][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][U] *MCPWMx[/U])[/SIZE][SIZE=2][COLOR=#7f0055]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR][/SIZE][SIZE=2] [B]MCPWM_ConfigChannel[/B]([/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032][U]LPC_MCPWM_TypeDef[/U][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][U] *MCPWMx[/U], [/SIZE][SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]uint32_t[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] channelNum,[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]MCPWM_CHANNEL_CFG_Type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] * channelSetup)[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]May i know what exactly are they asking for? i cant seem to put in an appropriate variable.[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]Thanks for your help and i would appreciate any help.[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]A sample code for initialization would be greatly appreciated too.[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]Thank you all[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:28:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591522#M29631</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 : using the MCPWM</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591523#M29632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by fjrg76 on Wed Sep 19 15:17:04 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;It maps the timer registers to a struct, so the programmer can write to or read from them through a pointer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No code available, but you can check its internals here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://"&gt;http://www.ethernut.de/api-beta/lpc176x_8h_source.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Inside the webpage find "LPC_MCPWM_TypeDef".)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is kind of object programming in C. The LPC_MCPWM_TypeDef struct is the "class" from which several objects (pwm channels on the MCU) instantiates. So, if the MCU has 3 identical timers, you'll have 3 objects: pwm0, pwm1 and pwm2, or whatever name you choose. This objects have attributes (the fields onto the struct) and operations on those attributes (_init(), _configure(), _get(), and so on). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From here you can implement simple inheritance and polymorphism.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:28:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591523#M29632</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 : using the MCPWM</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591524#M29633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by ethankhoo on Thu Sep 20 07:11:14 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: fjrg76&lt;/STRONG&gt;&lt;BR /&gt;It maps the timer registers to a struct, so the programmer can write to or read from them through a pointer.&lt;BR /&gt; &lt;BR /&gt;No code available, but you can check its internals here:&lt;BR /&gt; &lt;BR /&gt;&lt;A href="http://"&gt;http://www.ethernut.de/api-beta/lpc176x_8h_source.html&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;(Inside the webpage find "LPC_MCPWM_TypeDef".)&lt;BR /&gt; &lt;BR /&gt;This is kind of object programming in C. The LPC_MCPWM_TypeDef struct is the "class" from which several objects (pwm channels on the MCU) instantiates. So, if the MCU has 3 identical timers, you'll have 3 objects: pwm0, pwm1 and pwm2, or whatever name you choose. This objects have attributes (the fields onto the struct) and operations on those attributes (_init(), _configure(), _get(), and so on). &lt;BR /&gt; &lt;BR /&gt;From here you can implement simple inheritance and polymorphism.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i know it is suppose to be a struct type variable, i tried doing this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_MCPWM_TypeDef dummy;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][B]MCPWM_Init[/B]([COLOR=#005032]&amp;amp;dummy[/COLOR]);[/SIZE]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2][/SIZE] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[SIZE=2]but it doesn't seem to work. what exactly am i suppose to declare in dummy??[/SIZE][COLOR=#7f0055]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[/COLOR]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:28:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591524#M29633</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1769 : using the MCPWM</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591525#M29634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by fjrg76 on Thu Sep 20 10:28:53 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What a rude pal!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In this code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;LPC_MCPWM_TypeDef dummy;

MCPWM_Init(&amp;amp;dummy);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you're declaring a struct variable in user RAM (local or globally), so the reference [I]&amp;amp;dummy[/I] points to your RAM; however, you need to make it point to the TIMERs spaces. You can accomplish that in this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;LPC_TMR_TypeDef * tmr32b0 = (LPC_TMR_TypeDef *)(LPC_CT32B0_BASE);
LPC_TMR_TypeDef * tmr32b1 = (LPC_TMR_TypeDef *)(LPC_CT32B1_BASE);
LPC_TMR_TypeDef * tmr16b0 = (LPC_TMR_TypeDef *)(LPC_CT16B0_BASE);
LPC_TMR_TypeDef * tmr16b1 = (LPC_TMR_TypeDef *)(LPC_CT16B1_BASE);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;where tmr32b0..tmr16b1 are names that I choose, so you might change them. I used this snippet for the LPC1114, so you should take a look at the LPC1769 MCU's documentation to properly set the base addresses. Timer modules (and other peripherals) are identical in both MCUs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, you call the PWM API functions this way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;MCPWM_Init(tmr32b0);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As the tmr32b0 is already a pointer, then you don't need the '&amp;amp;' operator.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 21:28:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/LPC1769-using-the-MCPWM/m-p/591525#M29634</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T21:28:31Z</dc:date>
    </item>
  </channel>
</rss>

