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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2014-11-19T19:10:54+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=15&amp;t=9321&amp;mode</id>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-19T19:10:54+01:00</updated>
<published>2014-11-19T19:10:54+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104970#p104970</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104970#p104970"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104970#p104970"><![CDATA[
<div class="quotetitle">Antystatyczny napisał(a):</div><div class="quotecontent"><br />Kurczaki...tego nie zauważyłem...<br /></div><br /><br />Ja też nie - głównodowodzący pomógł.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 19 lis 2014, o 19:10</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-19T14:12:45+01:00</updated>
<published>2014-11-19T14:12:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104886#p104886</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104886#p104886"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104886#p104886"><![CDATA[
Błąd znaleziony - maskowanie klawiszy<br /><br />Nie PORTA0 w<br />[syntax=c]SuperDebounce(&amp;k1, &amp;PINA, PORTA0, 10, 200, led, led2 );[/syntax]<br />tylko <br />[syntax=c]define KL1 (1&lt;&lt;PORTA)[/syntax]<br />1<br />[syntax=c]SuperDebounce(&amp;k1, &amp;PINA, KL1, 10, 200, led, led2 );[/syntax]<br />lub<br />[syntax=c]SuperDebounce(&amp;k1, &amp;PINA, (1&lt;&lt;PORTA0), 10, 200, led, led2 );[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 19 lis 2014, o 14:12</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[majster]]></name></author>
<updated>2014-11-19T07:04:36+01:00</updated>
<published>2014-11-19T07:04:36+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104848#p104848</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104848#p104848"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104848#p104848"><![CDATA[
No ok a teraz przeanalizuj pierwszego if i pomyśl przez chwilkę.<br /><br /><br />Namazane ze smarta.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1628">majster</a> — 19 lis 2014, o 07:04</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T23:33:19+01:00</updated>
<published>2014-11-18T23:33:19+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104829#p104829</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104829#p104829"/>
<title type="html"><![CDATA[Re: Odp:]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104829#p104829"><![CDATA[
<div class="quotetitle">majster napisał(a):</div><div class="quotecontent"><br /><div class="quotetitle">mickeu napisał(a):</div><div class="quotecontent"><br />void led(void){<br />PORTA ^= (1&lt;&lt;PORTA5);<br />PORTA |= (1&lt;&lt;PORTA7);<br />_delay_ms(100);<br />PORTA &amp;= ~(1&lt;&lt;PORTA7);<br /></div></div><br /><br />A co to ?<br /><br />Powinno być PORTA ^= (1&lt;&lt;PA5);<br /><br />portpins.h<br />[syntax=c]/* PORT A */<br /><br />#if defined(PA0) &amp;&amp; !defined(PORTA0)<br />#  define PORTA0 PA0<br />#elif defined(PORTA0) &amp;&amp; !defined(PA0)<br />#  define PA0 PORTA0<br />#endif<br />#if defined(PA1) &amp;&amp; !defined(PORTA1)<br />#  define PORTA1 PA1<br />#elif defined(PORTA1) &amp;&amp; !defined(PA1)<br />#  define PA1 PORTA1<br />#endif<br />#if defined(PA2) &amp;&amp; !defined(PORTA2)<br />#  define PORTA2 PA2<br />#elif defined(PORTA2) &amp;&amp; !defined(PA2)<br />#  define PA2 PORTA2<br />#endif<br />#if defined(PA3) &amp;&amp; !defined(PORTA3)<br />#  define PORTA3 PA3<br />#elif defined(PORTA3) &amp;&amp; !defined(PA3)<br />#  define PA3 PORTA3<br />#endif<br />#if defined(PA4) &amp;&amp; !defined(PORTA4)<br />#  define PORTA4 PA4<br />#elif defined(PORTA4) &amp;&amp; !defined(PA4)<br />#  define PA4 PORTA4<br />#endif<br />#if defined(PA5) &amp;&amp; !defined(PORTA5)<br />#  define PORTA5 PA5<br />#elif defined(PORTA5) &amp;&amp; !defined(PA5)<br />#  define PA5 PORTA5<br />#endif<br />#if defined(PA6) &amp;&amp; !defined(PORTA6)<br />#  define PORTA6 PA6<br />#elif defined(PORTA6) &amp;&amp; !defined(PA6)<br />#  define PA6 PORTA6<br />#endif<br />#if defined(PA7) &amp;&amp; !defined(PORTA7)<br />#  define PORTA7 PA7<br />#elif defined(PORTA7) &amp;&amp; !defined(PA7)<br />#  define PA7 PORTA7<br />#endif[/syntax]<br /><br />to jest z eclipse <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><br /><br />Jtag wyłączony<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 23:33</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[majster]]></name></author>
<updated>2014-11-18T23:19:58+01:00</updated>
<published>2014-11-18T23:19:58+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104828#p104828</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104828#p104828"/>
<title type="html"><![CDATA[Re: Odp: "adresowanie" portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104828#p104828"><![CDATA[
<div class="quotetitle">mickeu napisał(a):</div><div class="quotecontent"><br />void led(void){<br />PORTA ^= (1&lt;&lt;PORTA5);<br />PORTA |= (1&lt;&lt;PORTA7);<br />_delay_ms(100);<br />PORTA &amp;= ~(1&lt;&lt;PORTA7);<br /></div><br /><br />A co to ?<br /><br />Powinno być PORTA ^= (1&lt;&lt;PA5);<br /><br />itd<br /><br />Po za tym wyłącz jtag jak masz włączony.<br /><br />Namazane ze smarta.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1628">majster</a> — 18 lis 2014, o 23:19</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T23:08:31+01:00</updated>
<published>2014-11-18T23:08:31+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104825#p104825</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104825#p104825"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104825#p104825"><![CDATA[
<div class="quotetitle">Antystatyczny napisał(a):</div><div class="quotecontent"><br />No to jeśli sobie posprawdzałes prostym kodem, że sprzęt  odzywa się poprawnie, to  pozostaje wina kodu. Kombinowałeś już z tymi zmiennymi k1 i k2?<br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 1 minucie ]</span></strong><br /><br />Aha, sama funkcja superdebounce jest do bólu sprawna. Trzeba jedynie pamiętać, że dla każdego klawisza musi być oddzielna zmienna &quot;trzymająca władzę&quot; czyli aktualny stan.<br /></div><br /><br />Tak, przeniosłem je też nad main, tak samo jak i superdebounce... wciąż to samo. zaczyna szleć po wejsciu w pętle while(1)<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 23:08</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T22:30:11+01:00</updated>
<published>2014-11-18T22:30:11+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104805#p104805</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104805#p104805"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104805#p104805"><![CDATA[
<div class="quotetitle">Antystatyczny napisał(a):</div><div class="quotecontent"><br />Ok, teraz wkleiłeś więcej kodu i widać. Pamiętam, że miałem podobny problem i przeniesienie  zmiennych zapamiętujących stan klawiszy  do pliku main.c  tuż przed  funkcją main()  natychmiast rozwiązało problem. Kiedyś o to nawet pytałem tu na forum. Widzę, że je masz w common.h,  wystawione poza moduł, więc teoretycznie powinno być dobrze...<br /><br /><strong><span style="color: #808000">------------------------ [ Dodano po: 5 minutach ]</span></strong><br /><br />Oczywiście  wyjmowałeś mikrokontroler i sprawdzałeś multimetrem poprawność działania  przycisków, brak zwarć pomiędzy nimi, obecność zasilania na AVCC itd... Choć z drugiej strony, jeśli to fabryczny moduł, to powinien działac poprawnie.<br /></div><br /><br />Tak wzystko na liniach zostało rozpięte i &quot;przedzwonione&quot; brak zwarć czy też przerw a połączeniach.<br /><br />Co dziwniejsze normalna funkcja:<br /><br />if(!(PINA &amp; (1&lt;&lt;PINA0))){<br />led();<br />}<br /><br />Działa bez problemu - pewnie coś w Superdebounce zawala sprawe.<br />Powyłączałem nawet wszystkie inne moduły in includy i dalej to samo.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 22:30</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T21:52:51+01:00</updated>
<published>2014-11-18T21:52:51+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104784#p104784</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104784#p104784"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104784#p104784"><![CDATA[
<div class="quotetitle">Antystatyczny napisał(a):</div><div class="quotecontent"><br />Może się mylę, ale nie widzę nigdzie zmiennych przechowujących aktualny stan klawiszy.<br /></div><br /><br />są w common.h<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 21:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T21:32:13+01:00</updated>
<published>2014-11-18T21:32:13+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104774#p104774</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104774#p104774"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104774#p104774"><![CDATA[
<div class="quotetitle">leonos2000 napisał(a):</div><div class="quotecontent"><br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"> DDRD &amp;= ~((1&lt;&lt;PORTA0)|(1&lt;&lt;PORTA1)|(1&lt;&lt;PORTA2)|(1&lt;&lt;PORTA3)|(1&lt;&lt;PORTA4));         //wejscia<br /></div><br />Piszesz najpierw DDRD a potem PORTA, musi być albo A albo D.</div><br /><br />To z ostatniej próby zamiany portu - poprawiłem i nadal to samo.<br />Po za tym DDRx i tak jest inicjowane jako 0 w całym porcie na starcie o ile nie zadeklarowane inaczej wiec bez różnicy.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 21:32</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[leonos2000]]></name></author>
<updated>2014-11-18T21:30:22+01:00</updated>
<published>2014-11-18T21:30:22+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104773#p104773</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104773#p104773"/>
<title type="html"><![CDATA[Re: &quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104773#p104773"><![CDATA[
<div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />DDRD &amp;= ~((1&lt;&lt;PORTA0)|(1&lt;&lt;PORTA1)|(1&lt;&lt;PORTA2)|(1&lt;&lt;PORTA3)|(1&lt;&lt;PORTA4));         //wejscia<br /></div><br />Piszesz najpierw DDRD a potem PORTA, musi być albo A albo D.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=4851">leonos2000</a> — 18 lis 2014, o 21:30</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[mickeu]]></name></author>
<updated>2014-11-18T21:56:03+01:00</updated>
<published>2014-11-18T21:28:50+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104772#p104772</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104772#p104772"/>
<title type="html"><![CDATA[&quot;adresowanie&quot; portów ATB 1.04]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=9321&amp;p=104772#p104772"><![CDATA[
Witam wszystkich<br /><br />Od wczoraj działam na nowym ATB i mam jakiś dziwny problem:<br />[syntax=c]/*<br /> * main.c<br /> *<br /> *  Created on: 17 lis 2014<br /> *      Author: Thor<br /> */<br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;util/delay.h&gt;<br />#include &lt;string.h&gt;<br />#include &lt;stdlib.h&gt;<br /><br />#include &quot;SSD136/ssd1306.h&quot;<br />#include &quot;SSD136/GFX.h&quot;<br />//#include &quot;SSD136/glcdfont.h&quot;<br />#include &quot;I2C_TWI/i2c_twi.h&quot;<br />#include &quot;common.h&quot;<br /><br /><br />void led(void){<br />PORTA ^= (1&lt;&lt;PORTA5);<br />PORTA |= (1&lt;&lt;PORTA7);<br />_delay_ms(100);<br />PORTA &amp;= ~(1&lt;&lt;PORTA7);<br />}<br /><br />void led2(void){<br />PORTA ^= (1&lt;&lt;PORTA5);<br />PORTA |= (1&lt;&lt;PORTA7);<br />_delay_ms(100);<br />PORTA &amp;= ~(1&lt;&lt;PORTA7);<br />}<br />int main(void){<br /><br />//przyciski<br />DDRD &amp;= ~((1&lt;&lt;PORTA0)|(1&lt;&lt;PORTA1)|(1&lt;&lt;PORTA2)|(1&lt;&lt;PORTA3)|(1&lt;&lt;PORTA4));//wejscia<br />PORTA |= (1&lt;&lt;PORTA0)|(1&lt;&lt;PORTA1)|(1&lt;&lt;PORTA2)|(1&lt;&lt;PORTA3)|(1&lt;&lt;PORTA4);//pullup<br /><br />//LED<br />DDRA |= (1&lt;&lt;PORTA5)|(1&lt;&lt;PORTA6)|(1&lt;&lt;PORTA7);<br /><br />soft_timer();<br />sei();<br /><br />ssd1306_init(SSD1306_SWITCHCAPVCC ,REFRESH_MAX);<br /><br />drawStr(5,0,&quot;Checkpoint&quot;,1,0,2,0);<br />drawStr(45,20,&quot;27&quot;,1,0,3,0);<br />drawDisplay();<br />//clearDisplay();<br /><br />while(1){<br /><br />SuperDebounce(&amp;k1, &amp;PINA, PORTA2, 10, 200, led, led2 );<br /><br /><br />}<br />}[/syntax]<br /><br />common.c<br />[syntax=c]/*<br /> * common.c<br /> *<br /> *  Created on: 18 lis 2014<br /> *      Author: Thor<br /> */<br /><br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &quot;common.h&quot;<br /><br />volatile uint16_t Timer1, Timer2, Timer3;<br />uint8_t k1, k2;<br /><br />void SuperDebounce(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ) {<br /><br />enum {idle, debounce, go_rep, wait_rep, rep};<br /><br />if(!rep_time) rep_time=20;<br />if(!rep_wait) rep_wait=150;<br /><br />uint8_t key_press = !(*KPIN &amp; key_mask);<br />        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br />}<br /><br />void soft_timer(void){<br /><br />TCCR0 |= (1&lt;&lt;WGM01)|(1&lt;&lt;CS00)|(1&lt;&lt;CS02);<br />OCR0 =155;<br />TIMSK |= (1&lt;&lt;OCIE0);<br /><br />}<br /><br />ISR(TIMER0_COMP_vect){<br />uint16_t n;<br /><br />n = Timer1;/* 100Hz Timer1 */<br />if (n) Timer1 = --n;<br />n = Timer2;/* 100Hz Timer2 */<br />if (n) Timer2 = --n;<br />n = Timer3;/* 100Hz Timer2 */<br />if (n) Timer3 = --n;<br /><br />}[/syntax]<br /><br />common.h<br />[syntax=c]/*<br /> * common.h<br /> *<br /> *  Created on: 18 lis 2014<br /> *      Author: Thor<br /> */<br /><br />#ifndef SSD136_COMMON_H_<br />#define SSD136_COMMON_H_<br /><br />extern volatile uint16_t Timer1, Timer2, Timer3;<br />extern uint8_t k1, k2;<br /><br /><br />void soft_timer(void);<br />void SuperDebounce(uint8_t * key_state, volatile uint8_t *KPIN,<br />xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;<br /><br /><br />#endif /* SSD136_COMMON_H_ */[/syntax]<br /><br />PORTA 0-4 zaadresowane jako wejścia oraz podłączone do przycisków na ATB do KBD od 1-5 (PA0-1...PA4-5)<br />Wg programu powyżej led na PA5 powinein zmieniać stan po wciśnięciu K3 ale niestety jest przesunięty w lewo na K2<br />Przy próbie na K1 czyli PA0 zaczyna wariować tak jakby był zwarty do masy, sprawdziłem po odłączeniu zasilania i wyjęciu procka czy nie ma zwarć i wygląda że jest ok.<br />Próbowałem to przenieść na PORTD - i to samo. Porty nie są używana w innych plikach programu a SSD działa na TWI.<br /><br />Możliwe że jest uszkodzony procek czy raczej to będzie coś w eclipse?<br /><br />Z góry dzięki za pomoc<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1584">mickeu</a> — 18 lis 2014, o 21:28</p><hr />
]]></content>
</entry>
</feed>