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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2013-11-08T07:05:05+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=12&amp;t=4578&amp;mode</id>
<entry>
<author><name><![CDATA[endurasek]]></name></author>
<updated>2013-11-08T07:05:05+01:00</updated>
<published>2013-11-08T07:05:05+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=55825#p55825</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=55825#p55825"/>
<title type="html"><![CDATA[Re: Atmega8 i lcd na I2c PCF8574 - Kłopot z wyświetlaniem zn]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=55825#p55825"><![CDATA[
Widzę że w tym temacie sam sobie na pytania odpowiadam ...<br />Udało mi się wyświetlać znaki chr(x) na wyświetlaczu, jak na razie tylko parę godzin testowałem ale działał prawidłowo.<br /><br />Może komuś się przyda więc zamieszczam mam na dzieje rozwiązanie. Może jeszcze ktoś przetestuje.<br /><br />[syntax=basic4gl]Wait 1<br />Initlcd<br />Wait 1<br /><br /><br />'==============================================================================<br />Wait 1<br />_lcd_e = 192                                                'select both halfs for defining characters<br />Deflcdchar 0 , 8 , 20 , 8 , 3 , 4 , 4 , 4 , 3               ' znak stopnia C<br />_lcd_e = 128<br />Cls                                                         'select data RAM<br />Rem it is important that a CLS is following the deflcdchar statements because it will set the controller back in datamode<br />Lcd &quot;Sterownik solara &quot; ; Chr(0)                            'print the special character<br /><br />Wait 2<br />Cls<br /><br />Do<br /><br />....................[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1442">endurasek</a> — 8 lis 2013, o 07:05</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[endurasek]]></name></author>
<updated>2013-10-26T08:25:47+01:00</updated>
<published>2013-10-26T08:25:47+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=54323#p54323</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=54323#p54323"/>
<title type="html"><![CDATA[Atmega8 i lcd na I2c PCF8574 - Kłopot z wyświetlaniem znaków]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=4578&amp;p=54323#p54323"><![CDATA[
Atmega8 i lcd na I2c PCF8574 - Kłopot z wyświetlaniem znaków Deflcdchar<br /><br />Witam<br />Postanowiłem i na tym forum podzielić się moim problemem <br /><br />Zbudowałem układ oparty na Atmega8 gdzie dane na wyświetlacz LCD 4x20 są wysyłane po magistrali I2c przez układ i PCF8574. <br />Nie ma problemu z wyświetlaniem liter i normalnych znaków, problem pojawia się w momencie wyświetlania znaków Deflcdchart. W miejscu tego znaku na wyświetlaczu pojawiają się krzaczki. <br /><br />Program wygląda tak: <br />[syntax=basic4gl]$regfile = &quot;M8def.dat&quot;<br /> $crystal = 8000000<br /> $lib &quot;Lcd_i2c.lib&quot;<br /> <br /> <br />Dim _lcd_e As Byte<br /> <br /> Deflcdchar 0 , 8 , 20 , 11 , 4 , 4 , 4 , 3 , 32<br /> Deflcdchar 2 , 32 , 10 , 32 , 14 , 17 , 17 , 17 , 14<br /> <br />'===============<br />Const Pcf8574_lcd = &amp;H40<br /> <br />Config I2cdelay = 64<br /> <br />Config Scl = Portc.5<br />Config Sda = Portc.4<br /> <br />Config Lcd = 20 * 4<br /> <br />Const Pcf_d4 = 3                                          <br />Const Pcf_d5 = 2<br />Const Pcf_d6 = 1<br />Const Pcf_d7 = 0<br />Const Pcf_rs = 6<br />Const Pcf_rw = 5<br />Const Pcf_e2 = 7<br />Const Pcf_e1 = 4<br /> <br />  _lcd_e = 128<br /> <br />  Do<br /> <br />  Locate 1 , 1<br />  Lcd &quot;TEST &quot; ; Chr(0) ; Chr(2);<br /> <br />  Loop[/syntax]<br /><br />Biblioteka Lcd_i2c.lib jaką stosuje wygląda tak i tylko na niej umiem coś wyświetlić na lcd <br /><br />[syntax=basic4gl]copyright = Kent Andersson<br />www       = none<br />email     = kent(malpa)smmab.se<br />comment   = I2C LCD driver<br />libversion   = 1.02<br />date         = 31 march 2002<br />statement    = You are free to use this code any way you like, if you are able to optimize<br />statement    = it better, please send me an update on my e-mail.<br />history      = No known bugs.<br /> <br />;define a constant named PCF8574_LCD pointing to the i2c address<br />;dimension _lcd_e as byte to control the E-lines (4 lines LCD:s)<br />;_lcd_e should have one of the following values<br />;128 to enable E1, 64 to enable E2, 192 to enable both E1 and E2 (cls, deflcdchar) <br />;Connect the following pins from PCF8574 to LCD<br />;<br />;P0 - D4<br />;P1 - D5<br />;P2 - D6<br />;P3 - D7<br />;P4 - RS<br />;P5 - RW (not used, set to 0 to ground for write)<br />;P6 - E2 (on 1 or 2 line display nc)<br />;P7 - E1<br /> <br />&#91;_Init_LCD&#93;<br />_Init_LCD:<br /> *BASIC: waitms 50<br /> ldi r16,&amp;hc0       ; this is to make the initialization on both halfs of a 4-line LCD<br /> Ldi _temp1, &amp;h03   ; at init-time I call all routines before _lcd_e is loaded into r16<br /> Rcall _Send_to_LCD<br /> *BASIC: waitms 4<br /> Rcall _Send_to_LCD<br /> Rcall _Send_to_LCD<br /> Ldi _temp1, &amp;h02<br /> Rcall _Send_to_LCD<br /> Ldi _temp1, &amp;h28<br /> Rcall _Write_lcd_byte  ;RS flag should to be 0, so jump directly to write byte<br /> Ldi _temp1, &amp;h08<br /> Rcall _Write_lcd_byte<br /> Ldi _temp1, &amp;h0c<br /> Rcall _Write_lcd_byte<br /> Ldi _temp1, &amp;h01<br /> Rjmp _Write_lcd_byte<br />&#91;END&#93;<br /> <br /> <br />&#91;_Write_lcd&#93;<br />_Write_lcd:<br />* lds r16,{_lcd_e} <br /> sbr r16,&amp;h10                         ;set RS flag (4 high bits is used as control)<br /> rjmp _write_lcd_byte<br />_Lcd_Control:<br />* lds r16,{_lcd_e} <br />_write_lcd_byte:<br /> push r24<br /> Swap _temp1                                <br /> Rcall _Write_lcd_Nibble <br /> pop r24        <br />_Write_lcd_nibble:<br /> Cbr _temp1,&amp;HF0                      ; E1, E2, RW, RS low<br /> <br />_Send_to_LCD:<br />push r26<br />push r27<br /> ldi r25,3<br />_send_3_times:<br />PUSH _temp2<br />  BST  _temp1, 0<br />* BLD  _temp2, PCF_D4<br />  BST  _temp1, 1<br />* BLD  _temp2, PCF_D5<br />  BST  _temp1, 2<br />* BLD  _temp2, PCF_D6<br />  BST  _temp1, 3<br />* BLD  _temp2, PCF_D7<br />  BST  _temp1, 4<br />* BLD  _temp2, PCF_RS<br />  BST  _temp1, 5<br />* BLD  _temp2, PCF_RW<br />  BST  _temp1, 6<br />* BLD  _temp2, PCF_E2<br />  BST  _temp1, 7<br />* BLD  _temp2, PCF_E1<br /> *BASIC: i2csend pcf8574_LCD, _temp2<br />  POP  _temp2 <br />  eor _temp1,R16                      ; Xor E1 and/or E2 to set them<br />; @genus(250)<br /> ldi r26,0<br />_LCD_delay:<br /> dec R26<br /> brne _LCD_delay<br /> Dec R25<br /> Brne _send_3_times <br /> eor _temp1,R16       ; Xor to restore to initial state (even number of times)<br />pop r27<br />pop r26<br />ret<br /> <br />&#91;END&#93;[/syntax]<br /><br />Chciałem zaznaczyć że w moim przypadku piny PCF do lcd są podłączone w następujący sposób: <br /><br />Const Pcf_d4 = 3 'LCD D4 -&gt; PCF P0 <br />Const Pcf_d5 = 2 <br />Const Pcf_d6 = 1 <br />Const Pcf_d7 = 0 <br />Const Pcf_rs = 6 <br />Const Pcf_rw = 5 <br />Const Pcf_e2 = 7 <br />Const Pcf_e1 = 4 <br /><br />W bibliotece lib wyglada to trochę inaczej ale usiłowałem zmienic i wtedy już nic nie działało. <br /><br />Znalazłem podobny problem na innym forum. Chodzi o zastosowanie komendy Initlcd ale u mnie nie działa lub zle robię. <br /><a href="http://bascom-forum.de/archive/index.php/t-4045.html?s=31c6341cda392fbfb262e98e75ba2401"  class="postlink">http://bascom-forum.de/archive/index.php/t-4045.html?s=31c6341cda392fbfb262e98e75ba2401</a><p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=1442">endurasek</a> — 26 paź 2013, o 08:25</p><hr />
]]></content>
</entry>
</feed>