<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: PWM - To be sure I perfectly understand</title>
		<link>http://forums.leaflabs.com/topic.php?id=2266</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:20:17 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=2266" rel="self" type="application/rss+xml" />

		<item>
			<title>dapoup on "PWM - To be sure I perfectly understand"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2266#post-12028</link>
			<pubDate>Thu, 26 Jul 2012 16:01:38 +0000</pubDate>
			<dc:creator>dapoup</dc:creator>
			<guid isPermaLink="false">12028@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks a lot for this clear answer.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "PWM - To be sure I perfectly understand"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2266#post-12002</link>
			<pubDate>Wed, 25 Jul 2012 16:02:32 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">12002@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Note that the clock tree on the Maple is highly configurable. These answers apply only to the Maple's default clock tree configuration (which most people don't mess with).&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
1 - Prescaler : This is the division ratio applied to the timer tick clock, right?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes, that's right. So a prescaler of 1 counts at the clock speed, 2 means two clock ticks per timer counter change, etc. A prescaler of 1 counts at the max rate of 72 MHz.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
2 - Overflow : This is the value at the one you overflow, or the salue that the counter is set to when it overflows?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;It's the counter value that causes an overflow. The Maple default is for the counter to reset to zero after it overflows.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
==&#38;gt; What I understand : timer.setOverflow(65535) sets the counting to its full range, allowing the PWM to be operated in its full scale?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Not sure what you mean by &#34;full scale&#34;. But yes, setting the overflow to that value means you can set the compare to any value between 0 and 65535. 65535 (=2^16-1) is the greatest legal overflow value.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
3 - Compare : is it this buffer, in PWM mode, that stores the value to be compared to for PWM output?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes. The compare value determines the duty cycle. Specifically, the duty cycle is the ratio of the compare value to the overflow value.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>dapoup on "PWM - To be sure I perfectly understand"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2266#post-11968</link>
			<pubDate>Tue, 24 Jul 2012 09:00:14 +0000</pubDate>
			<dc:creator>dapoup</dc:creator>
			<guid isPermaLink="false">11968@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Dear all,&#60;/p&#62;
&#60;p&#62;Please find herebelow a bunch of Noob-baked questions, from a newcomer that want everything to be cristal clear before going on.&#60;/p&#62;
&#60;p&#62;I want to do 16bits PWM audio output, using the Timer #1 to do so. First, I set the pin 6 as a PWM output. That's for the sketch setup.&#60;/p&#62;
&#60;p&#62;Then, concerning the Timer Setup:&#60;/p&#62;
&#60;p&#62;1 - Prescaler : This is the division ratio applied to the timer tick clock, right?&#60;/p&#62;
&#60;p&#62;==&#38;gt; What I inderstand : timer.setPrescaleFactor(1) sets the Timer counting clock to 72Mhz? Or maybe the cristal 8Mhz?&#60;/p&#62;
&#60;p&#62;2 - Overflow : This is the value at the one you overflow, or the salue that the counter is set to when it overflows?&#60;/p&#62;
&#60;p&#62;==&#38;gt; What I understand : timer.setOverflow(65535) sets the counting to its full range, allowing the PWM to be operated in its full scale?&#60;/p&#62;
&#60;p&#62;3 - Compare : is it this buffer, in PWM mode, that stores the value to be compared to for PWM output?&#60;/p&#62;
&#60;p&#62;==&#38;gt; What I understand : timer.setChannel1Mode(TIMER_PWM)and timer.setCompare(TIMER_CH1, 32768) should generate a square wave at the output of pin 6 of the board?&#60;/p&#62;
&#60;p&#62;Thanks in advance for your kind highlights on those foggy points (at least, to me...).&#60;/p&#62;
&#60;p&#62;dapoup
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
