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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2016-03-29T21:55:43+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=30&amp;t=14944&amp;mode</id>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-29T21:55:43+01:00</updated>
<published>2016-03-29T21:55:43+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157342#p157342</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157342#p157342"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157342#p157342"><![CDATA[
<div class="quotetitle">SunRiver napisał(a):</div><div class="quotecontent"><br />zaś m8 .,... no cóż dajcie jej iść na emeryturę co<br /></div><br />Z dobrze poinformowanych źródeł wiem że to na razie ZUS blokuje - no chyba, że skrócą wiek emerytalny.  <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> <br /><br />Pozdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 29 mar 2016, o 21:55</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SunRiver]]></name></author>
<updated>2016-03-29T19:47:25+01:00</updated>
<published>2016-03-29T19:47:25+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157335#p157335</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157335#p157335"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157335#p157335"><![CDATA[
na szczescie dla kolegi Mega 48 /88 /168 /328  to ta sama zamienna rodzina dysponująca róznymi ilościami pamięci <br />i migracja w każdą stronę powinna być bezproblemowa .... i bez zmian .. (ew kosmetyka)<br />zaś m8 .,... no cóż  dajcie jej iść na emeryturę co <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=58">SunRiver</a> — 29 mar 2016, o 19:47</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-29T13:49:11+01:00</updated>
<published>2016-03-29T13:49:11+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157313#p157313</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157313#p157313"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157313#p157313"><![CDATA[
Po dokładniejszym przejrzeniu not katalogowych i porównaniu parametrów dla rejestrów wychodzi mi:<br />[syntax=c]UCSRC = 0b10000110;[/syntax]<br /><br />[syntax=c]TCCR1B = 0b11000001;<br />TIMSK = 0b00100000;<br />MCUCR = 0b00000001; /*external INT0 */<br />GICR =  0b01000000;<br />DDRB = 0b00000001;<br />PORTB = 0;<br />PORTD = 0b00000011;[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 29 mar 2016, o 13:49</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-25T22:07:45+01:00</updated>
<published>2016-03-25T22:07:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157092#p157092</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157092#p157092"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157092#p157092"><![CDATA[
<div class="quotetitle">LA72 napisał(a):</div><div class="quotecontent"><br />Okazuje się, że oryginalny kod jest jednak na Atmega88.<br /></div><br />...no ja tylko zauważyłem, że ustawiasz jakieś wirtualne rejestry o których ATm8 nigdy nawet nie słyszała  <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 25 mar 2016, o 22:07</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-25T22:00:01+01:00</updated>
<published>2016-03-25T22:00:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157091#p157091</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157091#p157091"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157091#p157091"><![CDATA[
Okazuje się, że oryginalny kod jest jednak na Atmega88.<br />Na moją prośbę autor wstawił całość.<br /><a href="http://www.elektroda.pl/rtvforum/viewtopic.php?p=15555622&amp;sid=ebceeda9acf565f25992a647e02be59a#15555622"  class="postlink">Całość</a><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 25 mar 2016, o 22:00</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-25T21:53:38+01:00</updated>
<published>2016-03-25T21:53:38+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157090#p157090</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157090#p157090"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157090#p157090"><![CDATA[
Witam<br /><div class="quotetitle">rskup napisał(a):</div><div class="quotecontent"><br />Należy wziąć w łapki datasheety dla obu procesorów i przerobić kod.<br /></div><br />Kolega słusznie zauważył, że bez not katalogowych ani rusz.<br />Ewentualną pułapką mogą być zapisy rejestrów w formie dziesiętnej lub binarnej - musisz porównać (choć <strong>raczej</strong> powinno się zgadzać ) czy kopiując dane ustawienie &quot;dłubiesz&quot; przy odpowiednich bitach, bo kompilator ani nie mruknie, daje Ci wolną rękę przy w.w.<br />Kłopot może pojawić się wtedy, gdy np. w ATm328 w którymś rejestrze pod jedynką był inny bit niż w ATm8. <br />...no chyba że się kompiluje i działa, to gratulujemy tych niezapomnianych chwil - mały krok człowieka... i takie tam  <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /> <br /><br />Pozdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 25 mar 2016, o 21:53</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-25T21:31:52+01:00</updated>
<published>2016-03-25T21:31:52+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157089#p157089</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157089#p157089"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157089#p157089"><![CDATA[
Witam.<br /><br />Po peeeewnej chwili wyszedł mi taki oto kodzik.<br />Proszę o jego sprawdzenie.<br />[syntax=c]//kod zmodernizowany dla m8/1MHz<br /><br />#include &lt;avr/io.h&gt;// include I/O definitions (port names, pin names, etc)<br />#include &lt;avr/interrupt.h&gt;// include interrupt support<br />#include &lt;util/delay.h&gt;<br />#include &quot;global.h&quot;<br /><br />u08 volatile message&#91;21&#93;;<br />u08 volatile nibble;<br />u16 volatile period;<br />u08 volatile nibble_cntr = 0;<br />u08 volatile lastbit;<br />u16 volatile ICR1tmp = 0;<br />u08 volatile preamble;<br />u08 status;<br /><br />enum global_state<br />{<br />IDLE = 0,<br />PREAMBLE_DETECTED = 1,<br />SYNC_AWAITING = 2,<br />SYNC_RECEIVING = 3,<br />DATA_RECEIVING = 4<br />};<br /><br />u08 volatile bit_cntr;<br />u08 volatile bit_cntr2;<br />u08 volatile preamble_cntr;<br />u08 volatile manchester&#91;3&#93;;<br />char volatile STATE_DECODER = IDLE;;<br /><br />void USART_Init( unsigned int ubrr_value)<br />{<br />/*Set baud rate */<br />UBRRH = (unsigned char)(ubrr_value&gt;&gt;8);<br />UBRRL = (unsigned char)ubrr_value;<br />/*Enable receiver and transmitter */<br />UCSRB = (1&lt;&lt;RXEN)|(1&lt;&lt;TXEN);<br />/* Set frame format: 8data, 2stop bit */<br />UCSRC = 0b110;<br />}<br /><br />void USARTWriteChar(char data)<br />{<br />/* Wait for empty transmit buffer */<br />while ( !( UCSRA &amp; (1&lt;&lt;UDRE)) )<br />;<br />/* Put data into buffer, sends the data */<br />UDR = data;<br />}<br /><br />char USARTReadChar()<br />{<br />/* Wait for data to be received */<br />while ( !(UCSRA &amp; (1&lt;&lt;RXC)) )<br />;<br />/* Get and return received data from buffer */<br />return UDR;<br />}<br /><br />void USARTWriteString(char *string)<br />{<br />while (*string)<br />USARTWriteChar(*string++);<br />}<br /><br />int main(void)<br />{<br />TCCR1B = 0b11000001;<br />TIMSK = 0b00100000;<br />MCUCR = 0b00000001; /*external INT0 */<br />GICR = 1;<br />DDRB = 0b00000001;<br />PORTB = 0;<br />PORTD = 0b00000011;<br /><br />USART_Init(26); <br /><br />USARTWriteString(&quot;Stacja pogodowa  \n \r&quot;);<br /><br />sei();<br /><br />while(1);<br />}<br /><br />ISR(TIMER1_CAPT_vect )<br /><br />{<br />PORTB &amp;= 0b11111110;<br />period =   ICR1 - ICR1tmp;<br />ICR1tmp = ICR1;<br /><br />if(period &gt; 800 &amp;&amp; period &lt; 1200)<br />{<br />if (STATE_DECODER == IDLE ) preamble_cntr++;<br />if (preamble_cntr&gt;17 &amp;&amp; STATE_DECODER == IDLE) {STATE_DECODER = SYNC_AWAITING; }<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr+= 2;<br />if(bit_cntr == 4)<br />bit_received();<br />if (bit_cntr2 == 4)<br />nibble_received();<br />}<br />}<br />else if(period &gt; 330 &amp;&amp; period &lt; 600)<br />{<br />if (STATE_DECODER == SYNC_AWAITING) STATE_DECODER = SYNC_RECEIVING;<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr++;<br />if(bit_cntr == 4)<br />{<br />return_to_idle();<br />}<br />}<br />}<br /><br />else <br />return_to_idle();<br />}<br /><br />ISR(INT0_vect )<br />{<br />//USARTWriteChar('A');<br />if bit_is_set(PIND, 2) lastbit = 1;<br />else lastbit = 0;<br />PORTB |= 0b00000001;<br />}<br /><br />void return_to_idle()<br />{<br />STATE_DECODER = IDLE;<br />preamble_cntr = 0;<br />bit_cntr = 0;<br />bit_cntr2 = 0;<br />nibble_cntr = 0;<br />nibble = 0;<br />}<br /><br /><br />void bit_received()<br />{<br />if(lastbit) <br />{<br />//USARTWriteChar('0');<br />}<br />else <br />{<br />//USARTWriteChar('1'); <br />nibble |= 0b10000000;<br />}<br />nibble = nibble&gt;&gt;1;<br />bit_cntr = 0;<br />bit_cntr2++;<br />}<br /><br />void nibble_received()<br />{<br />bit_cntr2 = 0;<br />//USARTWriteChar('0'+ nibble_cntr);<br />nibble = nibble&gt;&gt;3;<br />if (STATE_DECODER == SYNC_RECEIVING)<br />{<br />if (nibble != 0x0A) return_to_idle();<br />else <br />STATE_DECODER = DATA_RECEIVING;<br />}<br /><br />if (STATE_DECODER == DATA_RECEIVING)<br />{<br />message&#91;nibble_cntr&#93; = nibble;<br />nibble_cntr++;<br />if (nibble_cntr == 20) {send_temp();return_to_idle();}<br />}<br />}<br /><br />void send_temp()<br />{<br />cli();<br />u08 checksum = 0;<br />for (u08 i=1; i&lt;16; i++) checksum += message&#91;i&#93;;<br /><br />if (checksum == ((message&#91;17&#93;*16) + message&#91;16&#93;))<br />{<br /><br />if (message&#91;12&#93;==0) USARTWriteChar('+');<br />else USARTWriteChar('-');<br /><br />USARTWriteChar('0' + message&#91;11&#93;);<br />USARTWriteChar('0' + message&#91;10&#93;);<br />USARTWriteChar(',');<br />USARTWriteChar('0' + message&#91;9&#93;);<br />USARTWriteString(&quot;st. C &quot;);<br />USARTWriteChar('0' + message&#91;14&#93;);<br />USARTWriteChar('0' + message&#91;13&#93;);<br />USARTWriteString(&quot;%  &quot;);<br />USARTWriteChar('0' + message&#91;18&#93;);<br />USARTWriteChar('0' + message&#91;19&#93;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);<br />}<br />else <br />{USARTWriteString(&quot;Blad sumy kontrolnej&quot;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);}<br /><br />sei();<br />}[/syntax]<br /><br />A tutaj konsola:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />21:31:02 **** Clean-only build of configuration Release for project Oregon_czujnik_m8 ****<br />make clean <br />rm -rf  Oregon_czujnik_m8.hex  ./Oregon.o  Oregon_czujnik_m8.eep  sizedummy  Oregon_czujnik_m8.lss  ./Oregon.d  Oregon_czujnik_m8.elf<br />' '<br /><br />21:31:03 Build Finished (took 190ms)<br /><br />21:31:07 **** Incremental Build of configuration Release for project Oregon_czujnik_m8 ****<br />make all <br />'Building file: ../Oregon.c'<br />'Invoking: AVR Compiler'<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega8 -DF_CPU=1000000UL -MMD -MP -MF&quot;Oregon.d&quot; -MT&quot;Oregon.o&quot; -c -o &quot;Oregon.o&quot; &quot;../Oregon.c&quot;<br />'Finished building: ../Oregon.c'<br />' '<br />'Building target: Oregon_czujnik_m8.elf'<br />'Invoking: AVR C Linker'<br />avr-gcc -Wl,-Map,Oregon_czujnik_m8.map -mmcu=atmega8 -o &quot;Oregon_czujnik_m8.elf&quot;  ./Oregon.o   <br />'Finished building target: Oregon_czujnik_m8.elf'<br />' '<br />'Invoking: AVR Create Extended Listing'<br />avr-objdump -h -S Oregon_czujnik_m8.elf  &gt;&quot;Oregon_czujnik_m8.lss&quot;<br />'Finished building: Oregon_czujnik_m8.lss'<br />' '<br />'Create Flash image (ihex format)'<br />avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex Oregon_czujnik_m8.elf  &quot;Oregon_czujnik_m8.hex&quot;<br />'Finished building: Oregon_czujnik_m8.hex'<br />' '<br />'Create eeprom image (ihex format)'<br />avr-objcopy -j .eeprom --no-change-warnings --change-section-lma .eeprom=0 -O ihex Oregon_czujnik_m8.elf  &quot;Oregon_czujnik_m8.eep&quot;<br />'Finished building: Oregon_czujnik_m8.eep'<br />' '<br />'Invoking: Print Size'<br />avr-size --format=avr --mcu=atmega8 Oregon_czujnik_m8.elf<br />AVR Memory Usage<br />----------------<br />Device: atmega8<br /><br />Program:     908 bytes (11.1% Full)<br />(.text + .data + .bootloader)<br /><br />Data:         91 bytes (8.9% Full)<br />(.data + .bss + .noinit)<br /><br /><br />'Finished building: sizedummy'<br />' '<br /><br />21:31:08 Build Finished (took 1s.547ms)<br /></div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 25 mar 2016, o 21:31</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-25T16:20:47+01:00</updated>
<published>2016-03-25T16:20:47+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157054#p157054</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157054#p157054"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157054#p157054"><![CDATA[
Witam<br />Z tą migracją ATm8 na ATm328 to też rozważnie - mówię tylko na co należy zwracać uwagę:<br />czy docelowy uC posiada takie same rejestry co &quot;dawca&quot;.<br />Nie chodzi mi o nazwy bo te na pewno będą się różnić i nie dotyczy to dokładnie Twojego kodu, ale może się zdarzyć że &quot;biorca&quot; wogóle nie posiada interesujących Cię funkcji ( taki przykład - pomiar ADC na ATtiny2313 ).<br /><br />Pozdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 25 mar 2016, o 16:20</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-25T16:08:27+01:00</updated>
<published>2016-03-25T16:08:27+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157051#p157051</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157051#p157051"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157051#p157051"><![CDATA[
<div class="quotetitle">kicajek napisał(a):</div><div class="quotecontent"><br />Witam<br /><div class="quotetitle">rskup napisał(a):</div><div class="quotecontent">Tak to jest kod pod ATmega328P. Dla niej się kompiluje poprawnie (testując to stworzyłem wyżej załączony plik global.h).<br /></div><br />Tak, tylko że cały czas kolega testuje u siebie z prawidłowo wklejonymi poprawkami, ja tylko się domyślam, a kol.<strong>LA72</strong> wkleja coś nie patrząc co i gdzie. Z konsoli wynika że:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />info: previous declaration of 'bit_received' was here<br />void bit_received();<br /></div><br />i tak kilka razy a na koniec że coś nie tak z interpunkcją czy jak by to nazwać:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'<br />void send_temp()<br /></div><br />Może translator pomoże  <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> <br /><br />Pozdr.</div><br /><br />Małe zjobki się przydały.<br />Aktualnie kod wygląda tak:<br /><br />[syntax=c]#include &lt;avr/io.h&gt;// include I/O definitions (port names, pin names, etc)<br />#include &lt;avr/interrupt.h&gt;// include interrupt support<br />#include &lt;util/delay.h&gt;<br />#include &quot;global.h&quot;<br /><br />u08 volatile message&#91;21&#93;;<br />u08 volatile nibble;<br />u16 volatile period;<br />u08 volatile nibble_cntr = 0;<br />u08 volatile lastbit;<br />u16 volatile ICR1tmp = 0;<br />u08 volatile preamble;<br />u08 status;<br /><br /><br />enum global_state<br />{<br />IDLE = 0,<br />PREAMBLE_DETECTED = 1,<br />SYNC_AWAITING = 2,<br />SYNC_RECEIVING = 3,<br />DATA_RECEIVING = 4<br />};<br /><br />u08 volatile bit_cntr;<br />u08 volatile bit_cntr2;<br />u08 volatile preamble_cntr;<br />u08 volatile manchester&#91;3&#93;;<br /> char volatile STATE_DECODER = IDLE;;<br /><br /><br />void USART_Init( unsigned int ubrr_value)<br />{<br />/*Set baud rate */<br />UBRR0H = (unsigned char)(ubrr_value&gt;&gt;8);<br />UBRR0L = (unsigned char)ubrr_value;<br />/*Enable receiver and transmitter */<br />UCSR0B = (1&lt;&lt;RXEN0)|(1&lt;&lt;TXEN0);<br />/* Set frame format: 8data, 2stop bit */<br />UCSR0C = 0b110;<br />}<br /><br />void USARTWriteChar(char data)<br />{<br />/* Wait for empty transmit buffer */<br />while ( !( UCSR0A &amp; (1&lt;&lt;UDRE0)) )<br />;<br />/* Put data into buffer, sends the data */<br />UDR0 = data;<br />}<br /><br />char USARTReadChar()<br />{<br />/* Wait for data to be received */<br />while ( !(UCSR0A &amp; (1&lt;&lt;RXC0)) )<br />;<br />/* Get and return received data from buffer */<br />return UDR0;<br />}<br /><br />void USARTWriteString(char *string)<br />{<br /><br />while (*string)<br />USARTWriteChar(*string++);<br />}<br /><br /><br />int main(void)<br />{<br />TCCR1B = 0b11000001;<br />TIMSK1 = 0b00100000;<br />EICRA = 0b00000001; /*external INT0 */<br />EIMSK = 1;<br />DDRB = 0b00000001;<br />PORTB = 0;<br />PORTD = 0b00000011;<br /><br /><br /><br />USART_Init(26); <br /><br /><br /><br />USARTWriteString(&quot;Stacja pogodowa  \n \r&quot;);<br /><br /><br />sei();<br /><br /><br /><br />while(1);<br /><br /><br />}<br /><br />ISR(TIMER1_CAPT_vect )<br /><br />{<br />PORTB &amp;= 0b11111110;<br />period =   ICR1 - ICR1tmp;<br />ICR1tmp = ICR1;<br /><br />if(period &gt; 800 &amp;&amp; period &lt; 1200)<br />{<br />if (STATE_DECODER == IDLE ) preamble_cntr++;<br />if (preamble_cntr&gt;17 &amp;&amp; STATE_DECODER == IDLE) {STATE_DECODER = SYNC_AWAITING; }<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr+= 2;<br />if(bit_cntr == 4)<br />bit_received();<br />if (bit_cntr2 == 4)<br />nibble_received();<br />}<br />}<br />else if(period &gt; 330 &amp;&amp; period &lt; 600)<br />{<br />if (STATE_DECODER == SYNC_AWAITING) STATE_DECODER = SYNC_RECEIVING;<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr++;<br />if(bit_cntr == 4)<br />{<br />return_to_idle();<br />}<br />}<br />}<br /><br />else <br />return_to_idle();<br /><br />}<br /><br />ISR(INT0_vect )<br />{<br />//USARTWriteChar('A');<br />if bit_is_set(PIND, 2) lastbit = 1;<br />else lastbit = 0;<br />PORTB |= 0b00000001;<br /><br />}<br /><br />void return_to_idle()<br />{<br />STATE_DECODER = IDLE;<br />preamble_cntr = 0;<br />bit_cntr = 0;<br />bit_cntr2 = 0;<br />nibble_cntr = 0;<br />nibble = 0;<br />}<br /><br /><br />void bit_received()<br />{<br />if(lastbit) <br />{<br />//USARTWriteChar('0');<br />}<br />else <br />{<br />//USARTWriteChar('1'); <br />nibble |= 0b10000000;<br />}<br />nibble = nibble&gt;&gt;1;<br />bit_cntr = 0;<br />bit_cntr2++;<br />}<br /><br />void nibble_received()<br />{<br />bit_cntr2 = 0;<br />//USARTWriteChar('0'+ nibble_cntr);<br />nibble = nibble&gt;&gt;3;<br />if (STATE_DECODER == SYNC_RECEIVING)<br />{<br />if (nibble != 0x0A) return_to_idle();<br />else <br />STATE_DECODER = DATA_RECEIVING;<br /><br />}<br /><br /><br />if (STATE_DECODER == DATA_RECEIVING)<br />{<br />message&#91;nibble_cntr&#93; = nibble;<br />nibble_cntr++;<br />if (nibble_cntr == 20) {send_temp();return_to_idle();}<br />}<br /><br />}<br /><br />void send_temp()<br />{<br />cli();<br />u08 checksum = 0;<br />for (u08 i=1; i&lt;16; i++) checksum += message&#91;i&#93;;<br /><br />if (checksum == ((message&#91;17&#93;*16) + message&#91;16&#93;))<br />{<br /><br />if (message&#91;12&#93;==0) USARTWriteChar('+');<br />else USARTWriteChar('-');<br /><br />USARTWriteChar('0' + message&#91;11&#93;);<br />USARTWriteChar('0' + message&#91;10&#93;);<br />USARTWriteChar(',');<br />USARTWriteChar('0' + message&#91;9&#93;);<br />USARTWriteString(&quot;st. C &quot;);<br />USARTWriteChar('0' + message&#91;14&#93;);<br />USARTWriteChar('0' + message&#91;13&#93;);<br />USARTWriteString(&quot;%  &quot;);<br />USARTWriteChar('0' + message&#91;18&#93;);<br />USARTWriteChar('0' + message&#91;19&#93;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);<br />}<br />else <br />{USARTWriteString(&quot;Blad sumy kontrolnej&quot;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);}<br /><br /><br />sei();<br /><br />}[/syntax]<br />Plik global.h j.w.<br /><br />Całość się poprawnie skompilowała.<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />**** Build of configuration Release for project Oregon_czujnik ****<br /><br />make all <br />Building file: ../Oregon.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328 -DF_CPU=1000000UL -MMD -MP -MF&quot;Oregon.d&quot; -MT&quot;Oregon.d&quot; -c -o &quot;Oregon.o&quot; &quot;../Oregon.c&quot;<br />Finished building: ../Oregon.c<br /> <br />Building target: Oregon_czujnik.elf<br />Invoking: AVR C Linker<br />avr-gcc -Wl,-Map,Oregon_czujnik.map -mmcu=atmega328 -o &quot;Oregon_czujnik.elf&quot;  ./Oregon.o   <br />Finished building target: Oregon_czujnik.elf<br /> <br />Invoking: AVR Create Extended Listing<br />avr-objdump -h -S Oregon_czujnik.elf  &gt;&quot;Oregon_czujnik.lss&quot;<br />Finished building: Oregon_czujnik.lss<br /> <br />Create Flash image (ihex format)<br />avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex Oregon_czujnik.elf  &quot;Oregon_czujnik.hex&quot;<br />Finished building: Oregon_czujnik.hex<br /> <br />Create eeprom image (ihex format)<br />avr-objcopy -j .eeprom --no-change-warnings --change-section-lma .eeprom=0 -O ihex Oregon_czujnik.elf  &quot;Oregon_czujnik.eep&quot;<br />Finished building: Oregon_czujnik.eep<br /> <br />Invoking: Print Size<br />avr-size --format=avr --mcu=atmega328 Oregon_czujnik.elf<br />AVR Memory Usage<br />----------------<br />Device: atmega328<br /><br />Program:    1204 bytes (3.7% Full)<br />(.text + .data + .bootloader)<br /><br />Data:         91 bytes (4.4% Full)<br />(.data + .bss + .noinit)<br /><br /><br />Finished building: sizedummy<br /> <br /><br />**** Build Finished ****<br /></div><br />Teraz postaram się to przerobić na Atmega8.<br />Zapewne wrócę do wątku.<br /><br />Dziękuję za pomoc.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 25 mar 2016, o 16:08</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-25T15:48:58+01:00</updated>
<published>2016-03-25T15:48:58+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157049#p157049</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157049#p157049"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157049#p157049"><![CDATA[
Witam<br /><div class="quotetitle">rskup napisał(a):</div><div class="quotecontent"><br />Tak to jest kod pod ATmega328P. Dla niej się kompiluje poprawnie (testując to stworzyłem wyżej załączony plik global.h).<br /></div><br />Tak, tylko że cały czas kolega testuje u siebie z prawidłowo wklejonymi poprawkami, ja tylko się domyślam, a kol.<strong>LA72</strong> wkleja coś nie patrząc co i gdzie. Z konsoli wynika że:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />info: previous declaration of 'bit_received' was here<br />void bit_received();<br /></div><br />i tak kilka razy a na koniec że coś nie tak z interpunkcją czy jak by to nazwać:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'<br />void send_temp()<br /></div><br />Może translator pomoże  <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> <br /><br />Pozdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 25 mar 2016, o 15:48</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[rskup]]></name></author>
<updated>2016-03-25T13:52:12+01:00</updated>
<published>2016-03-25T13:52:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157036#p157036</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157036#p157036"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157036#p157036"><![CDATA[
Tak to jest kod pod ATmega328P. Dla niej się kompiluje poprawnie (testując to stworzyłem wyżej załączony plik global.h).<br />Przejście na ATmega8 nie będzie takie proste. Bo ona ma inaczej rozmieszczone bity i rejestry dla timerów i przerwań. A w kodzie jest używana wersja wpisywania wartości bitowej np.:<div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />[syntax=c]int main(void)<br />{<br />TCCR1B = 0b11000001;<br />TIMSK1 = 0b00100000;<br />EICRA = 0b00000001; /*external INT0 */<br />EIMSK = 1;<br />DDRB = 0b00000001;<br />PORTB = 0;<br />PORTD = 0b00000011;[/syntax]<br /></div><br />Należy wziąć w łapki datasheety dla obu procesorów i przerobić kod.<br /><br />-- <br />Pozdrawiam,<br />Robert<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3427">rskup</a> — 25 mar 2016, o 13:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-25T09:51:20+01:00</updated>
<published>2016-03-25T09:51:20+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157016#p157016</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157016#p157016"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157016#p157016"><![CDATA[
Po zmianie z Atmega8 na 328 faktycznie spadła ilość błedów.<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />------ Build started: Project: Oregon, Configuration: Release AVR ------<br />Build started.<br />Project &quot;Oregon.cproj&quot; (default targets):<br />Target &quot;PreBuildEvent&quot; skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').<br />Target &quot;CoreBuild&quot; in file &quot;C:\Program Files\Atmel\Atmel Studio 6.2\Vs\Compiler.targets&quot; from project &quot;e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.cproj&quot; (target &quot;Build&quot; depends on it):<br />Using &quot;RunCompilerTask&quot; task from assembly &quot;C:\Program Files\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll&quot;.<br />Task &quot;RunCompilerTask&quot;<br />Shell Utils Path C:\Program Files\Atmel\Atmel Studio 6.2\shellUtils<br />C:\Program Files\Atmel\Atmel Studio 6.2\shellUtils\make.exe all <br />Building file: .././Oregon.c<br />Invoking: AVR/GNU C Compiler : 4.8.1<br />&quot;C:\Program Files\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1056\avr8-gnu-toolchain\bin\avr-gcc.exe&quot;  -x c -funsigned-char -funsigned-bitfields -DNDEBUG -DF_CPU=8000000UL  -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=atmega328 -c -std=gnu99 -MD -MP -MF &quot;Oregon.d&quot; -MT&quot;Oregon.d&quot; -MT&quot;Oregon.o&quot;   -o &quot;Oregon.o&quot; &quot;.././Oregon.c&quot; <br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(155,1): warning: return type defaults to 'int' [enabled by default]<br /> bit_received()<br /> ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(155,1): warning: conflicting types for 'bit_received' [enabled by default]<br />In file included from .././Oregon.c:4:0:<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\global.h(14,6): info: previous declaration of 'bit_received' was here<br /> void bit_received();<br />      ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(171,1): warning: return type defaults to 'int' [enabled by default]<br /> nibble_received()<br /> ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(171,1): warning: conflicting types for 'nibble_received' [enabled by default]<br />In file included from .././Oregon.c:4:0:<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\global.h(15,6): info: previous declaration of 'nibble_received' was here<br /> void nibble_received();<br />      ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(194,1): warning: return type defaults to 'int' [enabled by default]<br /> send_temp()<br /> ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(194,1): warning: conflicting types for 'send_temp' [enabled by default]<br />In file included from .././Oregon.c:4:0:<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\global.h(16,6): info: previous declaration of 'send_temp' was here<br /> void send_temp();<br />      ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(228,6): error: redefinition of 'bit_received'<br /> void bit_received()<br />      ^<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(155,1): info: previous definition of 'bit_received' was here<br /> bit_received()<br /> ^<br />.././Oregon.c: In function 'bit_received':<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.c(232,1): error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'<br /> void send_temp()<br /> ^<br />make: *** [Oregon.o] Error 1<br />Done executing task &quot;RunCompilerTask&quot; -- FAILED.<br />Done building target &quot;CoreBuild&quot; in project &quot;Oregon.cproj&quot; -- FAILED.<br />Done building project &quot;Oregon.cproj&quot; -- FAILED.<br /><br />Build FAILED.<br />========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========<br /></div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 25 mar 2016, o 09:51</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kicajek]]></name></author>
<updated>2016-03-25T09:39:30+01:00</updated>
<published>2016-03-25T09:39:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157014#p157014</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157014#p157014"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157014#p157014"><![CDATA[
Witam<br />Dlatego masz &quot;undeclared'y&quot; bo to nie jest pod ATm8 tylko(chyba) pod ATm328 - wiem piszą że to pod ósemkę ale to nie pasi(porównaj noty - przecież ATm8 nie posiada takich rejestrów i dlatego kompilator sypie warningami), a to &quot;expected&quot; to masz za dużo/mało jakichś znaków.<br />Na początek, w ustawieniach zmień na ATmega328 - nie sprawdzałem, ale to chyba to.<br /><br />Pozdr.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=826">kicajek</a> — 25 mar 2016, o 09:39</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-25T07:35:42+01:00</updated>
<published>2016-03-25T07:35:42+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157006#p157006</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157006#p157006"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=157006#p157006"><![CDATA[
Witam.<br /><br />Po wstawieniu zmodyfikowanego pliku do eclipse indigo, dołożeniu global.h wyskoczyły błędy:<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />**** Build of configuration Release for project Oregon_czujnik ****<br /><br />make all <br />Building file: ../Oregon.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega8 -DF_CPU=1000000UL -MMD -MP -MF&quot;Oregon.d&quot; -MT&quot;Oregon.d&quot; -c -o &quot;Oregon.o&quot; &quot;../Oregon.c&quot;<br />../Oregon.c: In function 'USART_Init':<br />../Oregon.c:34: error: 'UBRR0H' undeclared (first use in this function)<br />../Oregon.c:34: error: (Each undeclared identifier is reported only once<br />../Oregon.c:34: error: for each function it appears in.)<br />../Oregon.c:35: error: 'UBRR0L' undeclared (first use in this function)<br />../Oregon.c:37: error: 'UCSR0B' undeclared (first use in this function)<br />../Oregon.c:37: error: 'RXEN0' undeclared (first use in this function)<br />../Oregon.c:37: error: 'TXEN0' undeclared (first use in this function)<br />../Oregon.c:39: error: 'UCSR0C' undeclared (first use in this function)<br />../Oregon.c: In function 'USARTWriteChar':<br />../Oregon.c:45: error: 'UCSR0A' undeclared (first use in this function)<br />../Oregon.c:45: error: 'UDRE0' undeclared (first use in this function)<br />../Oregon.c:48: error: 'UDR0' undeclared (first use in this function)<br />../Oregon.c: In function 'USARTReadChar':<br />../Oregon.c:54: error: 'UCSR0A' undeclared (first use in this function)<br />../Oregon.c:54: error: 'RXC0' undeclared (first use in this function)<br />../Oregon.c:57: error: 'UDR0' undeclared (first use in this function)<br />../Oregon.c: In function 'main':<br />../Oregon.c:71: error: 'TIMSK1' undeclared (first use in this function)<br />../Oregon.c:72: error: 'EICRA' undeclared (first use in this function)<br />../Oregon.c:73: error: 'EIMSK' undeclared (first use in this function)<br />../Oregon.c: At top level:<br />../Oregon.c:156: warning: return type defaults to 'int'<br />../Oregon.c:155: warning: conflicting types for 'bit_received'<br />../global.h:14: warning: previous declaration of 'bit_received' was here<br />../Oregon.c:172: warning: return type defaults to 'int'<br />../Oregon.c:171: warning: conflicting types for 'nibble_received'<br />../global.h:15: warning: previous declaration of 'nibble_received' was here<br />../Oregon.c:195: warning: return type defaults to 'int'<br />../Oregon.c:194: warning: conflicting types for 'send_temp'<br />../global.h:16: warning: previous declaration of 'send_temp' was here<br />../Oregon.c:228: error: redefinition of 'bit_received'<br />../Oregon.c:156: error: previous definition of 'bit_received' was here<br />../Oregon.c: In function 'bit_received':<br />../Oregon.c:232: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'<br />make: *** [Oregon.o] Error 1<br /><br />**** Build Finished ****<br /></div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 25 mar 2016, o 07:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[rskup]]></name></author>
<updated>2016-03-24T22:49:56+01:00</updated>
<published>2016-03-24T22:49:56+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156992#p156992</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156992#p156992"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156992#p156992"><![CDATA[
Stwórz plik global.h z następującą zawartością:<br />[syntax=c]#ifndef GLOBAL_H_<br />#define GLOBAL_H_<br /><br /><br />#define u08 uint8_t<br />#define u16 uint16_t<br /><br /><br />void USART_Init( unsigned int ubrr_value);<br />void USARTWriteChar(char data);<br />char USARTReadChar();<br />void USARTWriteString(char *string);<br />void return_to_idle();<br />void bit_received();<br />void nibble_received();<br />void send_temp();<br /><br /><br />#endif /* GLOBAL_H_ */[/syntax]<br /><br />Po jego dodaniu oraz dodaniu w załączonym przez Ciebie pliku zwracanych typów (void) dla funkcji:<br />[syntax=c]void bit_received()<br /><br />void nibble_received()<br /><br />void send_temp()[/syntax]program się kompiluje (najnowszy Atmel Toolchain pod Eclipse).<br /><br />-- <br />Pozdrawiam,<br />Robert<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3427">rskup</a> — 24 mar 2016, o 22:49</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[MirkoT]]></name></author>
<updated>2016-03-24T19:17:08+01:00</updated>
<published>2016-03-24T19:17:08+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156962#p156962</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156962#p156962"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156962#p156962"><![CDATA[
tak jak pisał kolega wyżej<br />Problemy są z plikami nagłówkowymi<br />szukaj takich plików:<br /><div class="codetitle"><b>Code:</b></div><div class="codecontent">e:\Tata\Atmel Studio\6.2\Oregon\Oregon\global.h(25,24): error: avrlibdefs.h: No such file or directory<br />#include &quot;avrlibdefs.h&quot;</div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=189">MirkoT</a> — 24 mar 2016, o 19:17</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-24T18:52:24+01:00</updated>
<published>2016-03-24T18:52:24+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156959#p156959</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156959#p156959"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156959#p156959"><![CDATA[
Niestety w projekcie nie widzę &quot;global.h&quot;.<br /><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />------ Build started: Project: Oregon, Configuration: Release AVR ------<br />Build started.<br />Project &quot;Oregon.cproj&quot; (default targets):<br />Target &quot;PreBuildEvent&quot; skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').<br />Target &quot;CoreBuild&quot; in file &quot;C:\Program Files\Atmel\Atmel Studio 6.2\Vs\Compiler.targets&quot; from project &quot;e:\Tata\Atmel Studio\6.2\Oregon\Oregon\Oregon.cproj&quot; (target &quot;Build&quot; depends on it):<br />Using &quot;RunCompilerTask&quot; task from assembly &quot;C:\Program Files\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll&quot;.<br />Task &quot;RunCompilerTask&quot;<br />Shell Utils Path C:\Program Files\Atmel\Atmel Studio 6.2\shellUtils<br />C:\Program Files\Atmel\Atmel Studio 6.2\shellUtils\make.exe all <br />Building file: .././Oregon.c<br />Invoking: AVR/GNU C Compiler : 4.8.1<br />&quot;C:\Program Files\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1056\avr8-gnu-toolchain\bin\avr-gcc.exe&quot;  -x c -funsigned-char -funsigned-bitfields -DNDEBUG -DF_CPU=8000000UL  -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=atmega8 -c -std=gnu99 -MD -MP -MF &quot;Oregon.d&quot; -MT&quot;Oregon.d&quot; -MT&quot;Oregon.o&quot;   -o &quot;Oregon.o&quot; &quot;.././Oregon.c&quot; <br />In file included from .././Oregon.c:4:0:<br />e:\Tata\Atmel Studio\6.2\Oregon\Oregon\global.h(25,24): error: avrlibdefs.h: No such file or directory<br /> #include &quot;avrlibdefs.h&quot;<br />                        ^<br />compilation terminated.<br />make: *** [Oregon.o] Error 1<br />Done executing task &quot;RunCompilerTask&quot; -- FAILED.<br />Done building target &quot;CoreBuild&quot; in project &quot;Oregon.cproj&quot; -- FAILED.<br />Done building project &quot;Oregon.cproj&quot; -- FAILED.<br /><br />Build FAILED.<br />========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========<br /></div><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 24 mar 2016, o 18:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[rskup]]></name></author>
<updated>2016-03-24T16:55:45+01:00</updated>
<published>2016-03-24T16:55:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156941#p156941</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156941#p156941"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156941#p156941"><![CDATA[
W programie masz dołączanie pliku nagłówkowego global.h. Masz go?<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />[syntax=c]#include &quot;global.h&quot;[/syntax]<br /></div><br /><br />Tak jak pisał Mirek. Pokaż błędy z okna konsoli.<br /><br />-- <br />Pozdrawiam,<br />Robert<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3427">rskup</a> — 24 mar 2016, o 16:55</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2016-03-24T12:58:12+01:00</updated>
<published>2016-03-24T12:58:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156928#p156928</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156928#p156928"/>
<title type="html"><![CDATA[Re: Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156928#p156928"><![CDATA[
Panie kolego a czymże różni się kod kompilowany pod ARV Studio albo Eclipse ? NICZYM ... musisz sobie jednak zacząć zdawać sprawę, że AVR Studio 4 albo Eclipse to są programy typu NOTEPAD.EXE rozumiesz ? zwykłe edytory tekstu tylko że każdy ma tam jakieś swoje ulepszenia i różne ... w stosunku do notatnika windołsowego<br /><br />Za to obydwa edytory czy to AVR Studio czy Eclipse korzystają z KOMPILATORA C ! .... a więc z tego samego .... i to warto zrozumieć żeby móc szybko radzić sobie samemu<br /><br />Tyle że ty w starym AVR Studio mogłeś mieć napisany kod pod starszy kompilator C czyli np pod dziadka WinAVR .... a do Eclipse być może masz podpięty najnowszy kompilator czyli Atmel Toolchain - wtedy nie dziwota ... że może być sporo błędów<br /><br />Jeśli zaś do Eclipse masz podpiętego też dziadka WinAVR to jedyna rzecz to odpowiednio rozmieścić pliki projektu w folderach itp<br /><br />Tyle że czy do jednej czy do drugiej opcji to chyba wypadałoby pokazać jakie to tam masz błędy podczas kompilacji żeby cokolwiek pomóc - nie sądzisz ? czy uważasz że lepiej abyśmy zgadywali jakie po kolei masz tam błędy?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 24 mar 2016, o 12:58</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[LA72]]></name></author>
<updated>2016-03-24T13:07:02+01:00</updated>
<published>2016-03-24T12:47:18+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156924#p156924</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156924#p156924"/>
<title type="html"><![CDATA[Kod AVR Studio 4 na Eclipse]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=14944&amp;p=156924#p156924"><![CDATA[
Witam.<br />Znajdzie się jakaś dobra duszyczka, która mogłaby przekonwertować kod  do odczytu danych z czujników Oregon.<br />Napisany został w AVR Studio 4.<br />Zainstalowałem to środowisko i w kodzie co chwile wywala mi błędy.<br />Niestety aż tak dobry nie jestem by przepisać kod w Eclipse.<br />Oprogramowanie dotyczy <a href="http://www.elektrofanklub.pl/modul-dekodera-sygnalu-z-bezprzewodowego-czujnika-temperatury/"  class="postlink">projektu</a>.<br />[syntax=c]#include &lt;avr/io.h&gt;// include I/O definitions (port names, pin names, etc)<br />#include &lt;avr/interrupt.h&gt;// include interrupt support<br />#include &lt;util/delay.h&gt;<br />#include &quot;global.h&quot;<br /><br />u08 volatile message&#91;21&#93;;<br />u08 volatile nibble;<br />u16 volatile period;<br />u08 volatile nibble_cntr = 0;<br />u08 volatile lastbit;<br />u16 volatile ICR1tmp = 0;<br />u08 volatile preamble;<br />u08 status;<br /><br />enum global_state<br />{<br />IDLE = 0,<br />PREAMBLE_DETECTED = 1,<br />SYNC_AWAITING = 2,<br />SYNC_RECEIVING = 3,<br />DATA_RECEIVING = 4<br />};<br /><br />u08 volatile bit_cntr;<br />u08 volatile bit_cntr2;<br />u08 volatile preamble_cntr;<br />u08 volatile manchester&#91;3&#93;;<br /> char volatile STATE_DECODER = IDLE;;<br /><br /><br />void USART_Init( unsigned int ubrr_value)<br />{<br />/*Set baud rate */<br />UBRR0H = (unsigned char)(ubrr_value&gt;&gt;8);<br />UBRR0L = (unsigned char)ubrr_value;<br />/*Enable receiver and transmitter */<br />UCSR0B = (1&lt;&lt;RXEN0)|(1&lt;&lt;TXEN0);<br />/* Set frame format: 8data, 2stop bit */<br />UCSR0C = 0b110;<br />}<br /><br />void USARTWriteChar(char data)<br />{<br />/* Wait for empty transmit buffer */<br />while ( !( UCSR0A &amp; (1&lt;&lt;UDRE0)) )<br />;<br />/* Put data into buffer, sends the data */<br />UDR0 = data;<br />}<br /><br />char USARTReadChar()<br />{<br />/* Wait for data to be received */<br />while ( !(UCSR0A &amp; (1&lt;&lt;RXC0)) )<br />;<br />/* Get and return received data from buffer */<br />return UDR0;<br />}<br /><br />void USARTWriteString(char *string)<br />{<br /><br />while (*string)<br />USARTWriteChar(*string++);<br />}<br /><br /><br />int main(void)<br />{<br />TCCR1B = 0b11000001;<br />TIMSK1 = 0b00100000;<br />EICRA = 0b00000001; /*external INT0 */<br />EIMSK = 1;<br />DDRB = 0b00000001;<br />PORTB = 0;<br />PORTD = 0b00000011;<br /><br /><br /><br />USART_Init(26); <br /><br /><br /><br />USARTWriteString(&quot;Stacja pogodowa  \n \r&quot;);<br /><br /><br />sei();<br /><br /><br /><br />while(1);<br /><br /><br />}<br /><br />ISR(TIMER1_CAPT_vect )<br /><br />{<br />PORTB &amp;= 0b11111110;<br />period =   ICR1 - ICR1tmp;<br />ICR1tmp = ICR1;<br /><br />if(period &gt; 800 &amp;&amp; period &lt; 1200)<br />{<br />if (STATE_DECODER == IDLE ) preamble_cntr++;<br />if (preamble_cntr&gt;17 &amp;&amp; STATE_DECODER == IDLE) {STATE_DECODER = SYNC_AWAITING; }<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr+= 2;<br />if(bit_cntr == 4)<br />bit_received();<br />if (bit_cntr2 == 4)<br />nibble_received();<br />}<br />}<br />else if(period &gt; 330 &amp;&amp; period &lt; 600)<br />{<br />if (STATE_DECODER == SYNC_AWAITING) STATE_DECODER = SYNC_RECEIVING;<br /><br />if (STATE_DECODER == SYNC_RECEIVING || STATE_DECODER == DATA_RECEIVING)<br />{<br />bit_cntr++;<br />if(bit_cntr == 4)<br />{<br />return_to_idle();<br />}<br />}<br />}<br /><br />else <br />return_to_idle();<br /><br />}<br /><br />ISR(INT0_vect )<br />{<br />//USARTWriteChar('A');<br />if bit_is_set(PIND, 2) lastbit = 1;<br />else lastbit = 0;<br />PORTB |= 0b00000001;<br /><br />}<br /><br />void return_to_idle()<br />{<br />STATE_DECODER = IDLE;<br />preamble_cntr = 0;<br />bit_cntr = 0;<br />bit_cntr2 = 0;<br />nibble_cntr = 0;<br />nibble = 0;<br />}<br /><br />bit_received()<br />{<br />if(lastbit) <br />{<br />//USARTWriteChar('0');<br />}<br />else <br />{<br />//USARTWriteChar('1'); <br />nibble |= 0b10000000;<br />}<br />nibble = nibble&gt;&gt;1;<br />bit_cntr = 0;<br />bit_cntr2++;<br />}<br /><br />nibble_received()<br />{<br />bit_cntr2 = 0;<br />//USARTWriteChar('0'+ nibble_cntr);<br />nibble = nibble&gt;&gt;3;<br />if (STATE_DECODER == SYNC_RECEIVING)<br />{<br />if (nibble != 0x0A) return_to_idle();<br />else <br />STATE_DECODER = DATA_RECEIVING;<br /><br />}<br /><br /><br />if (STATE_DECODER == DATA_RECEIVING)<br />{<br />message&#91;nibble_cntr&#93; = nibble;<br />nibble_cntr++;<br />if (nibble_cntr == 20) {send_temp();return_to_idle();}<br />}<br /><br />}<br /><br />send_temp()<br />{<br />cli();<br />u08 checksum = 0;<br />for (u08 i=1; i&lt;16; i++) checksum += message&#91;i&#93;;<br /><br />if (checksum == ((message&#91;17&#93;*16) + message&#91;16&#93;))<br />{<br /><br />if (message&#91;12&#93;==0) USARTWriteChar('+');<br />else USARTWriteChar('-');<br /><br />USARTWriteChar('0' + message&#91;11&#93;);<br />USARTWriteChar('0' + message&#91;10&#93;);<br />USARTWriteChar(',');<br />USARTWriteChar('0' + message&#91;9&#93;);<br />USARTWriteString(&quot;st. C &quot;);<br />USARTWriteChar('0' + message&#91;14&#93;);<br />USARTWriteChar('0' + message&#91;13&#93;);<br />USARTWriteString(&quot;%  &quot;);<br />USARTWriteChar('0' + message&#91;18&#93;);<br />USARTWriteChar('0' + message&#91;19&#93;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);<br />}<br />else <br />{USARTWriteString(&quot;Blad sumy kontrolnej&quot;);<br />USARTWriteChar(10);<br />USARTWriteChar(13);}<br /><br /><br />sei();<br />}[/syntax]<br /><br />Za pomoc z góry dziękuję.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=3028">LA72</a> — 24 mar 2016, o 12:47</p><hr />
]]></content>
</entry>
</feed>