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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2015-06-21T16:33:30+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=46&amp;t=12063&amp;mode</id>
<entry>
<author><name><![CDATA[foreste]]></name></author>
<updated>2015-06-21T16:33:30+01:00</updated>
<published>2015-06-21T16:33:30+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132395#p132395</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132395#p132395"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132395#p132395"><![CDATA[
Dziekuje za interesowanie tematem <br />moje pytanie było takie jak ustawić piny odpowiednim stanie w cold boot cpu<br />rozwiązanie polegało na dufaniu linijki<br />[syntax=c]GPIO_ToggleBits(GPIOG , GPIO_Pin_8 | GPIO_Pin_7 | GPIO_Pin_6 |GPIO_Pin_5 | GPIO_Pin_4);[/syntax],<br />poprzednio dawalem ale bez skutku bo efekt byl taki sam<br />codo kodu nawet mi nie podobał bo był paskudny,<br />myślałem nad tablicą i for ale portem miałem  problem bo diody są na gpiog i gpioc nie potrafię ich całość dać programowo,<br />to jest mój 1 projekt na arm i dopiero zaczynam naukę na arm <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=525">foreste</a> — 21 cze 2015, o 16:33</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[krafin]]></name></author>
<updated>2015-06-21T15:47:24+01:00</updated>
<published>2015-06-21T15:47:24+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132381#p132381</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132381#p132381"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132381#p132381"><![CDATA[
Dokładnie tak jak pisze PJS, przecież w tej chwili ten kod to jest nie obraź się ale tragedia. W arm-ach dostęp do rejestrów jest ładnie opakowany w struktury, i można pewne rzeczy zrobić dużo &quot;ładniej&quot; niż na avr. <br />Druga sprawa to zainteresuj się SysTick timerem, bo pisząc tak kod twój procek pędzony na 168MHz będzie działać wolniej niż attiny na kwarcu zegarkowym <img src="https://forum.atnel.pl/images/smilies/icon_e_biggrin.gif" alt=":D" title="Bardzo szczęśliwy" /><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=487">krafin</a> — 21 cze 2015, o 15:47</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[PJS]]></name></author>
<updated>2015-06-21T14:52:32+01:00</updated>
<published>2015-06-21T14:52:32+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132364#p132364</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132364#p132364"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132364#p132364"><![CDATA[
<div class="quotetitle">foreste napisał(a):</div><div class="quotecontent"><br />problem rozważany <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><br />[syntax=c]GPIO_ResetBits(GPIOG, GPIO_Pin_4);<br />        // czas migniecia<br />        for (i = 0; i &lt; 50000; i++);<br /><br />        GPIO_SetBits(GPIOG, GPIO_Pin_4);<br />        for (i = 0; i &lt; 50000; i++);[/syntax]<br /></div><br /><br />Dalej nie wiem, co chciałeś od nas się dowiedzieć...<br />A co do listingu:<br />Jak ty nad tym panujesz? Wyobraź sobie, że teraz musisz zmienić opóźnienie z 50000 na inną wartość - w ilu miejscach musisz poprawiać? Gdybyś np. zastosował<br />[syntax=c]#define OPOZNIENIE 50000[/syntax] i w miejsce 50000 wstawił tą definicję to tylko w jednym miejscu byś musiał poprawić.<br />Inna rzecz, że fragment listingu powyżej zacytowany powtarza się wielokrotnie, a zmienia się port i pin. Warto zatem zrobić sobie funkcje do tego, np.:<br />[syntax=c]#define OPOZNIENIE 50000<br />mignij_led(GPIO_TypeDef *port, uint16_t dioda)<br />{<br />  GPIO_ResetBits(port, dioda);<br />     // czas migniecia<br />     for (i = 0; i &lt; OPOZNIENIE; i++);<br />        GPIO_SetBits(port, dioda);<br />       for (i = 0; i &lt; OPOZNIENIE; i++);<br />}[/syntax]<br />i odpowiednio wywoływać.<br />Można też zrobić tablicę par: port-pin i wywoływać funkcję mignij_led() w pętli, wstawiając odpowiednie pozycje tablicy (korzystając ze zmiennej inkrementowanej).<br />Mam nadzieję, że nie pomyliłem się nigdzie, bo piszę z pamięci.<br />Zauważ też, że w twoim programie istnieje wiele miejsc, gdzie może wystąpić błąd i część LED będzie migać prawidłowo, a część/jedna nieprawidłowo (bo np. podałeś zły port w setbits() lub resetbits(). Znalezienie błędu też jest &quot;trudniejsze&quot; (choć ten przykład jest trywialny), bo musisz sprawdzić czy prawidłowo wywołujesz setbits(), resetbits(), czy nie pomyliłeś się ze średnikiem itp. itd.  A w przypadku tej funkcji, gdy jedna działa dobrze to i reszta będzie działać dobrze (o ile nie pomylisz się w wywołaniu - a wtedy sprawdzasz tylko wywołanie).<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1614">PJS</a> — 21 cze 2015, o 14:52</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[SunRiver]]></name></author>
<updated>2015-06-21T10:40:47+01:00</updated>
<published>2015-06-21T10:40:47+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132325#p132325</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132325#p132325"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132325#p132325"><![CDATA[
Foreste pisz kuna po polsku zacznij pisać w wordzie i wklejaj jak ci nie działa sprawdzanie pisowni w przeglądarce<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=58">SunRiver</a> — 21 cze 2015, o 10:40</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[foreste]]></name></author>
<updated>2015-06-21T01:55:26+01:00</updated>
<published>2015-06-21T01:55:26+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132307#p132307</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132307#p132307"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132307#p132307"><![CDATA[
problem rozważany <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><br />[syntax=c]//PLIKI NAGLOWKOWE<br />#include &quot;stm32f4xx.h&quot;<br />#include &quot;stm32f4xx_rcc.h&quot;<br />#include &quot;stm32f4xx_gpio.h&quot;<br /><br />int main(void) {<br />RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG,  ENABLE); //ZEGARA PORTU g<br />GPIO_InitTypeDef GPIO_InitDef; //INICIACJA PORTU<br /><br />GPIO_InitDef.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_7 | GPIO_Pin_6 |GPIO_Pin_5 | GPIO_Pin_4 ; // inicjacja pinow<br />GPIO_InitDef.GPIO_OType = GPIO_OType_OD; //typ pinow<br />GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; //piny jako wyjsciowe<br />GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_UP; // programowy rezystor<br />GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz; //ustawienie taktowania zegara pinow<br />GPIO_ToggleBits(GPIOG , GPIO_Pin_8 | GPIO_Pin_7 | GPIO_Pin_6 |GPIO_Pin_5 | GPIO_Pin_4);<br />//GPIO_ToggleBits(GPIOG, GPIO_Pin_14);<br />GPIO_Init(GPIOG, &amp;GPIO_InitDef); //aktywacja pinow<br /><br />RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,  ENABLE); //ZEGARA PORTU g<br />//GPIO_InitTypeDef GPIO_InitDef; //INICIACJA PORTU<br /><br />GPIO_InitDef.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_7 | GPIO_Pin_6; // inicjacja pinow<br />GPIO_InitDef.GPIO_OType = GPIO_OType_OD; //typ pinow<br />GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; //piny jako wyjsciowe<br />GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_UP; // programowy rezystor<br />GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz; //ustawienie taktowania zegara pinow<br />GPIO_ToggleBits(GPIOC , GPIO_Pin_8 | GPIO_Pin_7 |GPIO_Pin_6 );<br />//GPIO_ToggleBits(GPIOG, GPIO_Pin_14);<br />GPIO_Init(GPIOC, &amp;GPIO_InitDef); //aktywacja pinow<br /><br /><br /><br /><br />volatile int i;<br />for (i = 0; i &lt; 50000; i++);<br />    while (1) {<br /><br /><br /><br />     <br /> GPIO_ResetBits(GPIOG, GPIO_Pin_4);<br />        // czas migniecia<br />        for (i = 0; i &lt; 50000; i++);<br /><br />        GPIO_SetBits(GPIOG, GPIO_Pin_4);<br />        for (i = 0; i &lt; 50000; i++);<br /><br />        //Dioda 2<br />            GPIO_ResetBits(GPIOG, GPIO_Pin_5);<br />            // czas migniecia<br />            for (i = 0; i &lt; 50000; i++);<br />            GPIO_SetBits(GPIOG, GPIO_Pin_5);<br />            for (i = 0; i &lt; 50000; i++);<br /><br />    //GPIO_ToggleBits(GPIOG, GPIO_Pin_14);<br />    //Dioda 1<br />   GPIO_ResetBits(GPIOG, GPIO_Pin_6);<br />    // czas migniecia<br />    for (i = 0; i &lt; 50000; i++);<br />    GPIO_SetBits(GPIOG, GPIO_Pin_6);<br />    for (i = 0; i &lt; 50000; i++);<br /><br />    <br />        GPIO_ResetBits(GPIOG, GPIO_Pin_7);<br />        // czas migniecia<br />        for (i = 0; i &lt; 50000; i++);<br />        GPIO_SetBits(GPIOG, GPIO_Pin_7);<br />        for (i = 0; i &lt; 50000; i++);<br /><br />        GPIO_ResetBits(GPIOG, GPIO_Pin_8);<br />                // czas migniecia<br />                for (i = 0; i &lt; 50000; i++);<br />                GPIO_SetBits(GPIOG, GPIO_Pin_8);<br />                for (i = 0; i &lt; 50000; i++);<br /><br />                GPIO_ResetBits(GPIOC, GPIO_Pin_6);<br />                    // czas migniecia<br />                    for (i = 0; i &lt; 50000; i++);<br />                    GPIO_SetBits(GPIOC, GPIO_Pin_6);<br />                    for (i = 0; i &lt; 50000; i++);<br /><br />                    //Dioda 2<br />                        GPIO_ResetBits(GPIOC, GPIO_Pin_7);<br />                        // czas migniecia<br />                        for (i = 0; i &lt; 50000; i++);<br />                        GPIO_SetBits(GPIOC, GPIO_Pin_7);<br />                        for (i = 0; i &lt; 50000; i++);<br /><br />                        GPIO_ResetBits(GPIOC, GPIO_Pin_8);<br />                                // czas migniecia<br />                                for (i = 0; i &lt; 50000; i++);<br />                                GPIO_SetBits(GPIOC, GPIO_Pin_8);<br />                                for (i = 0; i &lt; 50000; i++);<br />    //prawo<br />                                <br />                                 GPIO_ResetBits(GPIOC, GPIO_Pin_8);<br />                                        // czas migniecia<br />                                        for (i = 0; i &lt; 50000; i++);<br /><br />                                        GPIO_SetBits(GPIOC, GPIO_Pin_8);<br />                                        for (i = 0; i &lt; 50000; i++);<br /><br />                                        //Dioda 2<br />                                            GPIO_ResetBits(GPIOC, GPIO_Pin_7);<br />                                            // czas migniecia<br />                                            for (i = 0; i &lt; 50000; i++);<br />                                            GPIO_SetBits(GPIOC, GPIO_Pin_7);<br />                                            for (i = 0; i &lt; 50000; i++);<br /><br />                                    //GPIO_ToggleBits(GPIOG, GPIO_Pin_14);<br />                                    //Dioda 1<br />                                   GPIO_ResetBits(GPIOC, GPIO_Pin_6);<br />                                    // czas migniecia<br />                                    for (i = 0; i &lt; 50000; i++);<br />                                    GPIO_SetBits(GPIOC, GPIO_Pin_6);<br />                                    for (i = 0; i &lt; 50000; i++);<br /><br />                                    <br />                                        GPIO_ResetBits(GPIOG, GPIO_Pin_8);<br />                                        // czas migniecia<br />                                        for (i = 0; i &lt; 50000; i++);<br />                                        GPIO_SetBits(GPIOG, GPIO_Pin_8);<br />                                        for (i = 0; i &lt; 50000; i++);<br /><br />                                        GPIO_ResetBits(GPIOG, GPIO_Pin_7);<br />                                                // czas migniecia<br />                                                for (i = 0; i &lt; 50000; i++);<br />                                                GPIO_SetBits(GPIOG, GPIO_Pin_7);<br />                                                for (i = 0; i &lt; 50000; i++);<br /><br />                                                GPIO_ResetBits(GPIOG, GPIO_Pin_6);<br />                                                    // czas migniecia<br />                                                    for (i = 0; i &lt; 50000; i++);<br />                                                    GPIO_SetBits(GPIOG, GPIO_Pin_6);<br />                                                    for (i = 0; i &lt; 50000; i++);<br /><br />                                                    <br />                                                        GPIO_ResetBits(GPIOG, GPIO_Pin_5);<br />                                                        // czas migniecia<br />                                                        for (i = 0; i &lt; 50000; i++);<br />                                                        GPIO_SetBits(GPIOG, GPIO_Pin_5);<br />                                                        for (i = 0; i &lt; 50000; i++);<br /><br />                                                        GPIO_ResetBits(GPIOG, GPIO_Pin_4);<br />                                                                // czas migniecia<br />                                                                for (i = 0; i &lt; 50000; i++);<br />                                                                GPIO_SetBits(GPIOG, GPIO_Pin_4);<br />                                                                for (i = 0; i &lt; 50000; i++);<br /><br />    }<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=525">foreste</a> — 21 cze 2015, o 01:55</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[krafin]]></name></author>
<updated>2015-06-20T12:24:17+01:00</updated>
<published>2015-06-20T12:24:17+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132234#p132234</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132234#p132234"/>
<title type="html"><![CDATA[Re: stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132234#p132234"><![CDATA[
Przecież robisz to 4-krotnie w pętli głównej? Chyba, że pytasz o co innego.<br /><br />A tak bezpośrednio na rejestrach to można tak:<br />[syntax=c]GPIOA-&gt;ODR |= (1&lt;&lt;13) | (1&lt;&lt;12);  //ustawienie pinów 13 i 12<br />GPIOA-&gt;ODR &amp;= ~((1&lt;&lt;13) | (1&lt;&lt;12)); //wyzerowanie pinów 13 i 12<br />GPIOA-&gt;BSRR = GPIO_BSRR_BS_13 | GPIO_BSRR_BS_12; //ustawianie pinów drugi sposób<br />GPIOA-&gt;BSRR = GPIO_BSRR_BR_13 | GPIO_BSRR_BR_12; //kasowanie[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=487">krafin</a> — 20 cze 2015, o 12:24</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[foreste]]></name></author>
<updated>2015-06-19T19:46:34+01:00</updated>
<published>2015-06-19T19:37:45+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132198#p132198</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132198#p132198"/>
<title type="html"><![CDATA[stm32f429l-ustawienie stanu logicznego  pinu low/high]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=12063&amp;p=132198#p132198"><![CDATA[
Witam<br />jak się definiuje stan logiczny w mikrokontrolerze arm początkowej konfiguracji portu i pinów w projekcie aby pin miał poządany stan logiczny przez nas np do podłączenia diód z zestawu atb , diody led katoda do procesora<br />tutaj mój kod w C<br />[syntax=c]/PLIKI NAGLOWKOWE<br />#include &quot;stm32f4xx.h&quot;<br />#include &quot;stm32f4xx_rcc.h&quot;<br />#include &quot;stm32f4xx_gpio.h&quot;<br /><br />int main(void) {<br />RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE); //ZEGARA PORTU g<br />GPIO_InitTypeDef GPIO_InitDef; //INICIACJA PORTU<br /><br />GPIO_InitDef.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14; // inicjacja pinow<br />GPIO_InitDef.GPIO_OType = GPIO_OType_PP; //typ pinow<br />GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; //piny jako wyjsciowe<br />GPIO_InitDef.GPIO_PuPd = GPIO_PuPd_NOPULL; // programowy rezystor<br />GPIO_InitDef.GPIO_Speed = GPIO_Speed_100MHz; //ustawienie taktowania zegara pinow<br />GPIO_Init(GPIOG, &amp;GPIO_InitDef); //aktywacja pinow<br /><br />volatile int i;<br />    while (1) {<br />    //Dioda 1<br />    GPIO_SetBits(GPIOG, GPIO_Pin_13);<br />    // czas migniecia<br />    for (i = 0; i &lt; 100000; i++);<br />    GPIO_ResetBits(GPIOG, GPIO_Pin_13);<br />    for (i = 0; i &lt; 100000; i++);<br /><br />    //Dioda 2<br />        GPIO_SetBits(GPIOG, GPIO_Pin_14);<br />        // czas migniecia<br />        for (i = 0; i &lt; 500000; i++);<br />        GPIO_ResetBits(GPIOG, GPIO_Pin_14);<br />        for (i = 0; i &lt; 500000; i++);<br />    }<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=525">foreste</a> — 19 cze 2015, o 19:37</p><hr />
]]></content>
</entry>
</feed>