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

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2015-01-06T18:51:04+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=12&amp;t=10073&amp;mode</id>
<entry>
<author><name><![CDATA[miiik91]]></name></author>
<updated>2015-01-06T18:51:04+01:00</updated>
<published>2015-01-06T18:51:04+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112791#p112791</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112791#p112791"/>
<title type="html"><![CDATA[Re: Pomoc przy programie]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112791#p112791"><![CDATA[
Dziękuje kolego pomogło<br /><br />Zamiast <br />[syntax=basic4gl]Readeeprom L , 395                                          'sprawdzamy czy przed restartem<br />   If L &gt; 0 Then<br />   Set Portb.2                                              'led byĹ‚ zaĹ‚Ä…czony czy wyĹ‚Ä…czony<br />   Else                                                     'i ustawiamy ten sam stan po resecie<br />   Reset Portb.2<br />   End If[/syntax]<br />jest<br /><br />[syntax=basic4gl]Readeeprom L , 15                                           'sprawdzamy czy przed restartem<br />   If L &gt; 0 Then<br />   Pwm1b = 0                                                'led był załączony czy wyłączony<br />   Else                                                     'i ustawiamy ten sam stan po resecie<br />   Pwm1b = 255<br />   End If[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2934">miiik91</a> — 6 sty 2015, o 18:51</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[miiik91]]></name></author>
<updated>2015-01-06T15:28:53+01:00</updated>
<published>2015-01-06T15:28:53+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112741#p112741</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112741#p112741"/>
<title type="html"><![CDATA[Re: Pomoc przy programie]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112741#p112741"><![CDATA[
Przepraszam za kolor, już poprawione. Własnie nie wiem jak opisać dokładnie ten problem. Może tak: Po włączeniu zasilania program powinien odczytywać wszystkie ustawienia z eepromu, czyli czasy lamp. ustawienie wentylatora. Z lampami i wentylatorem nie zauważyłem problemu, tyko oświetlenie LED niestety jest zawsze włączone po resecie zasilania, mimo że jest ustawione by były wyłączone.<br /><br />Szukałem własnie w ten sposób, ale niczego nie znalazłem niestety<br /><br />Tak jak wspomniałem autor niestety nie odpowiada, od dłuższego czasu.<br /><br />Fragment odpowiedzialny za obsługę LED.<br />[syntax=basic4gl]Onled:                                                      'zalaczenie z 30s rozjasnianiem leda<br />Do<br />   If L &lt; 255 Then<br />   Incr Pwm1b<br />   Waitms 100<br />   L = Pwm1b<br />   Else<br />   Reset Portb.2<br />   Writeeeprom L , 395<br />   Exit Do<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br /> '-------------------------------------------------------------------------------<br />Offled:                                                     'wylaczenie z 30s sciemnianiem leda<br />Do<br />   If L &gt; 0 Then<br />   Decr Pwm1b<br />   Waitms 100<br />   L = Pwm1b<br />   Else<br />   Set Portb.2<br />   Writeeeprom L , 395<br />   Exit Do<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led:<br />Msg = Loc11 + Msg_ledgm                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mz3 , 5<br />   Readeeprom Gz3 , 6<br />Do<br />   If Lewo = 0 Then<br />   Incr Gz3<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mz3<br />   Waitms 200<br />   End If<br /><br />   If Gz3 &gt; 23 Then : Gz3 = 0 : End If<br />   If Mz3 &gt; 59 Then : Mz3 = 0 : End If<br />   Locate 2 , 12<br />      If Gz3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz3 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gz3 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mz3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mz3<br />         Else<br />            Lcd Mz3<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />      Writeeeprom Mz3 , 5<br />   Writeeeprom Gz3 , 6<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Leda:<br />Msg = Loc11 + Msg_ledgm                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wylacz                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mw3 , 11<br />   Readeeprom Gw3 , 12<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw3<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mw3<br />   Waitms 200<br />   End If<br /><br />   If Gw3 &gt; 23 Then : Gw3 = 0 : End If<br />   If Mw3 &gt; 59 Then : Mw3 = 0 : End If<br />   Locate 2 , 12<br />      If Gw3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw3 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gw3 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mw3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mw3<br />         Else<br />            Lcd Mw3<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Mw3 , 11<br />   Writeeeprom Gw3 , 12<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led2:<br />Msg = Loc11 + Msg_ledgm2                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gz4 , 3<br />Do<br />   If Lewo = 0 Then<br />   Incr Gz4<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gz4<br />   Waitms 200<br />   End If<br /><br />   If Gz4 &gt; 23 Then : Gz4 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gz4 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz4 ; &quot;:00&quot;<br />         Else<br />            Lcd Gz4 ; &quot;:00&quot;<br />      End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />      Writeeeprom Gz4 , 3<br /><br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led2a:<br />Msg = Loc11 + Msg_ledgm2                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wylacz                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gw4 , 9<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw4<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gw4<br />   Waitms 200<br />   End If<br /><br />   If Gw4 &gt; 23 Then : Gw4 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gw4 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw4 ; &quot;:00&quot;<br />         Else<br />            Lcd Gw4 ; &quot;:00&quot;<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Gw4 , 9<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return[/syntax]<br /><br />Warunek załączenia led<br /><br />[syntax=basic4gl]Readeeprom L , 395                                        'odczyt stanu pwm<br />   If Gz3 = Godziny Then                                    'warunek zalaczenia led noc<br />      If Mz3 = Minuty Then<br />         If L &lt; 255 Then<br />         Gosub Onled<br />         End If<br />      End If<br />   End If<br />   If Gw3 = Godziny Then                                    'warunek wylaczenia led noc<br />      If Mw3 = Minuty Then<br />      If L &gt; 0 Then<br />      Gosub Offled<br />      End If<br />      End If<br />   End If<br /><br />   If Gz4 = Godziny Then                                    'warunek zalaczenia led dzien<br />      If L &lt; 255 Then<br />      Gosub Onled<br />      End If<br />   End If<br />   If Gw4 = Godziny Then                                    'warunek wylaczenia led dzien<br />      If L &gt; 0 Then<br />      Gosub Offled<br />      End If<br />   End If[/syntax]<br /><br />Odczyt z eeprom<br /><br />[syntax=basic4gl]Readeeprom L , 395                                          'sprawdzamy czy przed restartem<br />   If L &gt; 0 Then<br />   Set Portb.2                                              'led był załączony czy wyłączony<br />   Else                                                     'i ustawiamy ten sam stan po resecie<br />   Reset Portb.2<br />   End If[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2934">miiik91</a> — 6 sty 2015, o 15:28</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[acid3]]></name></author>
<updated>2015-01-06T15:01:26+01:00</updated>
<published>2015-01-06T15:01:26+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112731#p112731</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112731#p112731"/>
<title type="html"><![CDATA[Re: Pomoc przy progrmie]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112731#p112731"><![CDATA[
A może by tak kolega zapytał autora, który zna ten program na pamięć i będzie mógł szybko i skutecznie pomóc.<br /><br />Z drugiej strony , trzeba się zastanowić czy ktoś będzie analizował cały kod, który jak widać krótki nie jest <img src="https://forum.atnel.pl/images/smilies/icon_e_wink.gif" alt=";)" title="Puszcza oko" /> <br /><br />Z trzeciej strony &quot;problem&quot; jest opisany tak chaotycznie i pobieżnie, że ciężko na niego jakkolwiek zareagować <img src="https://forum.atnel.pl/images/smilies/icon_e_smile.gif" alt=":)" title="Szczęśliwy" /><br /><br />Kolor czerwony zdaje się jest zarezerwowany dla &quot;Modulatorów&quot; ....<br /><br />Na stronie AUTOR wyraźnie zaznaczył że nie zgadza się na komercyjne wykorzystanie projektu ... To powinno wystarczyć. Z drugiej strony coś mi się wydaje, że nie bardzo Ci wolno czegokolwiek zakazywać skoro nie jesteś właścicielem.<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=944">acid3</a> — 6 sty 2015, o 15:01</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[miiik91]]></name></author>
<updated>2015-01-06T15:37:17+01:00</updated>
<published>2015-01-06T14:42:28+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112718#p112718</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112718#p112718"/>
<title type="html"><![CDATA[Pomoc przy programie]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=10073&amp;p=112718#p112718"><![CDATA[
Witam kolegów <br /><br />Złożyłem sterownik do akwarium kolegi rabbit <a href="http://rabbit.elektroda.eu/sterownik-akwarystyczny/"  class="postlink">http://rabbit.elektroda.eu/sterownik-akwarystyczny/</a><br /><a href="http://forum.atnel.pl/_obrazki/o/2934/1cff4695fa7e54579c7f805f57ad320f.png"  class="postlink"><img src="http://forum.atnel.pl/_obrazki/o/thumb/2934/1cff4695fa7e54579c7f805f57ad320f.png" alt="Obrazek" /></a><br /><br />Mam z nim problem, mianowicie led (PORTB.2) świeci mi zawsze po włączeniu zasilania, mimo że przed był zgaszony<br />Szukałem, zmieniałem niestety nie mogę sobie z tym poradzić. A autor niestety nie odpowiada<br /><br />[syntax=basic4gl]'-------------------------------------------------------------------------------<br />'***************************STEROWNIK AKWARYSTYCZNY*****************************<br />'____________________________________by_________________________________________<br />'**********************************RABBIT***************************************<br />'-------------------------------------------------------------------------------<br />'***Dyrektywy dla kompilatora***<br />'-------------------------------------------------------------------------------<br />$regfile = &quot;m8def.dat&quot;<br />$crystal = 16000000<br />$lib &quot;ds1307clock.lib&quot;<br />$lib &quot;mcsbyteint.lbx&quot;<br />$lib &quot;I2C_TWI.LBX&quot;<br />$hwstack = 64<br />$swstack = 64<br />$framesize = 64<br />'-------------------------------------------------------------------------------<br />'***PORTY***<br />'-------------------------------------------------------------------------------<br />Config 1wire = Portc.1                                      'ds18b20<br />Config Sda = Portc.4                                        'ds1307<br />Config Scl = Portc.5                                        'ds1307<br />Config Portb = &amp;B00111110<br />Config Portc.0 = Output<br />Set Portb.0<br />Reset Portb.2<br />Reset Portb.4                                               'lampa1 wyłączona<br />Reset Portb.5                                               'lampa2 wyłączona<br />Reset Portc.0                                               'lampa3 wyłączona<br />Set Portd.5<br />Set Portd.6<br />Set Portd.7<br />'-------------------------------------------------------------------------------<br />'***LCD***<br />'-------------------------------------------------------------------------------<br />Config Lcd = 16 * 2<br />Config Lcdpin = Pin , Db4 = Portd.1 , Db5 = Portd.2 , Db6 = Portd.3 , Db7 = Portd.4 , E = Portd.0 , Rs = Portc.3<br />Deflcdchar 0 , 14 , 10 , 14 , 32 , 32 , 32 , 32 , 32        ' znak stopnia<br />Cls<br />Cursor Off<br />Lcd &quot;Sternik&quot;<br />Wait 2<br />Cls<br />'-------------------------------------------------------------------------------<br />'***PWM DLA LED i WENTYLATORA***<br />'-------------------------------------------------------------------------------<br />Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down , Prescale = 1<br />'Config Timer2 = Counter , Acync = Off , Compare = Disconnect , Prescale = 1<br />Dim L As Byte<br />L = 0<br />Pwm1a = 0<br />Pwm1b = 0<br />'Enable Interrupts<br />'Enable Timer1<br />'-------------------------------------------------------------------------------<br />'***Deklaracje***<br />'-------------------------------------------------------------------------------<br />Ok Alias Pind.6                                             'przyciski<br />Lewo Alias Pind.7<br />Prawo Alias Pind.5<br />Wyjdz Alias Pinb.0<br />Dim T1c As Integer<br />'Dim T2c As Integer<br />Dim T3c As Integer<br />Dim I As Integer                                            'zmienne do obsługi temp.<br />Dim S As Integer<br />Dim Z As Integer<br />Dim Tgrz As Integer<br />'Dim Hist As Integer<br />Dim T As String * 5<br />Dim Tnas As String * 5<br />Dim Sekundy As Byte                                         'zmienne zegara<br />Dim Minuty As Byte<br />Dim Godziny As Byte<br />'Dim Mzk1 As Byte                                            'zmienne karmnika<br />'Dim Gzk1 As Byte<br />'Dim Swk1 As Byte<br />'Dim Mwk1 As Byte<br />'Dim Skpom As Byte<br />'Dim Mkpom As Byte<br />Dim Menusel As Byte                                         'zmienna do case<br />Dim E As Byte                                               'stan lampy 2<br />Dim F As Byte                                               'stan lampy 1<br />Dim B As Byte                                               'stan lampy 3<br />Dim Kz As Byte<br />Dim Licznik As Byte<br />Dim G As Bit                                                'stan karmnika<br />'Dim B As Bit                                                'do wyswietlania odwrotnosci stanów portów lamp i grzalki<br />'Dim C As Bit<br />'Dim D As Bit<br />Dim A As Byte<br />Dim Msg As Word , Licznik1 As Byte<br />Dim Temp_str As String * 16 , Temp_str_bajty(17) As Byte At Temp_str Overlay<br />Dim Tablica(12) As Byte                                     'tablica odczytu z eeprom<br />Dim Mz1 As Byte At Tablica Overlay<br />Dim Gz1 As Byte At Tablica + 1 Overlay                      'odczytuje po restarcie<br />Dim Gz4 As Byte At Tablica + 2 Overlay                      'nastawione czasy<br />Dim Gz2 As Byte At Tablica + 3 Overlay                      'załączania i wyłączania<br />Dim Mz3 As Byte At Tablica + 4 Overlay                      'lamp<br />Dim Gz3 As Byte At Tablica + 5 Overlay<br />Dim Mw1 As Byte At Tablica + 6 Overlay<br />Dim Gw1 As Byte At Tablica + 7 Overlay<br />Dim Gw4 As Byte At Tablica + 8 Overlay<br />Dim Gw2 As Byte At Tablica + 9 Overlay<br />Dim Mw3 As Byte At Tablica + 10 Overlay<br />Dim Gw3 As Byte At Tablica + 11 Overlay<br />Dim Gz5 As Byte , Gw5 As Byte<br />'--------stałe z adresami łańcuchów w eepromie----------------------------------<br />Const Msg_czas = 18<br />Const Msg_osw = 35<br />Const Msg_grzalka = 52<br />Const Msg_l1z = 69<br />Const Msg_l1w = 86<br />Const Msg_l2z = 103<br />Const Msg_l2w = 120<br />Const Msg_ledz = 137<br />Const Msg_ledw = 154<br />Const Msg_menu = 171<br />Const Msg_mosw = 188<br />Const Msg_gms = 205<br />Const Msg_l1gm = 222<br />Const Msg_wlacz = 239<br />Const Msg_wylacz = 256<br />Const Msg_l2gm = 273<br />Const Msg_ledgm = 290<br />Const Msg_ugrz = 307<br />Const Msg_karm = 324<br />Const Msg_cur = 341<br />Const Msg_cdz = 358<br />Const Msg_zalkarm = 375<br />Const Msg_ledgm2 = 396<br />Const Msg_ledz2 = 413<br />Const Msg_ledw2 = 430<br />Const Msg_l3z = 451<br />Const Msg_l3w = 468<br />Const Msg_l3gm = 485<br />'-------------------------------------------------------------------------------<br />Const Loc11 = &amp;H0000                                        ' 15 bit zgaszony locate 1,1<br />Const Loc21 = &amp;H8000                                        ' 15 bit ustawiony locate 2,1<br />'-------------------------------------------------------------------------------<br />Const Ds1307w = &amp;HD0                                        'stałe odczytu, zapisu ds1307<br />Const Ds1307r = &amp;HD1<br />'===============================================================================<br />'ustawienia po restarcie<br />I2cinit                                                     'magistrala i2c<br />Config Twi = 100000<br />Delay<br />'===============================================================================<br /> 'zmiana ds18b20 na 10bit'<br />   '1wreset<br />   '1wwrite &amp;HCC<br />   '1wwrite &amp;H4E<br />   '1wwrite &amp;H00                                             '1bajt<br />   '1wwrite &amp;H00                                             '2bajt<br />   '1wwrite &amp;B00111111                                       '3bajt<br />   '1wreset<br />   'Enable Interrupts<br />'-------------------------------------------------------------------------------<br />Menusel = 1<br />G = 1<br />Readeeprom F , 16<br />   If F = 1 Then                                            'sprawdza stan lampy 1<br />   Set Portb.4                                              'przed resetem<br />   Else                                                     'i ustawia taki sam stan<br />   Reset Portb.4<br />   End If<br />Readeeprom E , 17<br />   If E = 1 Then                                            'sprawdza stan lampy 2<br />   Set Portb.5                                              'przed resetem<br />   Else                                                     'i ustawia taki sam stan<br />   Reset Portb.5<br />   End If<br />Readeeprom B , 450<br />   If B = 1 Then                                            'sprawdza stan lampy 3<br />   Set Portc.0                                              'przed resetem<br />   Else                                                     'i ustawia taki sam stan<br />   Reset Portc.0<br />   End If<br />Readeeprom L , 395                                          'sprawdzamy czy przed restartem<br />   If L &gt; 0 Then<br />   Set Portb.2                                              'led był załączony czy wyłączony<br />   Else                                                     'i ustawiamy ten sam stan po resecie<br />   Reset Portb.2<br />   End If<br />'Readeeprom Kz , 447<br />'-------------------------------------------------------------------------------<br />'***WATCHDOG - zabezpieczenie przed zawieszeniem programu***<br />'-------------------------------------------------------------------------------<br />Config Watchdog = 2048                                      'reset wystąpi po 2048ms<br />Start Watchdog<br />'-------------------------------------------------------------------------------<br />'***Pętla główna***<br />'-------------------------------------------------------------------------------<br />Do<br />   If Ok = 0 Then                                           'wejście do menu<br />   Waitms 50<br />   If Ok = 0 Then<br />   Gosub Menu<br />   End If<br />   End If<br /><br />   If Lewo = 0 Then                                         'reczne zalaczenie lampy A<br />   Waitms 50<br />   If Lewo = 0 Then<br />   Toggle Portb.4<br />   Stop Watchdog<br />   Bitwait Lewo , Set<br />   Start Watchdog<br />   End If<br />   End If<br /><br />   If Prawo = 0 Then                                        'reczne zalaczenie lampy B<br />   Waitms 50<br />   If Prawo = 0 Then<br />   Toggle Portb.5<br />   Stop Watchdog<br />   Bitwait Prawo , Set<br />   Start Watchdog<br />   End If<br />   End If<br /><br />   If Wyjdz = 0 Then                                        'reczne zalaczenie lampy C<br />   Waitms 50<br />   If Wyjdz = 0 Then<br />   Toggle Portc.0<br />   Stop Watchdog<br />   Bitwait Wyjdz , Set<br />   Start Watchdog<br />   End If<br />   End If<br /><br />   Gosub Ds1307                                             'odczyt i wyswietlanie godziny<br /><br /><br />   A = Sekundy Mod 10<br />   If A = 0 Then<br />         1wreset                                            ' obsluga ds18b20<br />      If Err = 1 Then                                       ' brak ds omija procedure<br />         Locate 1 , 11                                      '<br />         Lcd &quot;Error &quot;                                       '<br />         'Set Portc.0<br />         'Pwm1a = 0<br />      Else                                                  '<br />         1wwrite &amp;HCC                                       'pominięcie odczytu ROMu<br />         1wwrite &amp;H44                                       '<br />         Waitms 750                                         'dla 12bit<br />         1wreset                                            '<br />         1wwrite &amp;HCC                                       'pominięcie odczytu ROMu<br />         1wwrite &amp;HBE                                       '<br /><br />         I = 1wread(2)                                      'przeliczanie temperatury do wyswietlenia<br />         S = I * 10                                         ' 733/16 = 45,8125  ---&gt;&gt;  (733*10) \ 16 = 458<br />         Shift S , Right , 4                                ' przesunięcie o 4 bity w prawo = \16<br />         T = Str(s)                                         ' wynik jako łańcuch<br />         T = Format(t , &quot;0.0&quot;)<br /><br />         Locate 1 , 11                                      'wyswietla temperature<br />         Lcd T ; Chr(0) ; &quot;C&quot;<br /><br />         Readeeprom Tgrz , 13                               'odczyt nastawionej temperatury<br />         'Hist = Tgrz - 8                                    'histereza grzalki<br />         'If I &gt;= Tgrz Then                                  'wylacz grzalke<br />         'Set Portc.0<br />         'End If<br />         'If I &lt; Hist Then                                   'zalacz grzalke<br />         'Reset Portc.0<br />         'End If<br /><br />         T1c = Tgrz + 8                                     'progi zadziałania wentylatora<br />         'T2c = Tgrz + 16                                    '1*C=16<br />         T3c = Tgrz + 16<br />         Select Case I                                      'obsługa wentylatora<br />         Case Is &lt; T1c : Pwm1a = 0                          'wylaczony<br />         Case T1c To T3c : Pwm1a = 160                      '50% org 180<br />         'Case T2c To T3c : Pwm1a = 200                      '75%<br />         Case Is &gt; T3c : Pwm1a = 190                        '100%  org, &quot;255&quot;<br />         End Select<br />      End If<br />   End If<br /><br />   For Licznik = 1 To 12                                    'odczyt ustawien z eepromu<br />   Readeeprom Tablica(licznik) , Licznik<br />   Next Licznik<br /><br />   Readeeprom Gz5 , 448<br />   Readeeprom Gw5 , 449<br /><br />If Gz1 = Godziny Then                                       'warunek zalaczenia lampy 1<br />   If Mz1 = Minuty Then<br />      If F = 0 Then<br />          Set Portb.4<br />          F = 1<br />          Writeeeprom F , 16<br />      End If<br />   End If<br />End If<br />If Gw1 = Godziny Then                                       'warunek wylaczenia lampy 1<br />   If Mw1 = Minuty Then<br />      If F = 1 Then<br />          Reset Portb.4<br />          F = 0<br />          Writeeeprom F , 16<br />      End If<br />   End If<br />End If<br />If Gz2 = Godziny Then                                       'warunek zalaczenia lampy 2<br />      If E = 0 Then<br />          Set Portb.5<br />          E = 1<br />          Writeeeprom E , 17<br />      End If<br />End If<br />If Gw2 = Godziny Then                                       'warunek wylaczenia lampy 2<br />      If E = 1 Then<br />          Reset Portb.5<br />          E = 0<br />          Writeeeprom E , 17<br />      End If<br />End If<br /><br />If Gz5 = Godziny Then                                       'warunek zalaczenia lampy 3<br />   'If Mz1 = Minuty Then<br />      If B = 0 Then<br />          Set Portc.0<br />          B = 1<br />          Writeeeprom B , 450<br />      End If<br />  ' End If<br />End If<br />If Gw5 = Godziny Then                                       'warunek wylaczenia lampy 3<br />   'If Mw1 = Minuty Then<br />      If B = 1 Then<br />          Reset Portc.0<br />          B = 0<br />          Writeeeprom B , 450<br />     ' End If<br />   End If<br />End If<br />'         Readeeprom Mzk1 , 393<br />'         Readeeprom Gzk1 , 394<br />'If Gzk1 = Godziny Then                                      'warunek zalaczenia karmnika<br />'   If Mzk1 = Minuty Then<br />'      If G = 1 Then<br />'      Set Portb.3<br />'      G = 0<br />'          Gosub Wylkarm<br />'      End If<br />'   End If<br />'End If<br />'If Mwk1 = Minuty Then                                       'warunek wylaczenia karmnika<br />'   If Swk1 = Sekundy Then<br />'      If G = 0 Then<br />'         Reset Portb.3<br />'      End If<br />'   End If<br />'End If<br />'If Mwk1 &lt;&gt; Minuty Then<br />'   G = 1<br />'End If<br />  Readeeprom L , 395                                        'odczyt stanu pwm<br />   If Gz3 = Godziny Then                                    'warunek zalaczenia led noc<br />      If Mz3 = Minuty Then<br />         If L &lt; 255 Then<br />         Gosub Onled<br />         End If<br />      End If<br />   End If<br />   If Gw3 = Godziny Then                                    'warunek wylaczenia led noc<br />      If Mw3 = Minuty Then<br />      If L &gt; 0 Then<br />      Gosub Offled<br />      End If<br />      End If<br />   End If<br /><br />   If Gz4 = Godziny Then                                    'warunek zalaczenia led dzien<br />      If L &lt; 255 Then<br />      Gosub Onled<br />      End If<br />   End If<br />   If Gw4 = Godziny Then                                    'warunek wylaczenia led dzien<br />      If L &gt; 0 Then<br />      Gosub Offled<br />      End If<br />   End If<br /><br />   'If Portb.4 = 1 Then                                      'zmienne do wyswietlania stanów lamp i grzalki<br />   'B = 0<br />   'Else<br />   'B = 1<br />   'End If<br />   'If Portb.5 = 0 Then<br />   'C = 1<br />   'Else<br />   'C = 0<br />   'End If<br />   'If Portc.0 = 0 Then<br />   'D = 1<br />   'Else<br />   'D = 0<br />   'End If<br /><br />   Locate 1 , 7<br />   Lcd &quot;K:&quot; ; Portb.3<br />   Locate 2 , 1<br />   Lcd &quot;A:&quot; ; Portb.4 ; &quot; &quot; ; &quot;B:&quot; ; Portb.5 ; &quot; &quot; ; &quot;C:&quot; ; Portc.0 ; &quot; &quot; ; &quot;L:&quot; ; Portb.2<br /><br />   Reset Watchdog<br />Loop<br />'-------------------------------------------------------------------------------<br />'***Podprogramy***<br />'-------------------------------------------------------------------------------<br />Menu:                                                       'menu główne<br /><br />Stop Watchdog<br />Bitwait Pind.6 , Set<br />Start Watchdog<br /><br />Do<br /><br />Msg = Loc11 + Msg_menu                                      ' flaga locate i adres łańcucha w eeprom<br />Gosub Display_msg<br /><br />   If Prawo = 0 Then<br />      Waitms 100<br />      If Prawo = 0 Then<br />         Incr Menusel<br />         Waitms 250<br />           If Menusel = 5 Then<br />            Menusel = 1<br />           End If<br />      End If<br />   End If<br /><br />  If Lewo = 0 Then<br />      Waitms 100<br />      If Lewo = 0 Then<br />      Decr Menusel<br />      Waitms 250<br />            If Menusel = 0 Then<br />            Menusel = 4<br />            End If<br />      End If<br />  End If<br /><br />  If Wyjdz = 0 Then<br />   Waitms 100<br />  If Wyjdz = 0 Then<br />     Cls<br />     Reset Watchdog<br />     Exit Do<br />  End If<br />  End If<br /><br />   Select Case Menusel<br /><br />           Case 0:<br /><br />           Case 1:<br />           Msg = Loc21 + Msg_czas                           ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Uczas<br />           End If<br />           End If<br /><br />           Case 2:<br />           Msg = Loc21 + Msg_osw                            ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Menusw<br />           End If<br />           End If<br /><br />           Case 3:<br />           Msg = Loc21 + Msg_grzalka                        ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Grzalka<br />           End If<br />           End If<br /><br />           Case 4:<br />           Msg = Loc21 + Msg_karm                           ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           'If Ok = 0 Then<br />           'Waitms 50<br />           'If Ok = 0 Then<br />           'Gosub Karmnik<br />           'End If<br />           'End If<br /><br />   End Select<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Menusw:                                                     'podmenu oswietlenie<br />   Menusel = 1<br />   Stop Watchdog<br />   Bitwait Pind.6 , Set<br />   Start Watchdog<br />Do<br /><br />   Msg = Loc11 + Msg_mosw                                   'napis menu oswietlenie<br />   Gosub Display_msg<br /><br />   If Prawo = 0 Then                                        'obsluga przyciskow lewo,prawo,wyjdz<br />      Waitms 100<br />      If Prawo = 0 Then<br />         Incr Menusel<br />         Waitms 200<br />           If Menusel = 11 Then<br />            Menusel = 1<br />           End If<br />      End If<br />   End If<br /><br />   If Lewo = 0 Then<br />      Waitms 100<br />      If Lewo = 0 Then<br />      Decr Menusel<br />      Waitms 200<br />            If Menusel = 0 Then<br />            Menusel = 10<br />            End If<br />      End If<br />   End If<br /><br />   If Wyjdz = 0 Then<br />   Waitms 100<br />   If Wyjdz = 0 Then<br />         Cls<br />         Menusel = 2<br />         Stop Watchdog<br />         Bitwait Wyjdz , Set<br />         Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br /><br />   Select Case Menusel                                      'selektor menu<br /><br />           Case 0:<br /><br />           Case 1:<br />           Msg = Loc21 + Msg_l1z                            'zalacz lampe 1 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa1<br />           End If<br />           End If<br /><br />           Case 2:<br />           Msg = Loc21 + Msg_l1w                            'wylacz lampe 1 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa1a<br />           End If<br />           End If<br /><br />           Case 3:<br />           Msg = Loc21 + Msg_l2z                            'zalacz lampe 2 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa2<br />           End If<br />           End If<br /><br />           Case 4:<br />           Msg = Loc21 + Msg_l2w                            ' wylacz lampe 2 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa2a<br />           End If<br />           End If<br /><br />           Case 5:<br />           Msg = Loc21 + Msg_l3z                            'zalacz lampe 3 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa3<br />           End If<br />           End If<br /><br />           Case 6:<br />           Msg = Loc21 + Msg_l3w                            'wylacz lampe 3 o<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Lampa3a<br />           End If<br />           End If<br /><br />           Case 7:<br />           Msg = Loc21 + Msg_ledz                           ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Led<br />           End If<br />           End If<br /><br />           Case 8:<br />           Msg = Loc21 + Msg_ledw                           ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Leda<br />           End If<br />           End If<br /><br />           Case 9:<br />           Msg = Loc21 + Msg_ledz2                          ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Led2<br />           End If<br />           End If<br /><br />           Case 10:<br />           Msg = Loc21 + Msg_ledw2                          ' flaga locate i adres łańcucha w eeprom<br />           Gosub Display_msg<br />           If Ok = 0 Then<br />           Waitms 50<br />           If Ok = 0 Then<br />           Gosub Led2a<br />           End If<br />           End If<br />   End Select<br />   Reset Watchdog<br />Loop<br />Return<br />'===============================================================================<br />' podprogram wyświetlający łańcuch z eeprom na LCD<br />Display_msg:<br /><br />       If Msg.15 = 1 Then<br />          Locate 2 , 1<br />       Else<br />          Locate 1 , 1<br />       End If<br />       Msg.15 = 0                                           ' zgaś 15 bit<br />       Licznik1 = 0<br />   Do<br />      Incr Licznik1<br />      Readeeprom Temp_str_bajty(licznik1) , Msg<br />      Incr Msg<br />   Loop Until Temp_str_bajty(licznik1) = 0                  ' wyjdź z pętli jeżeli koniec łańcucha czyli 0<br />Lcd Temp_str<br />Reset Watchdog<br />Return<br />'-------------------------------------------------------------------------------<br />Uczas:                                                      'podprogram ustawienie czasu<br />      Msg = Loc21 + Msg_gms                                 ' flaga locate i adres łańcucha w eeprom<br />      Gosub Display_msg<br />   Do<br />      Gosub Ds1307<br />      If Lewo = 0 Then<br />         Waitms 50<br />      If Lewo = 0 Then<br />         Gosub Godz<br />         Waitms 300<br />      End If<br />      End If<br />      If Prawo = 0 Then<br />         Waitms 30<br />      If Prawo = 0 Then<br />         Gosub Minu<br />         Waitms 300<br />      End If<br />      End If<br /><br />      If Wyjdz = 0 Then<br />         Waitms 100<br />      If Wyjdz = 0 Then<br />         Gosub Seku<br />         Menusel = 1<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Cls<br />         Exit Do<br />      End If<br />      End If<br />      Reset Watchdog<br />   Loop<br />Return<br />'-------------------------------------------------------------------------------<br />'Karmnik:<br />  'Do<br />  '   Msg = Loc11 + Msg_cdz<br />  '   Gosub Display_msg<br />  '   Msg = Loc21 + Msg_cur<br />  '   Gosub Display_msg<br />  '<br />  '   If Lewo = 0 Then<br />  '   Waitms 50<br />  '   If Lewo = 0 Then<br />  '      Gosub Karmnikzal<br />  '   End If<br />  '   End If<br />  '<br />  '   If Prawo = 0 Then<br />  '   Waitms 50<br />  '   If Prawo = 0 Then<br />  '      Gosub Karmnikgodz<br />  '   End If<br />  '   End If<br />  '<br />  '   If Wyjdz = 0 Then<br />  '      Waitms 100<br />  '   If Wyjdz = 0 Then<br />  '      Menusel = 4<br />  '      Cls<br />        'Stop Watchdog<br />        ' Bitwait Wyjdz , Set<br />        ' Start Watchdog<br />  '      Exit Do<br />  '   End If<br />  '   End If<br />  '  Reset Watchdog<br />  'Loop<br />'Return<br />'-------------------------------------------------------------------------------<br />'Karmnikzal:<br />'   Msg = Loc11 + Msg_zalkarm                                ' flaga locate i adres łańcucha w eeprom<br />'   Gosub Display_msg<br />'   Stop Watchdog<br />'   Bitwait Pind.7 , Set<br />'   Start Watchdog<br />'   Readeeprom Kz , 447<br />'Do<br />'   Locate 2 , 1<br />'   If Kz &lt; 10 Then<br />'      Lcd &quot;na:  0&quot; ; Kz ; &quot;s&quot; ; Spc(8)<br />'   Else<br />'      Lcd &quot;na:  &quot; ; Kz ; &quot;s&quot; ; Spc(8)<br />'   End If<br />'<br />'  If Lewo = 0 Then<br />'      Decr Kz<br />'      Waitms 200<br />'   End If<br />'<br />'   If Prawo = 0 Then<br />'      Incr Kz<br />'      Waitms 200<br />'   End If<br />'<br />'   If Kz &gt; 59 Then : Kz = 0 : End If<br />'   If Kz &lt; 0 Then : Kz = 59 : End If<br />'<br />'  If Wyjdz = 0 Then<br />'         Waitms 100<br />'         If Wyjdz = 0 Then<br />'         Writeeeprom Kz , 447<br />'         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />'         Exit Do<br />'         End If<br />'         End If<br />'  Reset Watchdog<br />'Loop<br />'Return<br />'-------------------------------------------------------------------------------<br />'Karmnikgodz:<br />'   Msg = Loc11 + Msg_zalkarm                                ' flaga locate i adres łańcucha w eeprom<br />'   Gosub Display_msg<br />'   Bitwait Pind.5 , Set<br />'Do<br /><br />'   Locate 2 , 1<br />'      If Gzk1 &lt; 10 Then<br />'         Lcd &quot;o:  0&quot; ; Gzk1 ; &quot;:&quot; ;<br />'      Else<br />'         Lcd &quot;o:  &quot; ; Gzk1 ; &quot;:&quot; ;<br />'      End If<br />'<br />'      If Mzk1 &lt; 10 Then<br />'         Lcd &quot;0&quot; ; Mzk1 ; Spc(7)<br />'      Else<br />'         Lcd Mzk1 ; Spc(7)<br />'      End If<br />'<br />'   If Lewo = 0 Then<br />'      Incr Gzk1<br />'      Waitms 150<br />'   End If<br />'<br />'   If Prawo = 0 Then<br />'      Waitms 150<br />'      Incr Mzk1<br />'   End If<br /><br />'   If Gzk1 &gt; 23 Then : Gzk1 = 0 : End If<br />'   If Mzk1 &gt; 59 Then : Mzk1 = 0 : End If<br />'<br />'If Wyjdz = 0 Then<br />'         Waitms 100<br />'         If Wyjdz = 0 Then<br />'         Writeeeprom Mzk1 , 393<br />'         Writeeeprom Gzk1 , 394<br />'         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />'         Exit Do<br />'        End If<br />'         End If<br />'  Reset Watchdog<br />'Loop<br />'Return<br />'-------------------------------------------------------------------------------<br />'Wylkarm:<br />'Readeeprom Kz , 447<br />'Skpom = Sekundy + Kz<br />'   If Skpom &gt; 59 Then<br />'   Swk1 = Skpom Mod 60<br />'   Mkpom = Skpom \ 60<br />'   Mkpom = Minuty + Mkpom<br />'       If Mkpom &gt; 59 Then<br />'       Mwk1 = Mkpom Mod 60<br />'       Else<br />'       Mwk1 = Mkpom<br />'       End If<br />'   Else<br />'   Swk1 = Skpom<br />'   Mwk1 = Minuty<br />'   End If<br />'Return<br />'-------------------------------------------------------------------------------<br />Lampa1:<br />Msg = Loc11 + Msg_l1gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mz1 , 1<br />   Readeeprom Gz1 , 2<br />Do<br />   If Lewo = 0 Then<br />   Incr Gz1<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mz1<br />   Waitms 200<br />   End If<br /><br />   If Gz1 &gt; 23 Then : Gz1 = 0 : End If<br />   If Mz1 &gt; 59 Then : Mz1 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gz1 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz1 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gz1 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mz1 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mz1<br />         Else<br />            Lcd Mz1<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />     Writeeeprom Mz1 , 1<br />   Writeeeprom Gz1 , 2<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Lampa1a:<br />Msg = Loc11 + Msg_l1gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />      Msg = Loc21 + Msg_wylacz                              ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mw1 , 7<br />   Readeeprom Gw1 , 8<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw1<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mw1<br />   Waitms 200<br />   End If<br /><br />   If Gw1 &gt; 23 Then : Gw1 = 0 : End If<br />   If Mw1 &gt; 59 Then : Mw1 = 0 : End If<br />   Locate 2 , 12<br />      If Gw1 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw1 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gw1 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mw1 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mw1<br />         Else<br />            Lcd Mw1<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Mw1 , 7<br />   Writeeeprom Gw1 , 8<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Lampa2:                                                     'zalaczanie lampy 2<br />Msg = Loc11 + Msg_l2gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gz2 , 4<br /><br />Do<br />   If Lewo = 0 Then<br />   Incr Gz2<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gz2<br />   Waitms 200<br />   End If<br /><br />   If Gz2 &gt; 23 Then : Gz2 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gz2 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz2 ; &quot;:00&quot;<br />         Else<br />            Lcd Gz2 ; &quot;:00&quot;<br />         End If<br /><br />     If Wyjdz = 0 Then<br />         Waitms 100<br />     If Wyjdz = 0 Then<br />      Writeeeprom Gz2 , 4<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />      End If<br />      End If<br />         Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Lampa2a:<br />Msg = Loc11 + Msg_l2gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wylacz                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gw2 , 10<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw2<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gw2<br />   Waitms 200<br />   End If<br /><br />   If Gw2 &gt; 23 Then : Gw2 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gw2 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw2 ; &quot;:00&quot;<br />         Else<br />            Lcd Gw2 ; &quot;:00&quot;<br />      End If<br /><br />     If Wyjdz = 0 Then<br />         Waitms 100<br />     If Wyjdz = 0 Then<br />      Writeeeprom Gw2 , 10<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />      End If<br />      End If<br />         Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br /><br />Lampa3:<br />Msg = Loc11 + Msg_l3gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   'Readeeprom Mz1 , 1<br />   Readeeprom Gz5 , 448<br />Do<br />   If Lewo = 0 Then<br />   Decr Gz5<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Gz5<br />   Waitms 200<br />   End If<br /><br />   If Gz5 &gt; 23 Then : Gz5 = 0 : End If<br />   'If Mz1 &gt; 59 Then : Mz1 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gz5 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz5 ; &quot;:00&quot; ;<br />         Else<br />            Lcd Gz5 ; &quot;:00&quot; ;<br />         End If<br /><br />        ' If Mz1 &lt; 10 Then<br />         '   Lcd &quot;0&quot; ; Mz1<br />         'Else<br />         '   Lcd Mz1<br />         'End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />     'Writeeeprom Mz1 , 1<br />   Writeeeprom Gz5 , 448<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Lampa3a:<br />Msg = Loc11 + Msg_l3gm                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />      Msg = Loc21 + Msg_wylacz                              ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mw1 , 7<br />   Readeeprom Gw5 , 449<br />Do<br />   If Lewo = 0 Then<br />   Decr Gw5<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Gw5<br />   Waitms 200<br />   End If<br /><br />   If Gw5 &gt; 23 Then : Gw5 = 0 : End If<br />   If Mw1 &gt; 59 Then : Mw1 = 0 : End If<br />   Locate 2 , 12<br />      If Gw5 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw5 ; &quot;:00&quot; ;<br />         Else<br />            Lcd Gw5 ; &quot;:00&quot; ;<br />         End If<br /><br />         If Mw1 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mw1<br />         Else<br />            Lcd Mw1<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Mw1 , 7<br />   Writeeeprom Gw5 , 449<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Onled:                                                      'zalaczenie z 30s rozjasnianiem leda<br />Do<br />   If L &lt; 255 Then<br />   Incr Pwm1b<br />   Waitms 100<br />   L = Pwm1b<br />   Else<br />   Set Portb.2<br />   Writeeeprom L , 395<br />   Exit Do<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br /> '-------------------------------------------------------------------------------<br />Offled:                                                     'wylaczenie z 30s sciemnianiem leda<br />Do<br />   If L &gt; 0 Then<br />   Decr Pwm1b<br />   Waitms 100<br />   L = Pwm1b<br />   Else<br />   Reset Portb.2<br />   Writeeeprom L , 395<br />   Exit Do<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led:<br />Msg = Loc11 + Msg_ledgm                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mz3 , 5<br />   Readeeprom Gz3 , 6<br />Do<br />   If Lewo = 0 Then<br />   Incr Gz3<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mz3<br />   Waitms 200<br />   End If<br /><br />   If Gz3 &gt; 23 Then : Gz3 = 0 : End If<br />   If Mz3 &gt; 59 Then : Mz3 = 0 : End If<br />   Locate 2 , 12<br />      If Gz3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz3 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gz3 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mz3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mz3<br />         Else<br />            Lcd Mz3<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />      Writeeeprom Mz3 , 5<br />   Writeeeprom Gz3 , 6<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Leda:<br />Msg = Loc11 + Msg_ledgm                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wylacz                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Mw3 , 11<br />   Readeeprom Gw3 , 12<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw3<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Incr Mw3<br />   Waitms 200<br />   End If<br /><br />   If Gw3 &gt; 23 Then : Gw3 = 0 : End If<br />   If Mw3 &gt; 59 Then : Mw3 = 0 : End If<br />   Locate 2 , 12<br />      If Gw3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw3 ; &quot;:&quot; ;<br />         Else<br />            Lcd Gw3 ; &quot;:&quot; ;<br />         End If<br /><br />         If Mw3 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Mw3<br />         Else<br />            Lcd Mw3<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Mw3 , 11<br />   Writeeeprom Gw3 , 12<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led2:<br />Msg = Loc11 + Msg_ledgm2                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wlacz                                     ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gz4 , 3<br />Do<br />   If Lewo = 0 Then<br />   Incr Gz4<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gz4<br />   Waitms 200<br />   End If<br /><br />   If Gz4 &gt; 23 Then : Gz4 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gz4 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gz4 ; &quot;:00&quot;<br />         Else<br />            Lcd Gz4 ; &quot;:00&quot;<br />      End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />      Writeeeprom Gz4 , 3<br /><br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Led2a:<br />Msg = Loc11 + Msg_ledgm2                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br />Msg = Loc21 + Msg_wylacz                                    ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Gw4 , 9<br />Do<br />   If Lewo = 0 Then<br />   Incr Gw4<br />   Waitms 200<br />   End If<br /><br />   If Prawo = 0 Then<br />   Decr Gw4<br />   Waitms 200<br />   End If<br /><br />   If Gw4 &gt; 23 Then : Gw4 = 0 : End If<br /><br />   Locate 2 , 12<br />      If Gw4 &lt; 10 Then<br />            Lcd &quot;0&quot; ; Gw4 ; &quot;:00&quot;<br />         Else<br />            Lcd Gw4 ; &quot;:00&quot;<br />         End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Gw4 , 9<br />         Cls<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br />Grzalka:<br />Msg = Loc11 + Msg_ugrz                                      ' flaga locate i adres łańcucha w eeprom<br />   Gosub Display_msg<br /><br />   Readeeprom Tgrz , 13<br />Do<br />   Z = Tgrz * 10<br />   Shift Z , Right , 4                                      ' przesunięcie o 4 bity w prawo = \16<br />   Tnas = Str(z)                                            ' wynik jako łańcuch<br />   Tnas = Format(tnas , &quot;0.0&quot;)<br /><br />   If Tgrz &lt; 160 Then<br />   Locate 2 , 1<br />   Lcd Spc(5) ; &quot;0&quot; ; Tnas ; Chr(0) ; &quot;C&quot; ; Spc(5)<br />   Elseif Tgrz &gt;= 160 Then<br />   Locate 2 , 1<br />   Lcd Spc(5) ; Tnas ; Chr(0) ; &quot;C&quot; ; Spc(5)<br />   End If<br /><br />   If Tgrz &gt; 512 Then : Tgrz = 512 : End If<br />   If Tgrz &lt;= 0 Then : Tgrz = 0 : End If<br /><br />   If Prawo = 0 Then<br />      Waitms 30<br />         If Prawo = 0 Then<br />         Incr Tgrz<br />         Waitms 30<br />         End If<br />   End If<br /><br />   If Lewo = 0 Then<br />      Waitms 30<br />         If Lewo = 0 Then<br />         Decr Tgrz<br />         Waitms 30<br />         End If<br />   End If<br /><br />   If Wyjdz = 0 Then<br />         Waitms 100<br />   If Wyjdz = 0 Then<br />   Writeeeprom Tgrz , 13<br />         Cls<br />         Menusel = 3<br />         'Stop Watchdog<br />         'Bitwait Wyjdz , Set<br />         'Start Watchdog<br />         Exit Do<br />   End If<br />   End If<br />   Reset Watchdog<br />Loop<br />Return<br />'-------------------------------------------------------------------------------<br /> Ds1307:                                                    'odczytaj i wyświetl godzinę<br />        I2cstart<br />        I2cwbyte Ds1307w<br />        I2cwbyte 0<br />        I2cstart<br />        I2cwbyte Ds1307r<br />        I2crbyte Sekundy , Ack<br />        I2crbyte Minuty , Ack<br />        I2crbyte Godziny , Nack<br />        I2cstop<br /><br />        Sekundy = Makedec(sekundy) : Minuty = Makedec(minuty) : Godziny = Makedec(godziny)<br /><br />        'If Sekundy &gt; 59 Then<br />        'Sekundy = 0<br />        'End If<br />        'If Minuty &gt; 59 Then<br />        'Minuty = 0<br />        'End If<br />        'If Godziny &gt; 23 Then<br />        'Godziny = 0<br />        'End If<br /><br />         Locate 1 , 1<br />         If Godziny &lt; 10 Then<br />            Lcd &quot;0&quot; ; Godziny ; &quot;:&quot; ;<br />         Else<br />            Lcd Godziny ; &quot;:&quot; ;<br />         End If<br /><br />         If Minuty &lt; 10 Then<br />            Lcd &quot;0&quot; ; Minuty<br />         Else<br />            Lcd Minuty<br />         End If<br />Return<br />'-------------------------------------------------------------------------------<br />Seku:<br />         Incr Sekundy<br />         If Sekundy &gt; 59 Then<br />         Sekundy = 0<br />         End If<br />         Sekundy = Makebcd(sekundy)<br />         I2cstart<br />         I2cwbyte Ds1307w<br />         I2cwbyte 0<br />         I2cwbyte Sekundy<br />Return<br />'-------------------------------------------------------------------------------<br />Minu:<br />         Incr Minuty<br />         If Minuty &gt; 59 Then<br />         Minuty = 0<br />         End If<br />         Minuty = Makebcd(minuty)<br />         I2cstart<br />         I2cwbyte Ds1307w<br />         I2cwbyte 1<br />         I2cwbyte Minuty<br />Return<br />'-------------------------------------------------------------------------------<br />Godz:<br />         Incr Godziny<br />         If Godziny &gt; 23 Then<br />         Godziny = 0<br />         End If<br />         Godziny = Makebcd(godziny)<br />         I2cstart<br />         I2cwbyte Ds1307w<br />         I2cwbyte 2<br />         I2cwbyte Godziny<br />Return<br />'-------------------------------------------------------------------------------<br />'eeprom<br />'-------------------------------------------------------------------------------<br />$eeprom<br />' bajty od 0 do 17 zarezerwowane na ustawienia<br />Data 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,<br /><br />'Msg1:<br />   Data &quot;Ustaw czas      &quot; ,                                ' to się zaczyna od adresu 18 do 34<br />'Msg2:<br />   Data &quot;Oswietlenie     &quot; ,                                ' to się zaczyna od adresu 35 do 51<br />'Msg3:<br />   Data &quot;Wentylator      &quot; ,                                ' to się zaczyna od adresu 52 do 68<br />'Msg4:<br />   Data &quot;LampaA zalacz o:&quot;,                                 ' to się zaczyna od adresu 69 do 85<br />'Msg5:<br />   Data &quot;LampaA wylacz o:&quot;,                                 ' to się zaczyna od adresu 86 do 102<br />'Msg6:<br />   Data &quot;LampaB zalacz o:&quot;,                                 ' to się zaczyna od adresu 103 do 119<br />'Msg7:<br />   Data &quot;LampaB wylacz o:&quot;,                                 ' to się zaczyna od adresu 120 do 136<br />'Msg8:<br />   Data &quot;Led N zalacz o: &quot;,                                 ' to się zaczyna od adresu 137 do 153<br />'Msg9:<br />   Data &quot;Led N wylacz o: &quot;,                                 ' to się zaczyna od adresu 154 do 170<br />'Msg10:<br />   Data &quot;Menu:           &quot;,                                 ' to się zaczyna od adresu 171 do 187<br />'Msg11:<br />   Data &quot;Menu oswietlenie&quot;,                                 ' to się zaczyna od adresu 188 do 204<br />'Msg12:<br />   Data &quot;&lt;=G          &gt;=M&quot;,                                 ' to się zaczyna od adresu 205 do 221<br />'Msg13:<br />   Data &quot;Lampa A  &lt;=G M=&gt;&quot;,                                 ' to się zaczyna od adresu 222 do 238<br />'Msg14:<br />   Data &quot;Wlacz o:        &quot;,                                 ' to się zaczyna od adresu 239 do 255<br />'Msg15<br />   Data &quot;Wylacz o:       &quot;,                                 ' to się zaczyna od adresu 256 do 272<br />'Msg16<br />   Data &quot;Lampa B    &lt;=G=&gt;&quot;,                                 ' to się zaczyna od adresu 273 do 289<br />'Msg17<br />   Data &quot;LED noc  &lt;=G M=&gt;&quot;,                                 ' to się zaczyna od adresu 290 do 306<br />'Msg18<br />   Data &quot;Ustaw wentylator&quot;,                                 ' to się zaczyna od adresu 307 do 323<br />'Msg19<br />   Data &quot;Karmnik opcja   &quot;,                                 ' to się zaczyna od adresu 324 do 340<br />'Msg20<br />   Data &quot;&lt; czas dzialania&quot;,                                 ' to się zaczyna od adresu 341 do 357<br />'Msg21<br />   Data &quot;godz.wlaczania &gt;&quot;,                                 ' to się zaczyna od adresu 358 do 374<br />'Msg22<br />   Data &quot;Zalacz karmnik  &quot;,                                 ' to się zaczyna od adresu 375 do 391<br /><br />   Data 0 , 0 , 0 , 0 ,                                     '     rezerwacja od 392 do 395<br />'Msg23<br />   Data &quot;LED dzien  &lt;=G=&gt;&quot;,                                 ' to się zaczyna od adresu 396 do 412<br />'Msg24:<br />   Data &quot;Led D zalacz o: &quot;,                                 ' to się zaczyna od adresu 413 do 429<br />'Msg25:<br />   Data &quot;Led D wylacz o: &quot;,                                 ' to się zaczyna od adresu 430 do 446<br />   Data 0 , 0 , 0 , 0                                       'dla karmnika 447, lampa c 448,449,450<br />'msg26:<br />   Data &quot;LampaC zalacz o:&quot;,                                 '451 do 466<br />'msg27:<br />   Data &quot;LampaC wylacz o:&quot;,                                 '468 do 484<br />'msg28:<br />   Data &quot;Lampa C    &lt;=G=&gt;&quot;,                                 '485 do 500<br /><br />$data[/syntax]<br /><br /><span style="color: #80FF00"><strong><span style="font-size: 150%; line-height: normal">Autor nie zezwala na komercyjne użytkowanie projektu, zwłaszcza oprogramowania, szczególnie w celach zarobkowych.</span></strong></span><br /><br />Może znajdzie się jakiś kolega i sprawdzi co jest nie tak.<br /><br />Pozdrawiam i liczę na szybką odpowiedź<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=2934">miiik91</a> — 6 sty 2015, o 14:42</p><hr />
]]></content>
</entry>
</feed>