<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=21&amp;t=8578" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2012-10-26T12:24:00+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=21&amp;t=8578</id>
<entry>
<author><name><![CDATA[ericsonduarte]]></name></author>
<updated>2012-10-26T12:24:00+01:00</updated>
<published>2012-10-26T12:24:00+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=8578&amp;p=35981#p35981</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=8578&amp;p=35981#p35981"/>
<title type="html"><![CDATA[Setup Pin to Send InfraRed Signal]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=8578&amp;p=35981#p35981"><![CDATA[
<span style="font-weight: bold">By default, for arduino duemilanove we have:</span><br /><span style="font-style: italic">Pins 5 and 6</span>: controlled by timer0<br /><span style="font-style: italic">Pins 9 and 10</span>: controlled by timer1<br /><span style="font-style: italic">Pins 11 and </span>3: controlled by timer2<br /><br /><span style="font-weight: bold">#define IR_USE_TIMER1</span>   // tx = pin 9<br />// defines for timer1 (8 bits)<br />#if defined(IR_USE_TIMER1)<br />#define TIMER_ENABLE_PWM (TCCR1A |= _BV(COM1A1))<br />#define TIMER_DISABLE_PWM (TCCR1A &amp;= ~(_BV(COM1A1)))<br />#define TIMER_ENABLE_INTR (TIMSK1 = _BV(OCIE1A))<br />#define TIMER_DISABLE_INTR (TIMSK1 = 0)<br />#define TIMER_INTR_NAME TIMER1_COMPA_vect<br />#define TIMER_CONFIG_KHZ(val) ({ \<br />const uint16_t pwmval = SYSCLOCK / 2000 / (val); \<br />TCCR1A = _BV(WGM11); \<br />TCCR1B = _BV(WGM13) | _BV(CS10); \<br />ICR1 = pwmval; \<br />OCR1A = pwmval / 3; \<br />})<br />#define TIMER_COUNT_TOP      (SYSCLOCK * USECPERTICK / 1000000)<br />#define TIMER_PWM_PIN 9 //Arduino Duemilanove, Diecimila, LilyPad, etc<br />#endif<br /><br /><br /><span style="font-weight: bold">#define IR_USE_TIMER1</span>   // tx = pin 9<br />#if defined(IR_USE_TIMER2)<br />#define TIMER_ENABLE_PWM     (TCCR2A |= _BV(COM2B1))<br />#define TIMER_DISABLE_PWM    (TCCR2A &amp;= ~(_BV(COM2B1)))<br />#define TIMER_ENABLE_INTR    (TIMSK2 = _BV(OCIE2A))<br />#define TIMER_DISABLE_INTR   (TIMSK2 = 0)<br />#define TIMER_INTR_NAME      TIMER2_COMPA_vect<br />#define TIMER_CONFIG_KHZ(val) ({ \<br />  const uint8_t pwmval = SYSCLOCK / 2000 / (val); \<br />  TCCR2A = _BV(WGM20); \<br />  TCCR2B = _BV(WGM22) | _BV(CS20); \<br />  OCR2A = pwmval; \<br />  OCR2B = pwmval / 3; \<br />})<br />#define TIMER_COUNT_TOP      (SYSCLOCK * USECPERTICK / 1000000)<br />#define TIMER_PWM_PIN       3  //Arduino Duemilanove, Diecimila, LilyPad, etc <br />#endif<br /><span style="font-weight: bold"><br />How to setup <span style="font-style: italic">timer 0</span>, for use <span style="font-style: italic">pin 5 and 6</span>? How to setup <span style="font-style: italic">timer1</span> to use <span style="font-style: italic">pin 10</span> and <span style="font-style: italic">timer2 to use pin 11</span></span>?<br /><br />Best Regards<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=3789">ericsonduarte</a> — Fri Oct 26, 2012 12:24 pm</p><hr />
]]></content>
</entry>
</feed>