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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2023-12-17T16:05:48+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=4&amp;t=24603&amp;mode</id>
<entry>
<author><name><![CDATA[mario2015]]></name></author>
<updated>2023-12-17T16:05:48+01:00</updated>
<published>2023-12-17T16:05:48+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=24603&amp;p=237764#p237764</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=24603&amp;p=237764#p237764"/>
<title type="html"><![CDATA[Wyświetlacz ze sterownikiem ST7735 i problem.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=24603&amp;p=237764#p237764"><![CDATA[
Cześć wszystkim.<br />Mam problem z w/w wyświetlaczem.<br />Otóż w moich czeluściach znalazłem ten oto wyświetlacz i postanowiłem go uruchomić:<br /><a href="https://obrazkiforum.atnel.pl/8867/fb68ddf9396d5247e1cf1d78b50aaf25.jpg"  class="postlink"><img src="https://obrazkiforum.atnel.pl/thumb/8867/fb68ddf9396d5247e1cf1d78b50aaf25.jpg" alt="Obrazek" /></a><br />Do inicjalizacji wyświetlacza użyłem kodu kolegi &quot;PawelGaj&quot; z tego forum, który był bardzo dawno temu tutaj przedstawiony.<br />Inicjalizacja wygląda tak:<br />[syntax=c]#include &quot;&lt;span class=&quot;posthilit&quot;&gt;ST7735&lt;/span&gt;.h&quot;<br />    #include &lt;avr/io.h&gt;<br />    #include &lt;util/delay.h&gt;<br />     <br />    /*************************************************/<br />    void ST7735Write(uint8_t Data)<br />    {<br />            CLR_CS;<br />            SET_RS;<br />     <br />            SPDR = Data;<br />            while(!(SPSR &amp; (1&lt;&lt;SPIF)));<br />     <br />            SET_CS;<br />    }<br />     <br />    void ST7735WriteCommand(uint8_t Command)<br />    {<br />            CLR_CS;<br />            CLR_RS;<br />     <br />            SPDR = Command;<br />            while(!(SPSR &amp; (1&lt;&lt;SPIF)));<br />     <br />            SET_CS;<br />    }<br />     <br />    /*************************************************/<br />    void ST7735SetAddressWindow(int x0, int y0, int x1, int y1)<br />    {<br />      ST7735WriteCommand(CASET);    // Ustawianie adresu kolumn<br />      ST7735Write(0x00);<br />      ST7735Write(x0);<br />      ST7735Write(0x00);<br />      ST7735Write(x1);<br />     <br />      ST7735WriteCommand(RASET);    // Ustawienie adresu wierszy<br />      ST7735Write(0x00);<br />      ST7735Write(y0);<br />      ST7735Write(0x00);<br />      ST7735Write(y1);<br />     <br />      ST7735WriteCommand(RAMWR);    // Zapis do RAM<br />    }<br />     <br />    /*************************************************/<br />    void ST7735DispInit(void)<br />    {<br />            ST7735WriteCommand(SPLOUT);     // Wybudz wyswietlacz<br />            _delay_ms(120);<br />     <br />            ST7735WriteCommand(FRMCTR1);    // Frame Rate Control<br />            ST7735Write(0x01);<br />            ST7735Write(0x2C);<br />            ST7735Write(0x2D);<br />     <br />            ST7735WriteCommand(FRMCTR2);<br />            ST7735Write(0x01);<br />            ST7735Write(0x2C);<br />            ST7735Write(0x2D);<br />            ST7735Write(0xB3);<br />            ST7735Write(0x01);<br />            ST7735Write(0x2C);<br />            ST7735Write(0x2D);<br />            ST7735Write(0x01);<br />            ST7735Write(0x2C);<br />            ST7735Write(0x2D);<br />     <br />            ST7735WriteCommand(INVCTR);     // Display Inversion Control<br />            ST7735Write(0x07);<br />     <br />            ST7735WriteCommand(PWCTR0);     // Power Control 1<br />            ST7735Write(0xA2);<br />            ST7735Write(0x02);<br />            ST7735Write(0x84);<br />     <br />            ST7735WriteCommand(PWCTR1);     // Power Control 2<br />            ST7735Write(0xC5);<br />     <br />            ST7735WriteCommand(PWCTR2);     // Power Control 3<br />            ST7735Write(0x0A);<br />            ST7735Write(0x00);<br />     <br />            ST7735WriteCommand(PWCTR3);     // Power Control 4<br />            ST7735Write(0x8A);<br />            ST7735Write(0x2A);<br />     <br />            ST7735WriteCommand(PWCTR4);     // Power Control 5<br />            ST7735Write(0x8A);<br />            ST7735Write(0xEE);<br />     <br />            ST7735WriteCommand(VMCTR1);     // VCOM Control<br />            ST7735Write(0x0E);<br />     <br />            ST7735WriteCommand(MADCTL);     // Memory Acces Data Control<br />            ST7735Write(0x70);              //      MX,MV,ML set<br />     <br />            // Gamma Control<br />            ST7735WriteCommand(GMCTRP1);<br />            ST7735Write(0x0f);<br />            ST7735Write(0x1a);<br />            ST7735Write(0x0f);<br />            ST7735Write(0x18);<br />            ST7735Write(0x2f);<br />            ST7735Write(0x28);<br />            ST7735Write(0x20);<br />            ST7735Write(0x22);<br />            ST7735Write(0x1f);<br />            ST7735Write(0x1b);<br />            ST7735Write(0x23);<br />            ST7735Write(0x37);<br />            ST7735Write(0x00);<br />            ST7735Write(0x07);<br />            ST7735Write(0x02);<br />            ST7735Write(0x10);<br />     <br />            ST7735WriteCommand(GMCTRN1);<br />            ST7735Write(0x0f);<br />            ST7735Write(0x1b);<br />            ST7735Write(0x0f);<br />            ST7735Write(0x17);<br />            ST7735Write(0x33);<br />            ST7735Write(0x2c);<br />            ST7735Write(0x29);<br />            ST7735Write(0x2e);<br />            ST7735Write(0x30);<br />            ST7735Write(0x30);<br />            ST7735Write(0x39);<br />            ST7735Write(0x3f);<br />            ST7735Write(0x00);<br />            ST7735Write(0x07);<br />            ST7735Write(0x03);<br />            ST7735Write(0x10);<br />     <br />     <br />            ST7735WriteCommand(COLMOD);     // Interface Pixel Format<br />            ST7735Write(0x05);      // 16bit/pixel<br />     <br />     <br />            ST7735WriteCommand(DISPON);     // Wlacz wyswietlacz<br />    }<br />    void ST7735Init(void)<br />    {<br />            DDR(ST7735_RS_PORT) |= (1&lt;&lt;ST7735_RS_PIN);<br />            DDR(ST7735_RES_PORT) |= (1&lt;&lt;ST7735_RES_PIN);<br />     <br />            // SPI pin init<br />     <br />            DDR(ST7735_CS_PORT) |= (1&lt;&lt;ST7735_CS_PIN);<br />            DDR(ST7735_MOSI_PORT) |= (1&lt;&lt;ST7735_MOSI_PIN);<br />            DDR(ST7735_SCK_PORT) |= (1&lt;&lt;ST7735_SCK_PIN);<br />     <br />            // SPI init<br />            SPCR = (1&lt;&lt;SPE)|(1&lt;&lt;MSTR);<br />            SPSR |=  (1&lt;&lt;SPI2X);<br />     <br />     <br />              // Reset wyswietlacza<br />            SET_RES;<br />            _delay_ms(50);<br />            CLR_RES;<br />            _delay_ms(50);<br />            SET_RES;<br />            _delay_ms(50);<br />     <br />            // Init sterownika<br />            ST7735DispInit();<br />    }<br /><br />GeSHi[/syntax]<br />Niestety ta inicjalizacja u mnie się bardzo dziwnie zachowuje i dla mojego wyświetlacza, chyba nie jest prawidłowa.<br />Chociaż wyświetlacz jakoś tam się inicjalizuje, to wygląda to bardzo dziwnie.<br />Krótko mówiąc nie inicjalizuje się poprawnie.<br />W tym celu też nagrałem krótki filmik tego co się dzieje z wyświetlaczem po uruchomieniu:<br /><br /><a href="https://youtu.be/Je1CQPMONcE"  class="postlink">https://youtu.be/Je1CQPMONcE</a><br /><br />Oczywiście to miganie wyświetlacza jest widoczne tylko na video. W rzeczywistości migotania nie widać.<br />Wybaczcie &quot;ruchomy obraz&quot; ale nie posiadam ani stabilnej ręki ani statywu do telefonu.<br />Jak by ktoś mógł napisać mi, podpowiedzieć (datascheet tego sterownika nic mi nie powiedzialo nawet po przetłumaczeniu translatorem),<br />Jaka jest kolejność wysłania jakich komend do wyświetlacza, do prawidłowej inicjalizacji.<br />Acha, ta widoczna linia na wyświetlaczu, to jest po prostu linia, którą próbowałem narysować, choć kolory nie są te co powinny.<br />Pomóżcie mi uruchomić poprawnie ten wyświetlacz. proszę.<br />Jeśli jeszcze będą wam potrzebne jakiekolwiek informacje, to napiszę.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=8867">mario2015</a> — 17 gru 2023, o 16:05</p><hr />
]]></content>
</entry>
</feed>