<?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 24</title>
		<link>http://forums.leaflabs.com/topic.php?id=611</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:12:08 +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=611" rel="self" type="application/rss+xml" />

		<item>
			<title>Darth Maker on "PWM 24"</title>
			<link>http://forums.leaflabs.com/topic.php?id=611#post-3368</link>
			<pubDate>Fri, 14 Jan 2011 10:32:32 +0000</pubDate>
			<dc:creator>Darth Maker</dc:creator>
			<guid isPermaLink="false">3368@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Poslathian, I'll refer you too this thread:&#60;br /&#62;
&#60;a HREF=&#34;http://forums.leaflabs.com/topic.php?id=583&#34;&#62;http://forums.leaflabs.com/topic.php?id=583&#60;/a&#62;&#60;br /&#62;
I removed just the main() function from the main.cxx file, and I can then write my own.  init(); is still called, but setup() (and loop()) is not a required function.&#60;/p&#62;
&#60;p&#62;Thank you for your help MessiahAndrw, adding that code indeed worked.  (Minus the extra capital &#34;s&#34;.)  Actually, the line that made it work is the first one:&#60;/p&#62;
&#60;p&#62;Timer4.setChannel4Mode(TIMER_PWM);&#60;/p&#62;
&#60;p&#62;I'm going to take a look at the hardware files for the PWM functions and see if I can find the reason PWM24 didn't work but the others did.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "PWM 24"</title>
			<link>http://forums.leaflabs.com/topic.php?id=611#post-3366</link>
			<pubDate>Fri, 14 Jan 2011 07:04:47 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">3366@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;were you running from inside the IDE? main is already defined for you in the background when using the ide...it looks something like (much as you might expect):&#60;br /&#62;
// Force init to be called *first*, i.e. before static object allocation.&#60;br /&#62;
// Otherwise, statically allocated object that need libmaple may fail.&#60;br /&#62;
 __attribute__(( constructor )) void premain() {&#60;br /&#62;
    init();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;int main(void)&#60;br /&#62;
{&#60;br /&#62;
    setup();&#60;/p&#62;
&#60;p&#62;    while (1) {&#60;br /&#62;
        loop();&#60;br /&#62;
    }&#60;br /&#62;
    return 0;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;so you probably would have gotten a compiler error for the redefinition, so I suppose youre using libmaple from the command line...?&#60;/p&#62;
&#60;p&#62;also that other junk in main and premain, setup() and init() are important! stuff wont work without it. &#60;/p&#62;
&#60;p&#62;whats your setup like?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>MessiahAndrw on "PWM 24"</title>
			<link>http://forums.leaflabs.com/topic.php?id=611#post-3364</link>
			<pubDate>Fri, 14 Jan 2011 02:24:17 +0000</pubDate>
			<dc:creator>MessiahAndrw</dc:creator>
			<guid isPermaLink="false">3364@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Perhaps you've change or disabled timer 4 that PWM pin 24 is associated with? If not you, maybe the bootloader has?&#60;/p&#62;
&#60;p&#62;Try calling before the rest of your code:&#60;br /&#62;
&#60;code&#62;Timer4.setChannel4Mode(TIMER_PWM);&#60;br /&#62;
Timer4.setOverflow(65535);&#60;br /&#62;
Timer4.setPreScaleFactor(1);&#60;br /&#62;
Timer4.resume();&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If it works then I suspect timer 4 is used for something in the bootloader.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Darth Maker on "PWM 24"</title>
			<link>http://forums.leaflabs.com/topic.php?id=611#post-3363</link>
			<pubDate>Fri, 14 Jan 2011 00:16:04 +0000</pubDate>
			<dc:creator>Darth Maker</dc:creator>
			<guid isPermaLink="false">3363@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I didn't actually use setup() and loop(), and I didn't test it using those, but this will work the same as the code that I used.  I just had main() (and thus no setup() and loop(),) and that was the only difference.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Darth Maker on "PWM 24"</title>
			<link>http://forums.leaflabs.com/topic.php?id=611#post-3352</link>
			<pubDate>Wed, 12 Jan 2011 23:41:33 +0000</pubDate>
			<dc:creator>Darth Maker</dc:creator>
			<guid isPermaLink="false">3352@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Can someone try this code?  For some reason, pin 24 wont output PWM for me.&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;/p&#62;
&#60;p&#62;    pinMode(5, PWM);&#60;br /&#62;
    pinMode(9, PWM);&#60;br /&#62;
    pinMode(14, PWM);&#60;br /&#62;
    pinMode(24, PWM);&#60;/p&#62;
&#60;p&#62;    analogWrite(5, 0);&#60;br /&#62;
    analogWrite(9, 0);&#60;br /&#62;
    analogWrite(14, 0);&#60;br /&#62;
    analogWrite(24, 0);&#60;/p&#62;
&#60;p&#62;    analogWrite(5, 65535/2);&#60;br /&#62;
    delay(2000);&#60;br /&#62;
    analogWrite(5, 0);&#60;br /&#62;
    delay(1000);&#60;br /&#62;
    analogWrite(9, 65535/2);&#60;br /&#62;
    delay(2000);&#60;br /&#62;
    analogWrite(9, 0);&#60;br /&#62;
    analogWrite(24, 65535/2);&#60;br /&#62;
//    digitalWrite(24, HIGH);&#60;br /&#62;
    delay(2000);&#60;br /&#62;
    analogWrite(24, 0);&#60;br /&#62;
//    digitalWrite(24, LOW);&#60;br /&#62;
    delay(1000);&#60;br /&#62;
    analogWrite(14, 65535/2);&#60;br /&#62;
    delay(2000);&#60;br /&#62;
    analogWrite(14, 0);&#60;br /&#62;
    toggleLED();&#60;/p&#62;
&#60;p&#62;    while(1);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;void loop();&#60;/p&#62;
&#60;p&#62;I tested the pin with the digitalWrite(), but that worked fine.  Is there some firmware problem with PWM24?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
