<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>using pwm 1khz square wave generate with 50% duty cycle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21368/using-pwm-1khz-square-wave-generate-with-50-duty-cycle</link><description>i m new in nrf51822 controller
so help me for coding of my question.
any help will be appriciate.
thank you.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Apr 2017 08:01:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21368/using-pwm-1khz-square-wave-generate-with-50-duty-cycle" /><item><title>RE: using pwm 1khz square wave generate with 50% duty cycle</title><link>https://devzone.nordicsemi.com/thread/83717?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2017 08:01:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71517aa1-8b1c-49f2-886f-f3f1d36ef998</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/pwm_example.html?cp=4_0_1_4_5_21"&gt;PWM library example&lt;/a&gt; in the &lt;a href="https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v12.x.x/nRF5_SDK_12.2.0_f012efa.zip"&gt;SDK&lt;/a&gt;. It&amp;#39;s located in the folder &lt;code&gt;&amp;lt;SDK_InstallFolder&amp;gt;\examples\peripheral\pwm_library&lt;/code&gt;. You can get a 1kHz square wave by setting the period to 1000 us:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// 2-channel PWM as used in the example
app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(1000L, BSP_LED_0, BSP_LED_1);

// 1-channel PWM
app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_1CH(1000L, PIN_NUMBER); 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use the function app_pwm_channel_duty_set() to set the desired duty cycle:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while (app_pwm_channel_duty_set(&amp;amp;PWM1, 0, 50) == NRF_ERROR_BUSY); // 50%
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>