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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2016-01-12T23:29:26+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=14164&amp;mode</id>
<entry>
<author><name><![CDATA[krish]]></name></author>
<updated>2016-01-12T23:29:26+01:00</updated>
<published>2016-01-12T23:29:26+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150413#p150413</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150413#p150413"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150413#p150413"><![CDATA[
Bez offtopu życie(forum) byłoby nudne.  <img src="https://forum.atnel.pl/images/smilies/icon_cool.gif" alt="8-)" title="Cool" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2273">krish</a> — 12 sty 2016, o 23:29</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2016-01-12T22:31:17+01:00</updated>
<published>2016-01-12T22:31:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150401#p150401</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150401#p150401"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150401#p150401"><![CDATA[
<div class="quotetitle">Jaglarz napisał(a):</div><div class="quotecontent"><br />Zwrot stosowany w informatyce od 1410 roku.<br /></div><br />Jagi - normalnie zaraz ci dam bana na tydzień za takie rozśmieszanie - no weź się uspokój - znowu cały monitor mam herbatką zakasłany - no nosem mi aż poszło jak przeczytałem od którego roku <img src="https://forum.atnel.pl/images/smilies/icon_lol.gif" alt=":lol:" title="Śmieje się" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 12 sty 2016, o 22:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Jaglarz]]></name></author>
<updated>2016-01-12T22:14:37+01:00</updated>
<published>2016-01-12T22:14:37+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150396#p150396</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150396#p150396"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150396#p150396"><![CDATA[
Bug czyli z angielskiego błąd w kodzie programu.<br /><br />Zwrot stosowany w informatyce od 1410 roku.  <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=471">Jaglarz</a> — 12 sty 2016, o 22:14</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[krish]]></name></author>
<updated>2016-01-12T22:11:07+01:00</updated>
<published>2016-01-12T22:11:07+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150395#p150395</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150395#p150395"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150395#p150395"><![CDATA[
Rzeka czy ...?<br />Bo rzeka to Bug a Bóg to Bóg.<br />No chyba, że to: bug (z ang. pluskwa, owad, robactwo) lub błąd w żargonie informatycznym.<br /><br />pzdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2273">krish</a> — 12 sty 2016, o 22:11</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[tomson5]]></name></author>
<updated>2016-01-12T21:31:19+01:00</updated>
<published>2016-01-12T21:31:19+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150382#p150382</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150382#p150382"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150382#p150382"><![CDATA[
Natchnąłeś mnie tym nawiasem i już sobie poradziłem.<br />Już jest OK.<br /><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />Ten cytat to na poważnie czy dla jaj? Bo jeżeli na poważnie to 2xortografia<br /></div><br /><br />Wystraszyłeś mnie tą ortografią. Staram się czysto pisać ale... <br />Gdzie te byki??<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2382">tomson5</a> — 12 sty 2016, o 21:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[krish]]></name></author>
<updated>2016-01-12T21:15:24+01:00</updated>
<published>2016-01-12T21:15:24+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150377#p150377</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150377#p150377"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150377#p150377"><![CDATA[
A spróbuj skompilować to ( trochę uporządkowane wzrokowo):<br /><br />[syntax=c]#include &lt;stdlib.h&gt;<br /> #include &lt;stdio.h&gt;<br /> #include &lt;avr/io.h&gt;<br /> #include &lt;util/delay.h&gt;<br />     <br />//deklaracje<br /><br />typedef struct<br />{<br />            volatile uint8_t *port;    //PORTx register for pin<br />            volatile uint8_t portmask; //mask for the bit in port<br />            volatile uint8_t mux;      //ADMUX value for the channel<br />        } touch_channel_t;<br />     <br />        void touch_init(void);<br />        uint16_t touch_measure(touch_channel_t *channel);<br />     <br />// funkcje - definicje<br /> <br />    void touch_init(void)<br />{<br />            ADMUX  |= (1&lt;&lt;REFS0); //reference AVCC (5v)<br />            ADCSRA |= (1&lt;&lt;ADPS2)|(1&lt;&lt;ADPS1); //clockiv 64<br />            //final clock 8MHz/64 = 125kHz<br />            ADCSRA |= (1&lt;&lt;ADEN); //enable ADC<br />        }<br />     <br />    static inline void adc_channel(uint8_t channel)<br />{<br />            ADMUX &amp;= ~(0b11111);<br />            ADMUX |=   0b11111 &amp; channel;<br />        }<br />     <br />    static inline uint16_t adc_get(void)<br />{<br />            ADCSRA |= (1&lt;&lt;ADSC); //start conversion<br />            while(!(ADCSRA &amp; (1&lt;&lt;ADIF))); //wait for conversion to finish<br />            ADCSRA |= (1&lt;&lt;ADIF); //reset the flag<br />            return ADC; //return value<br />        }<br /><br />    uint16_t touch_measure(touch_channel_t *channel)<br />{<br />            uint8_t i;<br />            uint16_t retval;<br />            retval = 0;<br />     <br />            //Do four measurements and average, just to smooth things out<br />            for (i=0 ; i&lt;4 ; i++)<br />{<br />                *(channel-&gt;port) |= channel-&gt;portmask;    // set pullup on<br />                _delay_ms(1);                             // wait (could probably be shorter)<br />                *(channel-&gt;port) &amp;= ~(channel-&gt;portmask); // set pullup off<br />                adc_channel(0b11111); //set ADC mux to ground;<br />                adc_get();            //do a measurement (to discharge the sampling cap)<br />                adc_channel(channel-&gt;mux); //set mux to right channel<br />                retval +=  adc_get(); //do a conversion<br />            }<br />            return retval /4;<br />} // IMHO tutaj nawias <br /><br /><br />    static touch_channel_t btn1 =<br />{<br />                .mux = 7,<br />                .port = &amp;PORTA,<br />                .portmask = (1&lt;&lt;PA7),<br />            };<br /><br />       //} a tutaj nie powinno być nawiasu<br /> <br />//===============================================<br />  <br />    int main(void)<br />{<br />        uint16_t sample;<br />            touch_init();<br />            for(;;)<br />{<br />                sample = touch_measure(&amp;btn1);<br />                //Do something with the sample...<br />}<br />        return 0;<br />    }[/syntax]<br />ps. po przekopiowaniu i  tak się chyba rozjechały nawiasy.<br /><br />Nie wgłębiałem się w ten kod ale:<br />-linia 39 -powinno zniknąć,<br />-reszta zniknie jeżeli ten kod w main będzie chociaż udawał przed kompilatorem, że coś robi<br /><br /><br />PS2. <br />Ten cytat to na poważnie czy dla jaj? Bo jeżeli na poważnie to 2xortografia <img src="https://forum.atnel.pl/images/smilies/icon_cool.gif" alt="8-)" title="Cool" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2273">krish</a> — 12 sty 2016, o 21:15</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[tomson5]]></name></author>
<updated>2016-01-12T20:44:01+01:00</updated>
<published>2016-01-12T20:44:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150367#p150367</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150367#p150367"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150367#p150367"><![CDATA[
Kod jest cały.<br />Znalazłem brakujący na końcu tej funkcji<br /><br />[syntax=c]uint16_t touch_measure(touch_channel_t *channel){<br />        uint8_t i;<br />        uint16_t retval;<br /><br />        retval = 0;<br /><br />        //Do four measurements and average, just to smooth things out<br />        for (i=0 ; i&lt;4 ; i++){<br />            *(channel-&gt;port) |= channel-&gt;portmask;    // set pullup on<br />            _delay_ms(1);                             // wait (could probably be shorter)<br />            *(channel-&gt;port) &amp;= ~(channel-&gt;portmask); // set pullup off<br /><br />            adc_channel(0b11111); //set ADC mux to ground;<br />            adc_get();            //do a measurement (to discharge the sampling cap)<br /><br />            adc_channel(channel-&gt;mux); //set mux to right channel<br />            retval +=  adc_get(); //do a conversion<br />        }<br /><br />        return retval /4;<br /><br />        static touch_channel_t btn1 = {<br />            .mux = 7,<br />            .port = &amp;PORTA,<br />            .portmask = (1&lt;&lt;PA7),<br />        };<br />    }  //TEN BRAKUJĄCY[/syntax]<br /><br />Wyeliminowałem w ten sposób ostatni błąd w 73 linni. Syntax error.<br /><br /><br />EDIT: Przesunąłem go w odpowiednie miejsce i chyba już jest OK.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2382">tomson5</a> — 12 sty 2016, o 20:44</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[krish]]></name></author>
<updated>2016-01-12T20:39:59+01:00</updated>
<published>2016-01-12T20:39:59+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150366#p150366</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150366#p150366"/>
<title type="html"><![CDATA[Re: Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150366#p150366"><![CDATA[
Masz pomieszane nawiasy, albo nie wkleiłeś całego kodu.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2273">krish</a> — 12 sty 2016, o 20:39</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[tomson5]]></name></author>
<updated>2016-01-12T20:30:34+01:00</updated>
<published>2016-01-12T20:30:34+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150363#p150363</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150363#p150363"/>
<title type="html"><![CDATA[Prośba o sprawdzenie kodu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14164&amp;p=150363#p150363"><![CDATA[
Witam<br />Męczę się nad kawałkiem kodu w którym kompilator zgłasza błędy i ostrzeżenia.<br /><br />[syntax=c]#include &lt;stdlib.h&gt;<br />    #include &lt;stdio.h&gt;<br />    #include &lt;avr/io.h&gt;<br />    #include &lt;util/delay.h&gt;<br /><br />    /** Holds information related to a single touch channel */<br />    typedef struct {<br />        volatile uint8_t *port;    //PORTx register for pin<br />        volatile uint8_t portmask; //mask for the bit in port<br />        volatile uint8_t mux;      //ADMUX value for the channel<br />    } touch_channel_t;<br /><br />    /**Initializing the touch sensing */<br />    void touch_init(void);<br /><br />    /**Doing a measurement */<br />    uint16_t touch_measure(touch_channel_t *channel);<br /><br />    void touch_init(void){<br />        ADMUX  |= (1&lt;&lt;REFS0); //reference AVCC (5v)<br /><br />        ADCSRA |= (1&lt;&lt;ADPS2)|(1&lt;&lt;ADPS1); //clockiv 64<br />        //final clock 8MHz/64 = 125kHz<br /><br />        ADCSRA |= (1&lt;&lt;ADEN); //enable ADC<br />    }<br /><br />    static inline void adc_channel(uint8_t channel){<br />        ADMUX &amp;= ~(0b11111);<br />        ADMUX |=   0b11111 &amp; channel;<br />    }<br /><br />    static inline uint16_t adc_get(void){<br />        ADCSRA |= (1&lt;&lt;ADSC); //start conversion<br />        while(!(ADCSRA &amp; (1&lt;&lt;ADIF))); //wait for conversion to finish<br />        ADCSRA |= (1&lt;&lt;ADIF); //reset the flag<br />        return ADC; //return value<br />    }<br />    uint16_t touch_measure(touch_channel_t *channel){<br />        uint8_t i;<br />        uint16_t retval;<br /><br />        retval = 0;<br /><br />        //Do four measurements and average, just to smooth things out<br />        for (i=0 ; i&lt;4 ; i++){<br />            *(channel-&gt;port) |= channel-&gt;portmask;    // set pullup on<br />            _delay_ms(1);                             // wait (could probably be shorter)<br />            *(channel-&gt;port) &amp;= ~(channel-&gt;portmask); // set pullup off<br /><br />            adc_channel(0b11111); //set ADC mux to ground;<br />            adc_get();            //do a measurement (to discharge the sampling cap)<br /><br />            adc_channel(channel-&gt;mux); //set mux to right channel<br />            retval +=  adc_get(); //do a conversion<br />        }<br />        return retval /4;<br /><br />        static touch_channel_t btn1 = {<br />            .mux = 7,<br />            .port = &amp;PORTA,<br />            .portmask = (1&lt;&lt;PA7),<br />        };<br />   <br />        int main(void){<br />            uint16_t sample;<br />            touch_init();<br />            for(;;){<br />                sample = touch_measure(&amp;btn1);<br />                //Do something with the sample...<br />            }<br />            return 0;<br />        }[/syntax]<br /><br />Pierwszy mam w 39 linni. No return, in function returning non-void<br />Drugi w 59 linni kodu. unused variable 'btn1' [-Wunused-variable]<br />Trzeci w 66 linni. variable 'sample' set but not used [-Wunused-but-set-variable] (tutaj wiem o co chodzi)<br />Czwarty w 69 linni. 'btn1' undeclared (first use in this function)<br />Na koniec w 73 linni syntax error<br /><br />Kod nie jest mój i nie do końca rozumiem jego działanie aby poprawić te błędy. Może ktoś ma chwilkę aby na to zerknąć.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2382">tomson5</a> — 12 sty 2016, o 20:30</p><hr />
]]></content>
</entry>
</feed>