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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-05-22T16:49:03+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=3154&amp;mode</id>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2013-05-22T16:49:03+01:00</updated>
<published>2013-05-22T16:49:03+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37459#p37459</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37459#p37459"/>
<title type="html"><![CDATA[Re: Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37459#p37459"><![CDATA[
<div class="quotetitle">TomZiom napisał(a):</div><div class="quotecontent"><br />Właściwie to jak na to wpadłeś?<br /></div><br />Skompilowałem to u siebie.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 22 maja 2013, o 16:49</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[TomZiom]]></name></author>
<updated>2013-05-21T20:54:36+01:00</updated>
<published>2013-05-21T20:54:36+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37431#p37431</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37431#p37431"/>
<title type="html"><![CDATA[Re: Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37431#p37431"><![CDATA[
Działa! Wielkie dzięki. Swoją drogą, błachy błąd. A takie najtrudniej znaleźć. Właściwie to jak na to wpadłeś?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1010">TomZiom</a> — 21 maja 2013, o 20:54</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[Krauser]]></name></author>
<updated>2013-05-20T18:09:30+01:00</updated>
<published>2013-05-20T18:09:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37379#p37379</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37379#p37379"/>
<title type="html"><![CDATA[Re: Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37379#p37379"><![CDATA[
Zmień nazwę zmiennej na inną niż <strong>menu</strong>, bo w pliku ir.h jest zdefiniowany taki klawisz:<br />[syntax=c]#define menu 36[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=465">Krauser</a> — 20 maja 2013, o 18:09</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[TomZiom]]></name></author>
<updated>2013-05-19T21:51:33+01:00</updated>
<published>2013-05-19T21:51:33+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37348#p37348</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37348#p37348"/>
<title type="html"><![CDATA[Re: Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37348#p37348"><![CDATA[
takie inicjalizowanie:<br /><br />[syntax=c]const menu_item menu&#91;&#93; = {<br />{{0,0,1,0,0} , NULL , T00, empty, T01, T02},<br />{{1,0,2,0,1} , NULL , T00, T01, T02, T03},<br />{{2,1,2,0,2} , NULL , T00, T02, T03, empty}<br />};[/syntax]<br /><br />Podpatrzyłem gdzieś i typowi ponoć działa.<br /><br />Zresztą taka komenda:<br /><br />const menu_item menu[3]; w funkcji int main() też daje ten sam błąd<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1010">TomZiom</a> — 19 maja 2013, o 21:51</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[TomZiom]]></name></author>
<updated>2013-05-19T19:02:05+01:00</updated>
<published>2013-05-19T19:02:05+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37334#p37334</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37334#p37334"/>
<title type="html"><![CDATA[Re: Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37334#p37334"><![CDATA[
Czemu niby źle ją inicjalizuję?<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1010">TomZiom</a> — 19 maja 2013, o 19:02</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[TomZiom]]></name></author>
<updated>2013-05-19T16:47:01+01:00</updated>
<published>2013-05-19T16:47:01+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37328#p37328</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37328#p37328"/>
<title type="html"><![CDATA[Menu na strukturach i wskaźnikach]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=3154&amp;p=37328#p37328"><![CDATA[
Witajcie koledzy. Ostatnio wziąłem się za napisanie menu wyświetlanym na LCD 4x20 dzaiłającym z pilotem na podczerwień.<br />Najpierw kody potem pytania.<br /><br />menu.h :<br />[syntax=c]/*<br /> * menu.h<br /> *<br /> *  Created on: 2013-05-17<br /> *      Author: Tomek<br /> */<br /><br />#ifndef MENU_H_<br />#define MENU_H_<br /><br />volatile unsigned char current_menu;<br />volatile unsigned char menu_event;<br /><br />// MAKRA EVENTÓW<br />#define E_IDDLE 0<br />#define E_UP 1<br />#define E_DOWN 2<br />#define E_OK 3<br />#define E_BACK 4<br /><br />void change_menu();<br /><br />#endif /* MENU_H_ */[/syntax]<br /><br />menu.c<br />[syntax=c]/*<br /> * menu.c<br /> *<br /> *  Created on: 2013-05-17<br /> *      Author: Tomek<br /> */<br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br /><br />#include &quot;menu.h&quot;<br />#include &quot;LCD/lcd.h&quot;<br /><br />volatile unsigned char current_menu = 0;<br />volatile unsigned char menu_event = E_IDDLE;<br /><br /><br />void change_menu()<br />{<br />current_menu = menu&#91;current_menu&#93;.state&#91;menu_event&#93;;<br />lcd_cls();<br />lcd_locate(0,0);<br />lcd_str_P((const char*)menu&#91;current_menu&#93;.first_line);<br />lcd_locate(1,0);<br />lcd_str_P((const char*)menu&#91;current_menu&#93;.second_line);<br />lcd_locate(2,0);<br />lcd_str_P((const char*)menu&#91;current_menu&#93;.third_line);<br />lcd_locate(3,0);<br />lcd_str_P((const char*)menu&#91;current_menu&#93;.forth_line);<br />//lcd_locate(2,0);<br />//lcd_str_P(pointer);<br />menu_event = E_IDDLE;<br />}[/syntax]<br /><br />main.c<br />[syntax=c]/*<br /> * main.c<br /> *<br /> *  Created on: 2013-05-13<br /> *      Author: Tomek<br /> */<br />#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 /><br />#include &quot;LCD/LCD.h&quot;<br />#include &quot;IR/IR.h&quot;<br />#include &quot;menu.h&quot;<br /><br />const char Tab&#91;&#93; PROGMEM = {&quot;**      MENU      **&quot;};<br /><br />const char T00&#91;&#93; PROGMEM  = {&quot;**      MENU      **&quot;};<br />const char T01&#91;&#93; PROGMEM  = {&quot;1. SNAKE GAME&quot;};<br />const char T02&#91;&#93; PROGMEM  = {&quot;2. VISUALISATIONS&quot;};<br />const char T03&#91;&#93; PROGMEM  = {&quot;3. CREDITS&quot;};<br /><br />const char T10&#91;&#93; PROGMEM  = {&quot;**   SANKE GAME   **&quot;};<br />const char T11&#91;&#93; PROGMEM  = {&quot;1. PLAY GAME&quot;};<br />const char T12&#91;&#93; PROGMEM  = {&quot;2. SETTINGS&quot;};<br />const char T13&#91;&#93; PROGMEM  = {&quot;3. HIGHSCORES&quot;};<br />const char T14&#91;&#93; PROGMEM  = {&quot;&lt;- BACK         &quot;};<br /><br />const char T20&#91;&#93; PROGMEM  = {&quot;** VISUALISATIONS **&quot;};<br />const char T21&#91;&#93; PROGMEM  = {&quot;1. V1&quot;};<br />const char T22&#91;&#93; PROGMEM  = {&quot;2. V2&quot;};<br />const char T23&#91;&#93; PROGMEM  = {&quot;3. V3&quot;};<br />const char T24&#91;&#93; PROGMEM  = {&quot;&lt;- BACK         &quot;};<br /><br />const char T30&#91;&#93; PROGMEM  = {&quot;**     CREDITS    **&quot;};<br />const char T31&#91;&#93; PROGMEM  = {&quot;    MALENDA M.  &quot;};<br />const char T32&#91;&#93; PROGMEM  = {&quot;  CHRABASZCZ P. &quot;};<br />const char T33&#91;&#93; PROGMEM  = {&quot; LAWRYNOWICZ R. &quot;};<br />const char T34&#91;&#93; PROGMEM  = {&quot;    GASIOR T.   &quot;};<br />const char T3X&#91;&#93; PROGMEM  = {&quot;################&quot;};<br /><br />const char T120&#91;&#93; PROGMEM  = {&quot;**  SETTINGS  **&quot;};<br />const char T121&#91;&#93; PROGMEM  = {&quot;1.  EASY        &quot;};<br />const char T122&#91;&#93; PROGMEM  = {&quot;2.  MEDIUM      &quot;};<br />const char T123&#91;&#93; PROGMEM  = {&quot;3.  HARD        &quot;};<br />const char T124&#91;&#93; PROGMEM  = {&quot;4.  INSANE      &quot;};<br />const char T125&#91;&#93; PROGMEM  = {&quot;&lt;- BACK         &quot;};<br /><br />const char T130&#91;&#93; PROGMEM  = {&quot;**  HIGHSCORES **&quot;};<br />const char T131&#91;&#93; PROGMEM  = {&quot;1.  0           &quot;};<br />const char T132&#91;&#93; PROGMEM  = {&quot;2.  0           &quot;};<br />const char T133&#91;&#93; PROGMEM  = {&quot;3.  0           &quot;};<br />const char T134&#91;&#93; PROGMEM  = {&quot;&lt;- BACK         &quot;};<br /><br />const char empty&#91;&#93; PROGMEM  = {&quot;                 &quot;};<br />const char arrow&#91;&#93; PROGMEM  = {&quot;-&gt;&quot;};<br /><br />typedef struct {<br />char state&#91;5&#93;;<br />void (*callback)(void);<br />const char *first_line;<br />const char *second_line;<br />const char *third_line;<br />const char *forth_line;<br />} menu_item;<br /><br /><br />const menu_item menu&#91;&#93; =<br />{<br />{{0,0,1,0,0} , 0 , T00, empty, T01, T02},<br />{{1,0,2,0,1} , 0 , T00, T01, T02, T03},<br />{{2,1,2,0,2} , 0 , T00, T02, T03, empty}<br />};<br /><br />int main (void)<br />{<br />lcd_init();<br />ir_init();<br />sei();<br />lcd_cls();<br /><br />//lcd_locate(0,0);<br />//lcd_str_P(Tab);<br />//lcd_str_P(/*(char*)menu&#91;0&#93;.first_line*/Tab);<br />//lcd_str_P((char*)menu&#91;current_menu&#93;.first_line);<br />//lcd_locate(1,0);<br />//lcd_str_P((char*)menu&#91;current_menu&#93;.second_line);<br />//lcd_locate(2,0);<br />//lcd_str_P((char*)menu&#91;current_menu&#93;.third_line);<br />//lcd_locate(3,0);<br />//lcd_str_P((char*)menu&#91;current_menu&#93;.forth_line);<br /><br />DDRD |= (1&lt;&lt;PD7);<br />PORTD |= (1&lt;&lt;PD7);<br /><br />while(1)<br />{<br />if(Ir_key_press_flag)<br />{<br />if( !address &amp;&amp; prog_down==command)<br />{<br />PORTD ^= (1&lt;&lt;PD7);<br />}<br />if (!address &amp;&amp; prog_up==command)<br />{<br />PORTD &amp;= ~(1&lt;&lt;PD7);<br />}<br />if (!address &amp;&amp; power_off==command)<br />{<br />PORTD |= (1&lt;&lt;PD7);<br />}<br /><br />Ir_key_press_flag=0;<br />command=0xff;<br />address=0xff;<br />}<br />/*if (menu_event)<br />{<br />change_menu();<br />//PORTD ^= (1&lt;&lt;PD7);<br />//_delay_ms(300);<br />}*/<br />}<br />}[/syntax]<br /><br />W tej kofiguracji wyskakują 2 błędy:<br />1. expected identifier or '(' before numeric constant (main.c)<br />2. make: ***[main.o] Error 1<br /><br />Pierwszy błąd jest w pliku main.c w linijce : &quot;const menu_item menu[] =&quot;<br /><br />Dodatkowo chciałem spytać gdzie lepiej definiować tablice charów (docelowo umieszcoznych w pamięci FLASH) w mian.c, czy menu.c czy nie ma różnicy.  I czy lepiej je definiować jako const char czy const unsigned char?<br /><br />Pozdrówki<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1010">TomZiom</a> — 19 maja 2013, o 16:47</p><hr />
]]></content>
</entry>
</feed>