<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=4&amp;t=2839&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-04-11T20:53:21+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=2839&amp;mode</id>
<entry>
<author><name><![CDATA[Jeżyk-1]]></name></author>
<updated>2013-04-11T20:53:21+01:00</updated>
<published>2013-04-11T20:53:21+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34131#p34131</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34131#p34131"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34131#p34131"><![CDATA[
O coś takiego chodzi:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />    #include &lt;util/delay.h&gt;<br />    #include &lt;avr/interrupt.h&gt;<br /><br /><br />    volatile uint8_t pwm1;<br /><br />    int main(void)<br />    {<br /><br />            DDRB |= (1&lt;&lt;PB3);<br />            PORTB |= (1&lt;&lt;PB3);<br />            TCCR0 |= (1&lt;&lt;WGM01);<br />            TCCR0 |= (1&lt;&lt;CS00) | (1&lt;&lt;CS02);<br />            OCR0 = 200;<br />            TIMSK |= (1&lt;&lt;OCIE0);<br />            sei();<br />            return 0;<br />            while(1);<br /><br />}<br /><br />    ISR(TIMER0_COMP_vect)<br />    {<br />            static uint8_t cnt;<br />            if(cnt&gt;=120) PORTB |= (1&lt;&lt;PB3); else PORTB &amp;= ~(1&lt;&lt;PB3);<br />            cnt++;<br />    }[/syntax]<br /><br />Program był testowy by udało mi się uruchomić te obroty za pomocą timera w trybie CTC.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=493">Jeżyk-1</a> — 11 kwi 2013, o 20:53</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Paul Dirac]]></name></author>
<updated>2013-04-11T20:45:12+01:00</updated>
<published>2013-04-11T20:45:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34130#p34130</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34130#p34130"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34130#p34130"><![CDATA[
po co tak dziwnie pisać?<br /><br />Ta petla while z pwm1 = 120 po co?<br /><br />masz int main(void)- czyli cos ma zwraca ,a zwraca co ble. Daj tam return 0, daj przed while(1);<br /><br />i w przerwaniu generowanym co ilsc porównuj cnt z 120 i wtedy cos rób i tyle.<br />ISR()<br />{<br /><br />tutaj ciało i porównanie cnt z 120 i tyle)<br /><br />int main void<br />{<br />//reszta<br /><br />}<br /><br />//polecma pisac do inicjalizacji jakies biblioteki, to ulatwia sparwe, dla mnie bardzo<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1035">Paul Dirac</a> — 11 kwi 2013, o 20:45</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jeżyk-1]]></name></author>
<updated>2013-04-11T20:06:01+01:00</updated>
<published>2013-04-11T20:06:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34128#p34128</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34128#p34128"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34128#p34128"><![CDATA[
Zmieniłem na CS01, potem na CS00 i nic nie dało <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=493">Jeżyk-1</a> — 11 kwi 2013, o 20:06</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2013-04-11T20:04:55+01:00</updated>
<published>2013-04-11T20:04:55+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34127#p34127</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34127#p34127"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34127#p34127"><![CDATA[
Edytuj 1 post.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 11 kwi 2013, o 20:04</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[nixie]]></name></author>
<updated>2013-04-11T20:01:31+01:00</updated>
<published>2013-04-11T20:01:31+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34126#p34126</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34126#p34126"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34126#p34126"><![CDATA[
Zmniejsz preskaler.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=358">nixie</a> — 11 kwi 2013, o 20:01</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jeżyk-1]]></name></author>
<updated>2013-04-11T19:40:23+01:00</updated>
<published>2013-04-11T19:40:23+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34124#p34124</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34124#p34124"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34124#p34124"><![CDATA[
Poprawiłem, Nic nie pomogło <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=493">Jeżyk-1</a> — 11 kwi 2013, o 19:40</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2013-04-11T19:32:17+01:00</updated>
<published>2013-04-11T19:32:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34121#p34121</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34121#p34121"/>
<title type="html"><![CDATA[Re: Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34121#p34121"><![CDATA[
W kodzie z konfiguracją Timera 0 w trybie CTC masz OCR<strong>2</strong>.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 11 kwi 2013, o 19:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jeżyk-1]]></name></author>
<updated>2013-04-11T20:07:30+01:00</updated>
<published>2013-04-11T15:36:20+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34107#p34107</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34107#p34107"/>
<title type="html"><![CDATA[Regulacja obrotów wentylatora timerem w trybie CTC]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=2839&amp;p=34107#p34107"><![CDATA[
Witam. próbuję sterować obrotami wentylatora timerem w trybie CTC. Lecz mi nie wychodzi. W tej chwili mam regulację timera w trybie PWM i działa:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br /><br /><br />int main(void)<br />{<br /><br />DDRB |= (1&lt;&lt;PB3);<br /><br />TCCR0 |= (1 &lt;&lt; WGM01) | (1 &lt;&lt; WGM00);<br />TCCR0 |= (1 &lt;&lt; COM01) | (1 &lt;&lt; COM00);<br />TCCR0 |= (1 &lt;&lt; CS01);<br /><br />sei();<br />while(1)<br />{<br />OCR0 = 170;<br />}}[/syntax]<br /><br />A jak chcę zrobić to w trybie CTC to już to nie wychodzi:<br />[syntax=c]#include &lt;avr/io.h&gt;<br />    #include &lt;util/delay.h&gt;<br />    #include &lt;avr/interrupt.h&gt;<br /><br /><br />    volatile uint8_t pwm1;<br /><br />    int main(void)<br />    {<br /><br />            DDRB |= (1&lt;&lt;PB3);<br />            PORTB |= (1&lt;&lt;PB3);<br />            TCCR0 |= (1&lt;&lt;WGM01);<br />            TCCR0 |= (1&lt;&lt;CS00);<br />            OCR0 = 200;<br />            TIMSK |= (1&lt;&lt;OCIE0);<br />            sei();<br /><br />            while(1)<br />            {<br />            pwm1 = 120;<br />            }<br />}<br /><br />    ISR(TIMER0_COMP_vect)<br />    {<br />            static uint8_t cnt;<br />            if(cnt&gt;=pwm1) PORTB |= (1&lt;&lt;PB3); else PORTB &amp;= ~(1&lt;&lt;PB3);<br />            cnt++;<br />    }[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=493">Jeżyk-1</a> — 11 kwi 2013, o 15:36</p><hr />
]]></content>
</entry>
</feed>