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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-07-14T14:30:06+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=7763&amp;mode</id>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-07-14T14:30:06+01:00</updated>
<published>2014-07-14T14:30:06+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87566#p87566</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87566#p87566"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87566#p87566"><![CDATA[
panie .... ty definiujesz typ .... a miałeś dać const dla zmiennej ...<br /><br />[syntax=c]// DEFINIUJEMY TYP TCFG<br />typedef struct {<br />        uint16_t MAX;<br />        uint16_t MIN;<br />} TCFG;<br /><br />// DEFINIUJEMY ZMIENNĄ pgm_cfg typu TCFG w pamięci flash<br />const TCFG pgm_cfg PROGMEM = .....[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 lip 2014, o 14:30</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kuba]]></name></author>
<updated>2014-07-14T13:51:55+01:00</updated>
<published>2014-07-14T13:51:55+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87561#p87561</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87561#p87561"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87561#p87561"><![CDATA[
[syntax=c]const typedef struct {<br />uint16_t MAX;<br />uint16_t MIN;<br />} TCFG;[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1439">kuba</a> — 14 lip 2014, o 13:51</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-07-14T12:12:40+01:00</updated>
<published>2014-07-14T12:12:40+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87541#p87541</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87541#p87541"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87541#p87541"><![CDATA[
No to przecież podałem ci linka wyżej z którego jasno wynika że musisz tablice we flash i eeprom zaopatrzyć w specyfikator const. A wygląda że tego w ogóle nie zrobiłeś <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" /> ... i dziwisz się że masz te komunikaty ?<br /><br />pokaż jak wyglądają teraz twoje definicje tych struktur/tablic w tych pamięciach ?<br /><br />już nie wspomnę że co to np znaczy ?<br /><br />[syntax=c]__progme__[/syntax]<br /><br />??? <img src="https://forum.atnel.pl/images/smilies/icon_e_sad.gif" alt=":(" title="Smutny" />   a masz to gdzieś tam na górze w kodzie więc też spowoduje to kolejne krzaki i krzyczenie kompilatora<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 lip 2014, o 12:12</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kuba]]></name></author>
<updated>2014-07-14T11:36:01+01:00</updated>
<published>2014-07-14T11:36:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87534#p87534</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87534#p87534"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87534#p87534"><![CDATA[
[syntax=actionscript]**** Build of configuration Release for project test1 ****<br /><br />make all <br />Building file: ../MYUART/myuart.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=11059200UL -MMD -MP -MF&quot;MYUART/myuart.d&quot; -MT&quot;MYUART/myuart.d&quot; -c -o &quot;MYUART/myuart.o&quot; &quot;../MYUART/myuart.c&quot;<br />Finished building: ../MYUART/myuart.c<br /> <br />Building file: ../MK_TERMINAL/mk_term.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=11059200UL -MMD -MP -MF&quot;MK_TERMINAL/mk_term.d&quot; -MT&quot;MK_TERMINAL/mk_term.d&quot; -c -o &quot;MK_TERMINAL/mk_term.o&quot; &quot;../MK_TERMINAL/mk_term.c&quot;<br />Finished building: ../MK_TERMINAL/mk_term.c<br /> <br />Building file: ../coomon.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=11059200UL -MMD -MP -MF&quot;coomon.d&quot; -MT&quot;coomon.d&quot; -c -o &quot;coomon.o&quot; &quot;../coomon.c&quot;<br />../coomon.c: In function 'copy_eem_to_ram':<br />../coomon.c:16:3: warning: passing argument 1 of '__eerd_block_m32' discards 'const' qualifier from pointer target type &#91;enabled by default&#93;<br />c:\program files (x86)\atmel\avr tools\avr toolchain\bin\../lib/gcc/avr/4.6.2/../../../../avr/include/avr/eeprom.h:650:1: note: expected 'void *' but argument is of type 'const struct &lt;anonymous&gt; *'<br />../coomon.c: In function 'copy_ram_to_eem':<br />../coomon.c:20:2: warning: passing argument 2 of '__eewr_block_m32' discards 'const' qualifier from pointer target type &#91;enabled by default&#93;<br />c:\program files (x86)\atmel\avr tools\avr toolchain\bin\../lib/gcc/avr/4.6.2/../../../../avr/include/avr/eeprom.h:677:1: note: expected 'void *' but argument is of type 'const struct &lt;anonymous&gt; *'<br />../coomon.c: In function 'copy_pgm_to_ram':<br />../coomon.c:24:2: warning: passing argument 1 of 'memcpy_P' discards 'const' qualifier from pointer target type &#91;enabled by default&#93;<br />c:\program files (x86)\atmel\avr tools\avr toolchain\bin\../lib/gcc/avr/4.6.2/../../../../avr/include/avr/pgmspace.h:1113:14: note: expected 'void *' but argument is of type 'const struct &lt;anonymous&gt; *'<br />Finished building: ../coomon.c<br /> <br />Building file: ../main.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=11059200UL -MMD -MP -MF&quot;main.d&quot; -MT&quot;main.d&quot; -c -o &quot;main.o&quot; &quot;../main.c&quot;<br />../main.c:31:41: error: expected identifier or '(' before '=' token<br />../main.c:36:37: error: expected expression before '.' token<br />../main.c:36:47: error: expected ',' or ';' before ')' token<br />make: *** &#91;main.o&#93; Error 1<br /><br />**** Build Finished ****[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1439">kuba</a> — 14 lip 2014, o 11:36</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-07-14T11:11:42+01:00</updated>
<published>2014-07-14T11:11:42+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87531#p87531</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87531#p87531"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87531#p87531"><![CDATA[
a jaki masz błąd może napiszesz - bo coś źle musisz robić tylko ciężko powiedzieć przy tak skromnym opisie problemu<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 14 lip 2014, o 11:11</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kuba]]></name></author>
<updated>2014-07-14T09:35:32+01:00</updated>
<published>2014-07-14T09:35:32+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87528#p87528</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87528#p87528"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87528#p87528"><![CDATA[
Nie moge sobie dać rady <br />[syntax=c]eeprom_read_block ( &amp;ram_cfg, &amp;eem_cfg, sizeof(ram_cfg) );[/syntax]<br /><br />w tej funkcji ma być CONST ?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1439">kuba</a> — 14 lip 2014, o 09:35</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mirekk36]]></name></author>
<updated>2014-07-13T21:42:12+01:00</updated>
<published>2014-07-13T21:42:12+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87514#p87514</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87514#p87514"/>
<title type="html"><![CDATA[Re: EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87514#p87514"><![CDATA[
<div class="quotetitle">kuba napisał(a):</div><div class="quotecontent"><br />../coomon.h:34:13: error: variable 'pgm_cfg' must be const<br /></div><br /><br />a może by tak zaglądać na mojego bloga czasem <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /><br /><br /><!-- m --><a class="postlink" href="http://mirekk36.blogspot.com/2012/08/eclipse-kopot-z-pstr-przeczytaj.html" >http://mirekk36.blogspot.com/2012/08/ec ... zytaj.html</a><!-- m --><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=54">mirekk36</a> — 13 lip 2014, o 21:42</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[kuba]]></name></author>
<updated>2014-07-13T21:39:40+01:00</updated>
<published>2014-07-13T21:39:40+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87513#p87513</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87513#p87513"/>
<title type="html"><![CDATA[EEPROM]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=7763&amp;p=87513#p87513"><![CDATA[
Witam buduje joystick mam taki pomysł że ADC skalibruje ale jakoś nie mogę zapisać wartość do pamięci EEPROM oto komunikat i Kod źródłowy <br /><br /><br />Dziękuję za wszelką pomoc<br /><br />main.c<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;stdlib.h&gt;<br />#include &lt;avr/eeprom.h&gt;<br /><br />#include &quot;coomon.h&quot;<br />#include &quot;MYUART/myuart.h&quot;<br />#include &quot;MK_TERMINAL/mk_term.h&quot;<br /><br /><br />//******deklaracje funkcji******<br />uint16_t pomiar( uint8_t kanal );<br />void calibration(void);<br /><br />// pomocnicze zmienne<br />uint16_t min=1024, max;<br />int16_t wynik=0;<br />uint8_t key_lock;<br /><br />// inicjalizacja ustawień fabrycznych w pamięci Flash<br />const TCFG __attribute__((__progme__))  = {<br />max,<br />min,<br />};<br /><br />TCFG eem_cfg __attribute__((section(.&quot;eeprom&quot;)));// dane w pamięci EEPROM<br />TCFG ram_cfg;// dane w pamięci RAM<br /><br /><br />int main (void){<br /><br /> PORTA |= KEY1;  // podciągamy linie klawiszy do VCC<br /> DDRA |= LED_PIN;   // pin LED jako WYjście<br /><br />// inicjalizacja ADC<br />ADCSRA |= (1&lt;&lt;ADEN); // włącz ADC<br />ADCSRA |= (1&lt;&lt;ADPS2)|(1&lt;&lt;ADPS1)|(1&lt;&lt;ADPS0); // preskaler = 128<br />ADMUX |= REF_256;// ustawiamy wewn. źr odn. 2,56V<br /><br />uart_init( __UBRR );// inicjalizacja UART<br /><br />tr_cls(1);// kasuj ekran terminala - schowaj kursor<br />tr_locate(0,3);<br />tr_attr(1,YELLOW,BLACK);<br />uart_puts( &quot;ATMEGA32 TEST&quot;);<br /><br />_delay_ms(1000);<br />tr_cls(1);                             // kasuj ekran terminala - schowaj kursor<br /><br />if( !(PINA &amp; KEY1) ) calibration();<br /><br />LED_ON;<br />_delay_ms(1000);<br /><br />while(1){<br /><br />wynik = pomiar( PA0 );// dokonujemy pomiaru na kanale PA0<br />wynik = wynik - 510;<br /><br /><br /><br />tr_locate(3,10);<br />tr_attr(1,MAGENTA,BLACK);<br />uart_puts( &quot;ADC: &quot;);<br />uart_putlong( wynik, 10 );// ADC<br />uart_puts( &quot;      &quot;);<br /><br />LED_OFF;<br /><br />_delay_ms(100);<br /><br />}<br /><br />}<br /><br /><br />// pomiar napięcia<br />uint16_t pomiar( uint8_t kanal ) {<br />ADMUX = (ADMUX &amp; 0b11111000) | kanal;<br />ADCSRA |= (1&lt;&lt;ADSC);  // start konwersji<br />while( ADCSRA &amp; (1&lt;&lt;ADSC) );<br />return ADCW;<br />}<br /><br />// kalibrace<br />void calibration(void){<br />while(1){<br />wynik = pomiar( PA0 );// dokonujemy pomiaru na kanale PA0<br /><br />max = MAX(max, wynik);<br />min = MIN(min, wynik);<br /><br />tr_locate(5,10);<br />tr_attr(1,BLUE,BLACK);<br />uart_puts( &quot;MAX: &quot;);<br />uart_putlong( max, 10 );                          // wartość max<br />uart_puts( &quot;      &quot;);<br /><br />tr_locate(7,10);<br />tr_attr(1,GREEN,BLACK);<br />uart_puts( &quot;MIN: &quot;);<br />uart_putlong( min, 10 );// wartość min<br />uart_puts( &quot;      &quot;);<br />LED_TOG;<br />_delay_ms(50);<br />}<br />}[/syntax]<br /><br />coomon.c<br />[syntax=c]#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/eeprom.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br /><br />#include &quot;coomon.h&quot;<br /><br />void copy_eem_to_ram( void ) {<br />eeprom_read_block( &amp;ram_cfg, &amp;eem_cfg, sizeof(ram_cfg) );<br />}<br /><br />void copy_ram_to_eem( void ) {<br />eeprom_write_block( &amp;ram_cfg, &amp;eem_cfg, sizeof(ram_cfg) );<br />}<br /><br />void copy_pgm_to_ram( void ) {<br />memcpy_P( &amp;ram_cfg, &amp;pgm_cfg, sizeof(ram_cfg) );<br />}<br /><br />void load_defaults( void ) {<br />copy_pgm_to_ram();<br />copy_ram_to_eem();<br />}<br /><br />void check_and_load_defaults( void ) {<br />uint8_t i, len = sizeof( ram_cfg );<br />uint8_t * ram_wsk = (uint8_t*)&amp;ram_cfg;<br /><br />copy_eem_to_ram();<br />for(i=0; i&lt;len; i++) {<br />if( 0xff == *ram_wsk++ ) continue;<br />break;<br />}<br /><br />if( i == len ) {<br />load_defaults();<br />}<br /><br />}[/syntax]<br /><br />coomon.h<br />[syntax=c]#include &lt;avr/eeprom.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br /><br /><br />#ifndef COOMON_H_<br />#define COOMON_H_<br /><br />//**********definicije**********<br />#define REF_256 (1&lt;&lt;REFS1)|(1&lt;&lt;REFS0)    // definicje bitów odpowiedzialnych za wybór źródła odniesienia<br /><br />#define MAX(a,b) ( (a&gt;b)?a:b )<br />#define MIN(a,b) ( (a&lt;b)?a:b )<br /><br />#define LED_PIN (1&lt;&lt;PA1)<br />#define KEY1 (1&lt;&lt;PA7)<br />#define LED_TOG PORTA ^= LED_PIN// makrodefinicja – zmiana stanu diody<br />#define LED_ON PORTA &amp;= ~LED_PIN<br />#define LED_OFF PORTA |= LED_PIN<br /><br />#define __ATTR_PROGMEM__ __attribute__((__progmem__))<br /><br />typedef struct {<br />uint16_t MAX;<br />uint16_t MIN;<br />} TCFG;<br /><br />extern TCFG pgm_cfg PROGMEM;// dane w pamięci FLASH<br />extern TCFG eem_cfg EEMEM;// dane w pamięci EEPROM<br />extern TCFG ram_cfg;// dane w pamięci RAM<br /><br />void check_and_load_defaults( void );<br />void copy_eem_to_ram( void );<br />void copy_ram_to_eem( void );<br />void copy_pgm_to_ram( void );<br />void load_defaults( void );<br /><br />#endif /* COOMON_H_ */[/syntax]<br /><br />komunikat<br />[syntax=actionscript]**** Build of configuration Release for project test1 ****<br /><br />make all <br />Building file: ../coomon.c<br />Invoking: AVR Compiler<br />avr-gcc -Wall -Os -fpack-struct -fshort-enums -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=11059200UL -MMD -MP -MF&quot;coomon.d&quot; -MT&quot;coomon.d&quot; -c -o &quot;coomon.o&quot; &quot;../coomon.c&quot;<br />In file included from ../coomon.c:13:0:<br />../coomon.h:34:13: error: variable 'pgm_cfg' must be const in order to be put into read-only section by means of '__attribute__((progmem))'<br />make: *** &#91;coomon.o&#93; Error 1<br /><br />**** Build Finished ****[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1439">kuba</a> — 13 lip 2014, o 21:39</p><hr />
]]></content>
</entry>
</feed>