<?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=4179&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-09-14T18:31:17+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=4179&amp;mode</id>
<entry>
<author><name><![CDATA[fredek]]></name></author>
<updated>2013-09-14T18:31:17+01:00</updated>
<published>2013-09-14T18:31:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49616#p49616</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49616#p49616"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49616#p49616"><![CDATA[
Wygląda, że kod barney-a działa, na przyszłość proponuję dokładniej formułować pytanie <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=919">fredek</a> — 14 wrz 2013, o 18:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[barney]]></name></author>
<updated>2013-09-14T18:28:44+01:00</updated>
<published>2013-09-14T18:28:44+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49615#p49615</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49615#p49615"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49615#p49615"><![CDATA[
[syntax=c]u32 bit_destuffing (u32 input)<br />{// Autor: barney<br />u32 ret=0;<br />u08 bit_state=input&gt;&gt;31;<br />u08 bit_counter=1;<br /><br />for (s08 x=31; x&gt;=0; x--)<br />{<br />ret=(ret&lt;&lt;1)|((input&gt;&gt;x)&amp;0b1);<br /><br />if (((input&gt;&gt;x)&amp;0b1)==bit_state)<br />{<br />if (++bit_counter==5)<br />{<br />bit_counter=0;<br />x--;<br />}<br />}<br />else<br />{<br />bit_counter=1;<br />bit_state^=0b1;<br />}<br />}<br /><br />return ret;<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=973">barney</a> — 14 wrz 2013, o 18:28</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T18:26:46+01:00</updated>
<published>2013-09-14T18:26:46+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49614#p49614</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49614#p49614"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49614#p49614"><![CDATA[
Wykrywa 5 jedynek i 5 zer po czym dodaje po nich bit o przeciwnej wartości.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=760">jrq</a> — 14 wrz 2013, o 18:26</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fredek]]></name></author>
<updated>2013-09-14T18:19:35+01:00</updated>
<published>2013-09-14T18:19:35+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49611#p49611</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49611#p49611"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49611#p49611"><![CDATA[
A algorytm bit stuffingu jak jest 00000101 to dokleja jedynkę czyli robi 000001101?<br />Czy on przy kodowaniu wykrywa tylko 5 jedynek a 5 zer ignoruje?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=919">fredek</a> — 14 wrz 2013, o 18:19</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T18:00:17+01:00</updated>
<published>2013-09-14T18:00:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49605#p49605</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49605#p49605"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49605#p49605"><![CDATA[
Tak, tylko ta funkcja ma dekodować wysłane dane z bit stuffingiem, czyli usuwać dodatkowe bity.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=760">jrq</a> — 14 wrz 2013, o 18:00</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fredek]]></name></author>
<updated>2013-09-14T17:57:33+01:00</updated>
<published>2013-09-14T17:57:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49603#p49603</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49603#p49603"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49603#p49603"><![CDATA[
To ma być taki algorytm jak opisany tu: <!-- m --><a class="postlink" href="http://skowronski.biz.pl/index.php?option=com_content&amp;view=article&amp;id=51&amp;Itemid=87" >http://skowronski.biz.pl/index.php?opti ... &amp;Itemid=87</a><!-- m --> ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=919">fredek</a> — 14 wrz 2013, o 17:57</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T17:52:50+01:00</updated>
<published>2013-09-14T17:52:50+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49602#p49602</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49602#p49602"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49602#p49602"><![CDATA[
W porządku wyrzuciłem GOTO, ten sam problem dalej występuje w tej samej formie.<br />Gdzie może leżeć błąd?<br /><br />[syntax=c]uint8_t licz=31<br />uint32_t cos=0b00101000100111010111100001110100;<br />USART_Init(__UBRR);<br />sei();<br />cos=funkcja(cos);<br /> <br />uint32_t funkcja(uint32_t data)<br />{<br />        uint32_t pomoc=0;<br />        uint8_t  zero=0;<br />        uint8_t  jeden=0;<br />        uint8_t j=31;<br />        while(licz){<br /> <br />                <br />                if(data &amp; (1&lt;&lt;j))<br />                {<br />                        jeden++;<br />                        zero=0;<br />                        if(jeden==5)<br />                        {<br />                                jeden=0;<br />                                j--;<br />                                pomoc |= (1&lt;&lt;0);                    <br />                        }<br />                        pomoc |= (1&lt;&lt;0);<br />                }<br />                else<br />                {<br />                    zero++;<br />                    jeden=0;<br />                        if(zero==5)<br />                        {<br />                               zero=0;<br />                                j--;<br />                                pomoc = pomoc &lt;&lt; 1;<br />                           <br />                }<br />                                }<br /> <br />                pomoc = pomoc &lt;&lt; 1;<br />                j--;<br />                licz--;<br />                uart_putint(pomoc,16);<br />                uart_puts(&quot;\n&quot;);<br />}<br />        return pomoc;<br /> <br /> <br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=760">jrq</a> — 14 wrz 2013, o 17:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Ledes]]></name></author>
<updated>2013-09-14T17:45:20+01:00</updated>
<published>2013-09-14T17:45:20+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49601#p49601</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49601#p49601"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49601#p49601"><![CDATA[
Używanie GOTO to najprostszy sposób aby narobić sobie kłopotów.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=355">Ledes</a> — 14 wrz 2013, o 17:45</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2013-09-14T17:36:38+01:00</updated>
<published>2013-09-14T17:36:38+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49598#p49598</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49598#p49598"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49598#p49598"><![CDATA[
Podstawowy i jeden z poważniejszych problemów używania GOTO jest fakt, że kod jest mega nieczytelny i plączesz się w tym nie tylko ty sam ale szczególnie osoby, którym zachciałoby się to analizować <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /><br /><br />Założę się o nie wiem co, że jak to napiszesz normalnie to wszystko zacznie ci działać. A bez goto - NIC podkreślam NIC nie straci na szybkości czy jakimś tam wydumanym wyczekiwaniu ... więc bez obaw.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 wrz 2013, o 17:36</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T17:38:45+01:00</updated>
<published>2013-09-14T17:33:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49597#p49597</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49597#p49597"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49597#p49597"><![CDATA[
staram się jak moge ale ma być to szybki kod do bit stuffingu i ma on działać jak najszybciej bez wyczekiwania, moge spróbować to zamienić jakoś na break; <br />Czy widzicie gdzieś problem? Dlaczego moze to w eclipse nie działać?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=760">jrq</a> — 14 wrz 2013, o 17:33</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2013-09-14T17:31:26+01:00</updated>
<published>2013-09-14T17:31:26+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49596#p49596</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49596#p49596"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49596#p49596"><![CDATA[
O Matko jedyna nawet nie zauważyłem GOTO <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> .... kolego postaraj się zapomnieć o tej instrukcji w C na całe życie a szczególnie przy takim pisaniu kodu - to jest droga wprost w przepaść, strzał w kolano, samobój <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> poważnie ci mówię<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 wrz 2013, o 17:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T17:31:43+01:00</updated>
<published>2013-09-14T17:21:46+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49592#p49592</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49592#p49592"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49592#p49592"><![CDATA[
tylko te dwa z licz-- wywołują sie po 5 kolejnych takich samych wartościach i odrazu jest skok goto, więc w żadnej pętli nie wywołane jest licz-- dwukrotnie<br /><br />rozumiem, mój bląd w sformułowaniu ale taki sam algorytm: <br /><br />[syntax=c]#include &lt;stdio.h&gt;<br />#include &lt;stdlib.h&gt;<br />#include &lt;conio.h&gt;<br />#include &lt;inttypes.h&gt;<br />uint32_t funkcja(uint32_t licznik);<br />uint8_t    licz=31;<br />int main(void)<br />{<br />    uint32_t cos=0b00101001100111110111100000110100;<br />    cos=bit_stuffing(cos);<br />}<br />uint32_t funkcja(uint32_t licznik)<br />{<br />uint32_t pomoc=0;<br />uint8_t  zero=0;<br />uint8_t  jeden=0;<br />uint8_t j=31;<br />while(licz){<br /><br />A:<br />if(licznik &amp; (1&lt;&lt;j))<br />{<br />jeden++;<br />zero=0;<br />if(jeden==5)<br />{<br />jeden=0;<br />j=j-2;<br />pomoc |= (1&lt;&lt;0);<br />pomoc = pomoc &lt;&lt; 1;<br />licz--;<br />goto A;<br />}<br />pomoc |= (1&lt;&lt;0);<br /><br /><br />}<br />else<br />{<br />    zero++;<br />            jeden=0;<br />if(zero==5)<br />{<br />                zero=0;<br />j=j-2;<br />pomoc = pomoc &lt;&lt; 1;<br />licz--;<br />goto A;<br />}<br />}<br /><br />pomoc = pomoc &lt;&lt; 1;<br />j--;<br />licz--;<br />printf(&quot;%d\n&quot;,pomoc);<br />}<br />return pomoc;<br /><br /><br />}[/syntax]<br /><br />w edytorze CodeBlocks działa poprawnie, nie wiem dlaczego problem jest w eclipse <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=760">jrq</a> — 14 wrz 2013, o 17:21</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2013-09-14T17:21:19+01:00</updated>
<published>2013-09-14T17:21:19+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49591#p49591</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49591#p49591"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49591#p49591"><![CDATA[
<div class="quotetitle">jrq napisał(a):</div><div class="quotecontent"><br />Próbowałem ten sam algorytm użyć w programie CodeBlock i wszystko dobrze działało<br /></div><br /><br />A dla ciebie codeblocks, eclipse czy atmelstudio to są kompilatory ?<br /><br />trzeba zrozumieć przede wszystkim, że to są EDYTORY, a kompilatora używasz tego samego AVR GCC<br /><br />więc nie może być różnicy w wykonywaniu się kodu pomiędzy EDYTORAMI. Prędzej spójrz na błędy w kodzie - kolega wyżej podpowiada miejsca.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 wrz 2013, o 17:21</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[fredek]]></name></author>
<updated>2013-09-14T17:17:36+01:00</updated>
<published>2013-09-14T17:17:36+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49589#p49589</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49589#p49589"/>
<title type="html"><![CDATA[Re: Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49589#p49589"><![CDATA[
Masz &quot;licz--;&quot; w linii 26, 42 i 46... trochę ich za dużo <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=919">fredek</a> — 14 wrz 2013, o 17:17</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[jrq]]></name></author>
<updated>2013-09-14T16:54:34+01:00</updated>
<published>2013-09-14T16:54:34+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49587#p49587</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49587#p49587"/>
<title type="html"><![CDATA[Przesuniecia bitowe, problem]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4179&amp;p=49587#p49587"><![CDATA[
[syntax=c]uint8_t licz=31<br />uint32_t cos=0b00101000100111010111100001110100;<br />USART_Init(__UBRR);<br />sei();<br />cos=funkcja(cos);<br /><br />uint32_t funkcja(uint32_t data)<br />{<br />uint32_t pomoc=0;<br />uint8_t  zero=0;<br />uint8_t  jeden=0;<br />uint8_t j=31;<br />while(licz){<br /><br />A:<br />if(data &amp; (1&lt;&lt;j))<br />{<br />jeden++;<br />zero=0;<br />if(jeden==5)<br />{<br />jeden=0;<br />j=j-2;<br />pomoc |= (1&lt;&lt;0);<br />pomoc = pomoc &lt;&lt; 1;<br />licz--;<br />goto A;<br />}<br />pomoc |= (1&lt;&lt;0);<br /><br /><br />}<br />else<br />{<br />    zero++;<br />                    jeden=0;<br />if(zero==5)<br />{<br />                               zero=0;<br />j=j-2;<br />pomoc = pomoc &lt;&lt; 1;<br />licz--;<br />goto A;<br />}<br />}<br /><br />pomoc = pomoc &lt;&lt; 1;<br />j--;<br />licz--;<br />uart_putint(pomoc,16);<br />uart_puts(&quot;\n&quot;);<br />}<br />return pomoc;<br /><br /><br />}[/syntax]<br /><br />uart wypisuje mi 15 wartości zmiennej &quot;pomoc&quot; po czym kończy się pętla, nie rozumiem dlaczego petla nie wywoluje się 31 razy i zmienna &quot;pomoc&quot; nie zapisuje całej wartości zmiennej &quot;cos&quot;. Wartość końcowa to pomoc to 111110001110100.<br />Próbowałem ten sam algorytm użyć w programie CodeBlock i wszystko dobrze działało.<br />Gdzie leży problem ? <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=760">jrq</a> — 14 wrz 2013, o 16:54</p><hr />
]]></content>
</entry>
</feed>