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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2015-12-29T20:07:25+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=50&amp;t=13961&amp;mode</id>
<entry>
<author><name><![CDATA[atmegowiec256]]></name></author>
<updated>2015-12-29T20:07:25+01:00</updated>
<published>2015-12-29T20:07:25+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=149100#p149100</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=149100#p149100"/>
<title type="html"><![CDATA[Re: DS18B20 oraz moduł ethernet]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=149100#p149100"><![CDATA[
Szkoda gadać, śmieszny błąd. Zmienna temperatura była w cudzysłowiu (linia 77). Od tej pory nie programuje nocami <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=11963">atmegowiec256</a> — 29 gru 2015, o 20:07</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[atmegowiec256]]></name></author>
<updated>2015-12-22T02:37:42+01:00</updated>
<published>2015-12-22T02:37:42+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=148678#p148678</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=148678#p148678"/>
<title type="html"><![CDATA[DS18B20 oraz moduł ethernet]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=13961&amp;p=148678#p148678"><![CDATA[
Witam serdecznie,<br /><br />Posiadam pytkę Arduino Uno wraz z modułem enc28j60 i dołączyłem do nich czujnik temperatury DS18B20. Połączenie z modułem mam z książki Mirka, a czujnik temperatury ze strony <!-- m --><a class="postlink" href="http://hobby.abxyz.bplaced.net/index.php?pid=4&amp;aid=8" >http://hobby.abxyz.bplaced.net/index.php?pid=4&amp;aid=8</a><!-- m -->. Nie mam żadnego błędu w kodzie, a wyświetla mi się na ekranie 0.0. Podłączenie czujnika oraz jego sprawność sprawdzałem za pomogą skryptu w programie Arduino, zatem jestem pewien, że coś jest źle w kodzie. Dodałem biblioteki libm.a oraz libprintf_flt.a wraz opcjami linkera (-WI, -lprintf_flt, -lm, -u, vfprintf), do poprawnego działanie funkcji sprintf. Proszę o pomoc. <br /><br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;stdio.h&gt;<br />#include &lt;stdint.h&gt;<br />#include &lt;stdlib.h&gt;<br />#include &lt;string.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &quot;ip_arp_udp_tcp.h&quot;<br />#include &quot;enc28j60.h&quot;<br />#include &quot;ds18b20.h&quot;<br /><br />#define F_CPU 12500000UL<br /><br /><br /><br />static uint8_t mymac&#91;6&#93; = {0x54,0x55,0x58,0x10,0x00,0x29};<br />static uint8_t myip&#91;4&#93; = {192,168,1,10};<br /><br />#define MYWWWPORT 80<br /><br />// global packet buffer<br />#define BUFFER_SIZE 550<br />static uint8_t buf&#91;BUFFER_SIZE+1&#93;;<br />/* W tablicy będą formowane komunikaty tekstowe<br />   wysyłane do wyświetlacza */<br />uint8_t opis&#91;17&#93;=&quot;   Termometr    &quot;;<br /><br /><br />// http<br />uint16_t http200ok(void)<br />{<br />        return(fill_tcp_data_p(buf,0,PSTR(&quot;HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\n\r\n&quot;)));<br />}<br /><br />// prepare the webpage by writing the data to the tcp send buffer<br />uint16_t print_webpage(uint8_t *buf)<br />{<br />        uint16_t plen;<br />        plen=http200ok();<br />        plen=fill_tcp_data_p(buf,plen,PSTR(&quot;&lt;pre&gt;&quot;));<br />        plen=fill_tcp_data_p(buf,plen,PSTR(&quot;\nWesołych Swiat !!!&quot;));<br />        plen=fill_tcp_data_p(buf,plen,PSTR(&quot;&lt;/pre&gt;\n&quot;));<br />        return(plen);<br />}<br /><br /><br /><br /><br />int main(void){<br />        uint16_t dat_p;<br /><br />        /* Zmienna przechowuje aktualną wartość temperatury */<br />                  double temperatura;<br /><br />                  /* W tablicy zapisywane będą dane odczytane z układu ds18b20 */<br />                  unsigned char ds18b20_pad&#91;9&#93;;<br /><br />        <br />        enc28j60Init(mymac);<br />      <br />        enc28j60PhyWrite(PHLCON,0x476);<br /><br />       <br />        init_udp_or_www_server(mymac,myip);<br />        www_server_port(MYWWWPORT);<br /><br /><br />        while(1){<br />            <br /><br />        dat_p=packetloop_arp_icmp_tcp(buf,enc28j60PacketReceive(BUFFER_SIZE, buf));<br /><br />if(ds18b20_ConvertT())<br />                {<br />                            _delay_ms(750);  <br />                         ds18b20_Read(ds18b20_pad);<br />                          temperatura = ((ds18b20_pad&#91;1&#93; &lt;&lt; 8) + ds18b20_pad&#91;0&#93;) ;<br />                          sprintf(opis,&quot;%4.1f\xdf&quot;&quot;C&quot;, &quot;temperatura&quot;);<br />}<br /><br /><br />                // dat_p will be unequal to zero if there is a valid  http get<br />                if(dat_p==0){<br />                        // no http request<br />                       <br />                        continue;<br />                }<br />                // tcp port 80 begin<br />                if (strncmp(&quot;GET &quot;,(char *)&amp;(buf&#91;dat_p&#93;),4)!=0){<br />                        // head, post and other methods:<br />                        dat_p=http200ok();<br />                        dat_p=fill_tcp_data_p(buf,dat_p,PSTR(&quot;&lt;h1&gt;200 OK&lt;/h1&gt;&quot;));<br />                        goto SENDTCP;<br />                }<br />                // just one web page in the &quot;root directory&quot; of the web server<br />                if (strncmp(&quot;/ &quot;,(char *)&amp;(buf&#91;dat_p+4&#93;),2)==0){<br /><br /><br /><br /><br />                dat_p=http200ok();<br />                        dat_p=print_webpage(buf);<br />                        dat_p=fill_tcp_data(buf,dat_p,opis);<br /><br />                        goto SENDTCP;<br />                }else{<br />                        dat_p=fill_tcp_data_p(buf,0,PSTR(&quot;HTTP/1.0 401 Unauthorized\r\nContent-Type: text/html\r\n\r\n&lt;h1&gt;401 Unauthorized&lt;/h1&gt;&quot;));<br />                        goto SENDTCP;<br />                }<br />SENDTCP:<br />                www_server_reply(buf,dat_p); // send web page data<br />                // tcp port 80 end<br />        }<br />        return (0);<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=11963">atmegowiec256</a> — 22 gru 2015, o 02:37</p><hr />
]]></content>
</entry>
</feed>