<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=406247&amp;view=findpost&amp;p=3631381</guid>
        <pubDate>Sat, 24 Oct 2015 18:44:24 +0000</pubDate>
        <title>Инициализация LCD дисплея [PIC] [ASM]</title>
        <link>https://forum.sources.ru/index.php?showtopic=406247&amp;view=findpost&amp;p=3631381</link>
        <description><![CDATA[NifelHELL: Здравствуйте народ, разобрался с этой фигнёй. Надо оказывается тонны даташитов очень внимательно читать, в частности по Пик микро. В итоге беда была в настройках ПОРТ_А, у него на выводах висят компараторы, пока их не настроишь работает Х... пойми как всё. <br>Если кому интересно, пишите, что знаю расскажу.]]></description>
        <author>NifelHELL</author>
        <category>Микроконтроллеры</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=406247&amp;view=findpost&amp;p=3627919</guid>
        <pubDate>Sat, 03 Oct 2015 08:07:52 +0000</pubDate>
        <title>Инициализация LCD дисплея [PIC] [ASM]</title>
        <link>https://forum.sources.ru/index.php?showtopic=406247&amp;view=findpost&amp;p=3627919</link>
        <description><![CDATA[NifelHELL: Здравствуйте, пару месяцев начал изучать микропроцессора PIC, как зажигать светодиодики, опрос кнопки, прерывания и их обработка, решил двигаться дальше, и решил подключить LCD дисплей.<br>
LCD дисплей немного странноват, идёт в комплекте с Ардуино,  что за проц на дисплее не совсем понятно на нём только номер RG1602A. Нашёл описание команд дисплея, собственно <a class='tag-url' href='http://avrprog.blogspot.com/2013/04/lcd1602com.html' target='_blank'>LCD info</a><br>
Там же даётся алгоритм его инициализации. Накидал простейший код.<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">#include &#60;p16F887.inc&#62;</div><div class="code_line">&nbsp;&nbsp; &nbsp;__CONFIG &nbsp; &nbsp;_CONFIG1, _LVP_OFF &amp; _FCMEN_OFF &amp; _IESO_OFF &amp; _BOR_OFF &amp; _CPD_OFF &amp; _CP_OFF &amp; _MCLRE_OFF &amp; _PWRTE_ON &amp; _WDT_OFF &amp; _INTRC_OSC_NOCLKOUT</div><div class="code_line">&nbsp;&nbsp; &nbsp;__CONFIG &nbsp; &nbsp;_CONFIG2, _WRT_OFF &amp; _BOR21V</div><div class="code_line">&nbsp;</div><div class="code_line">cblock 0x20</div><div class="code_line">&nbsp;&nbsp; &nbsp;D_Data &nbsp; &nbsp; &nbsp;;data to output </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Delay1</div><div class="code_line">&nbsp;&nbsp; &nbsp;Delay2</div><div class="code_line">&nbsp;</div><div class="code_line">endc</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Send &nbsp; &nbsp;MACRO</div><div class="code_line">&nbsp;&nbsp; &nbsp;bsf PORTB,3 &nbsp; &nbsp; &nbsp; &nbsp; ;E=1 start send</div><div class="code_line">&nbsp;&nbsp; &nbsp;nop</div><div class="code_line">&nbsp;&nbsp; &nbsp;nop</div><div class="code_line">&nbsp;&nbsp; &nbsp;bcf PORTB,3 &nbsp; &nbsp; &nbsp; &nbsp; ;E=0 end send &nbsp; </div><div class="code_line">ENDM</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;ORG 0x00</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;GOTO Main</div><div class="code_line">&nbsp;&nbsp; &nbsp;ORG 0x04</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;GOTO IRQ</div><div class="code_line">&nbsp;</div><div class="code_line">IRQ:</div><div class="code_line">Main:</div><div class="code_line">&nbsp;&nbsp; &nbsp;bsf &nbsp; &nbsp; STATUS,RP0 &nbsp;;select Register Bank1</div><div class="code_line">&nbsp;&nbsp; &nbsp;clrf &nbsp; &nbsp;TRISA &nbsp; &nbsp; &nbsp; ;portA all output</div><div class="code_line">&nbsp;&nbsp; &nbsp;clrf &nbsp; &nbsp;TRISB &nbsp; &nbsp; &nbsp; ;portB all output</div><div class="code_line">; &nbsp; bsf &nbsp; &nbsp; STATUS,RP1 &nbsp;;select Register Bank3</div><div class="code_line">; &nbsp; clrf &nbsp; &nbsp;ANSEL &nbsp; &nbsp; &nbsp; ;portA pins are Digitals</div><div class="code_line">&nbsp;&nbsp; &nbsp;bcf &nbsp; &nbsp; STATUS,RP0</div><div class="code_line">; &nbsp; bcf &nbsp; &nbsp; STATUS,RP1 &nbsp;;return to Register Bank0</div><div class="code_line">&nbsp;&nbsp; &nbsp;clrf &nbsp; &nbsp;PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;clrf &nbsp; &nbsp;PORTB</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;bcf &nbsp; &nbsp; PORTB,1 &nbsp; &nbsp; ;RS=0</div><div class="code_line">&nbsp;&nbsp; &nbsp;bcf &nbsp; &nbsp; PORTB,2 &nbsp; &nbsp; ;RW=0</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x30 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;write init word for display</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;8bit interface, 2 line display, 5x8 char</div><div class="code_line">&nbsp;&nbsp; &nbsp;;movwf &nbsp;D_Data</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA &nbsp; &nbsp; &nbsp; ;send data to portA</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;delay about 39 msec &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;Send data to display</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x30 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;write init word for display</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA &nbsp; &nbsp; &nbsp; ;send data to portA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x30</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x38</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x0F</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0x01</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; .131 &nbsp; &nbsp; &nbsp; &nbsp;;set DDRAM adress</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; .82</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; PORTA</div><div class="code_line">&nbsp;&nbsp; &nbsp;bsf &nbsp; &nbsp; PORTB,1 &nbsp; &nbsp; ;RS=1</div><div class="code_line">&nbsp;&nbsp; &nbsp;;call &nbsp; Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;Send</div><div class="code_line">&nbsp;&nbsp; &nbsp;call &nbsp; &nbsp;Delay</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">nop</div><div class="code_line">goto $-1</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Delay</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0xFF</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; Delay2</div><div class="code_line">loop2:</div><div class="code_line">&nbsp;&nbsp; &nbsp;movlw &nbsp; 0xFF</div><div class="code_line">&nbsp;&nbsp; &nbsp;movwf &nbsp; Delay1</div><div class="code_line">loop1:</div><div class="code_line">&nbsp;&nbsp; &nbsp;decfsz &nbsp;Delay1,1</div><div class="code_line">&nbsp;&nbsp; &nbsp;goto loop1 &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;decfsz &nbsp;Delay2,1</div><div class="code_line">&nbsp;&nbsp; &nbsp;goto loop2</div><div class="code_line">return</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">END</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Выводы данных дисплея подключаю на PORTA, D0-PORTA,0... <br>
Вывод RS на PORTB,0<br>
Вывод R/W на PORTB,1<br>
Вывод Е на PORTB,2<br>
<br>
В результате дисплей даже не инициализируется, подсветка и питание подключены и работают.<br>
<br>
В чём проблема, неверно инициализирую или не те команды для дисплея, и если не те команды, то которые от него.]]></description>
        <author>NifelHELL</author>
        <category>Микроконтроллеры</category>
      </item>
	
      </channel>
      </rss>
	