- Labornetzteil AliExpress         
Seite 2 von 3 ErsteErste 123 LetzteLetzte
Ergebnis 11 bis 20 von 30

Thema: DS1307 RTC mit Bascom

  1. #11
    Benutzer Stammmitglied
    Registriert seit
    09.05.2005
    Beiträge
    35
    Anzeige

    LiFePo4 Akku selber bauen - Video
    Hallo,
    hab inzwischen den code am laufen, PRoblem, war, dass ich beim auslesen am Ende ein nack vergessen hab.
    gruß
    florian

  2. #12
    dl1akp
    Gast

    ds1307 geht nicht

    Hallo,

    bei mir ging der rtc ds1307 noch nie...

    Habe den Code von avrflo probiert, ebenfalls nbegativ.

    Meine verbindungsleitung vom rtc zum AVR sind ca. 10cm. Soll es daran liegen?? Ich kanns mir nicht vorstellen, das ist nun wirklich nicht viel.

    Weis jemand Rat??

    Tschau, Andreas

  3. #13
    Erfahrener Benutzer Roboter-Spezialist
    Registriert seit
    16.06.2005
    Ort
    Göppingen
    Beiträge
    360
    @avrflo
    könntest du mir den funktionierenden code bitte zusenden. danke.

  4. #14
    Neuer Benutzer Öfters hier
    Registriert seit
    05.08.2006
    Ort
    In der Nähe von Hannover
    Alter
    35
    Beiträge
    26
    Hallo, ich habe den Code avrflo so übernommen und das letzte ack in ein nack umgeändert. Er kann auch lesen und schreiben, aber der timer zählt nicht. Das heißt ich krieg immer das gleiche zurück...Was mach ich falsch?

    btw. ich benutze ien RN-Control mit atmega 16, einem 16mhz quarz und dem ds 1307 am I2C port (allerdings ohne irgendwelche pull-ups)

  5. #15
    Neuer Benutzer Öfters hier
    Registriert seit
    05.08.2006
    Ort
    In der Nähe von Hannover
    Alter
    35
    Beiträge
    26
    duh...Hat sich erledigt. Hat sich rausgestellt, dass ein Pin des Osszilators nicht angeschlossen war =/
    Erst posten und dann nach 5 min selbst beheben^^

  6. #16
    Neuer Benutzer Öfters hier
    Registriert seit
    11.04.2005
    Beiträge
    9

    super

    Hallo,

    Wie macht man dass den wehn man so eine uhr machen mochte mit dem
    1307 und mega8 auf ein lcd.

    wurde super sein wehn dass aug funktioniert.

    gruss Rene

  7. #17
    Neuer Benutzer Öfters hier
    Registriert seit
    05.08.2006
    Ort
    In der Nähe von Hannover
    Alter
    35
    Beiträge
    26
    ehm...zu schnell geschrieben?
    Andererseits hilft der Duden.

    Zu deiner Frage:
    Du schließt den DS1307 gemäß des Datenblattes an und hängst diesen an den I2C Port deines Atmegas.
    (btw. es wäre nett zu wissen ob du nur den Kontroller oder ein RN-Board o.ä. benutzt)

    Jetzt hängt es von der Art deines LCD's ab, wie du die Zeit darstellen möchtest?

    1. Möglichkeit:

    Du machst es dir einfach und benutzt ein Textmatrix LCD und schließt es gemäß der Bascom Hilfe (benutzt du Bascom??) an.

    2. Möglichkeit:

    Du benutzt ein Grafiklcd und es wird komplexer.
    Dabei hilft die Suchfunktion und das LCD von www.pollin.de Aber mehr dazu wenn du es benutzt (bin müde und will net so viel schreiben)

    Der Code für den Atmega hängt von deiner Entwicklungsumgebung sowie der Hardware ab.

    MfG

    Florian

  8. #18
    Neuer Benutzer Öfters hier
    Registriert seit
    11.04.2005
    Beiträge
    9

    hallo

    Hallo Gador.

    So gut bin ich leider nicht.

    Wolte mall versuchen mit Bascom und eine mega8 oder mega16
    und eine normalen lcd habe hier eine 4x20 lcd
    angeslossen auf experimentier bret.

    (bin Hollander also entschuldige fuhr die schreib fehler)

    Wass ich spater gerne machen wurde ware eine
    stecker block mit ca 3 oder 4 stecker 220volt. die ich
    an/aus schalten konte auf eine bestimte zeit ( fuhr dem aquarium)
    also licht an/aus luft pumpe and aus, co2 an /aus ext.

    leide bin ich nicht so gut und meistens wehns auf programieren an komt ab kucken fon andere stucke fon anderen.

    wehn ich also su ert mall 4 led's an/aus schalten konte um seperat su programieren seiten wurde ich shon extrem fro sein dass 220 volt teil komt dan spater, ob mit transistor oder relais...

    Also wehn jemanden gute iedee hat lass horen, fieleigt gibs soetwas shon??

    habe gesucht aber meisten ist da fieles mehr dran gemacht wie ph messung, und oder temperatur.. aber dass brauche ich nicht.

    mfg Rene

  9. #19
    Neuer Benutzer Öfters hier
    Registriert seit
    11.04.2005
    Beiträge
    9

    uhr lauft

    Hallo habe jezt dem uhr laufen auf nem lcd.

    aber wie schreibe ich ein routiner sum einstellen fon dieser uhr.
    also datum und seit, mit 2 oder 4 taster.

    Code:
    $regfile = "m8def.dat"
    $crystal = 8000000
    $baud = 9600
    Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2
    
    Config Lcd = 20 * 4
    Config Sda = Portc.4
    Config Scl = Portc.5
    Cls
    
    
    $lib "mcsbyte.lbx"                                          ' for smaller code
    $lib "ds1307rtc.lib"                                        ' modified lib
    
    'address of ds1307
    Const Ds1307w = &HD0                                        ' Addresses of Ds1307 clock
    Const Ds1307r = &HD1
    
    Config Clock = User                                         ' this will dim the bytes automatic
    'dim other needed variables
    Dim Weekday As Byte
    Locate 1 , 1
    Lcd "DS1307"
    Waitms 100
    ' assigning the time will call the SetTime routine
    Time$ = "23:58:59"                                          ' to watch the day changing value
    Date$ = "11-13-02"                                          ' 13 november 2002
    Do
    Cls
      Locate 1 , 1
      Lcd "Datum: " ; Date$ ;
      Locate 2 , 1
      Lcd "Tijd: " ; Time$
      Waitms 500
    Loop
    
    End
    
    'called from ds1307clock.lib
    Getdatetime:
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 0                                                ' start address in 1307
    
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307r                                          ' send address
      I2crbyte _sec , Ack
      I2crbyte _min , Ack                                       ' MINUTES
      I2crbyte _hour , Ack                                      ' Hours
      I2crbyte Weekday , Ack                                    ' Day of Week
      I2crbyte _day , Ack                                       ' Day of Month
      I2crbyte _month , Ack                                     ' Month of Year
      I2crbyte _year , Nack                                     ' Year
      I2cstop
      _sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour)
      _day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year)
    Return
    
    Setdate:
      _day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year)
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 4                                                ' starting address in 1307
      I2cwbyte _day                                             ' Send Data to SECONDS
      I2cwbyte _month                                           ' MINUTES
      I2cwbyte _year                                            ' Hours
      I2cstop
    Return
    
    Settime:
      _sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour)
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 0                                                ' starting address in 1307
      I2cwbyte _sec                                             ' Send Data to SECONDS
      I2cwbyte _min                                             ' MINUTES
      I2cwbyte _hour                                            ' Hours
      I2cstop
    Return

  10. #20
    Neuer Benutzer Öfters hier
    Registriert seit
    11.04.2005
    Beiträge
    9

    Mehr platz

    Hallo,

    Ich habe jezt dem DS1307 und eine ds18b02 ans laufen
    und diverse stucke code gemacht so dass es shon lauft
    aber ich denke dass ich alles viel su gross habe da ich jetz fast gein platz mehr hebbe auf meinen Mega8

    ich wurde mich freuen wehn leute iedeen haben um dinge kurzer su bekommen.

    Code:
    $regfile = "m8def.dat"
    $crystal = 8000000
    $baud = 9600
    $lib "ds1307rtc.lib"                                        ' modified lib
    
    
    Declare Sub Gettemp()
    Declare Sub Enterdatetime()
    Declare Sub Getkey()
    Declare Sub Getkey2()
    Declare Sub Menu()
    'Declare Sub Checklight()
    
    'Config
    Config Lcdpin = Pin , Db4 = Portb.5 , Db5 = Portb.4 , Db6 = Portb.3 , Db7 = Portb.2 , E = Portb.1 , Rs = Portd.7
    Config Lcd = 20 * 4
    Cursor Off
    Config Sda = Portc.4
    Config Scl = Portc.5
    Config 1wire = Portb.0
    Config Clock = User
    Config Date = Dmy , Separator = -
    Config Pinb.6 = Output                                      'lamp4
    Config Pinb.7 = Output                                      'lamp3
    Config Pind.6 = Output                                      'lamp1
    Config Pind.5 = Output                                      'lamp2
    Config Pinc.1 = Input                                       'enter button & enter the menu
    Config Pinc.2 = Input                                       'down button
    Config Pinc.3 = Input                                       'up button
    Portc.3 = 1
    Portc.2 = 1
    Portc.1 = 1
    Portd.6 = 0
    Portd.5 = 0
    Portb.7 = 0
    Portb.6 = 0
    
    Time$ = "21:08:40"                                          ' to watch the day changing value
    Date$ = "03-12-06"
    
    'Dim Weekday As Byte
    
    'Dim Ds1307w As Byte
    'Dim Ds1307r As Byte
    Dim Scrachpad(8) As Byte
    Dim Tmp As Integer
    Dim Wynik As Single
    Dim Temp As String * 10
    Dim Temp1 As String * 10
    Dim Temp2 As String * 10
    
    Dim Lightsonmin As Word                                     'light on time converted to minutes
    Dim Lightsoffmin As Word                                    'light off time converted to minutes
    Dim Currentmin As Word
    Dim Eventhrs As Byte                                        'event hrs
    Dim Eventmin As Byte                                        'event minutes
    
    
    Dim Oldmin As Byte
    'Dim Gp1 As Byte                                             'general purpose variable
    'Dim Gp2 As Byte                                             'general purpose variable
    'Dim Gp3 As Byte                                             'general purpose variable
    'Dim Gp4 As Byte                                             'general purpose variable
    Dim J1 As Byte                                              'used by date and time subs
    Dim M1 As Byte
    Dim D1 As Byte
    Dim H1 As Byte                                              'used by date and time subs
    Dim Min1 As Byte
    Dim Aa As Byte                                              'sw var
    Dim X1 As Byte                                              'klok var
    Dim Z1 As Byte
    Dim Z2 As Byte
    'Constants for DS18b20
    Const Skip_rom = &HCC
    Const Convert = &H44
    Const Read_sp = &HBE
    Const Write_sp = &H4E
    
    'Constands for DS1307
    
    'address of ds1307
    Const Ds1307w = &HD0                                        ' Addresses of Ds1307 clock
    Const Ds1307r = &HD1
    
    
    
    '---------------------------------
    'Config Timer1 = Timer , Prescale = 256                      'Konfiguriere Timer1
    'Enable Timer1                                               'schalte den Timer1 ein
    'On Timer1 Gettemp                                           'verzweige bei Timer1 überlauf zu   Isr_von_Timer1
    'Enable Interrupts
    'Timer1 = 34285
    
    Waitms 100
    ' assigning the time will call the SetTime routine
    $eepromhex                                                  'tell compiler to write in Intel hex format
    $eeprom
    
    
    Lights1on:
    Data 21 , 09
    Lights1off:
    Data 21 , 10
    Lights1_on:
    Data 21 , 12
    Lights1_off:
    Data 21 , 14
    
    Lights2on:
    Data 21 , 10
    Lights2off:
    Data 21 , 15
    Lights2_on:
    Data 21 , 16
    Lights2_off:
    Data 21 , 17
    
    Lights3on:
    Data 21 , 10
    Lights3off:
    Data 21 , 15
    Lights3_on:
    Data 21 , 16
    Lights3_off:
    Data 21 , 17
    
    Lights4on:
    Data 21 , 09
    Lights4off:
    Data 21 , 10
    Lights4_on:
    Data 0 , 0
    Lights4_off:
    Data 0 , 0
    $data
    
    
    
    
    
    
    
    
    Cls
    Start:
    Do
    
      Locate 1 , 1
      Lcd "Datum: " ; Date$ ; "  "
      Locate 2 , 1
      Lcd "Tijd: " ; Time$ ; "  "
      If _min <> Oldmin Then
      Gettemp
      Locate 3 , 1
      Lcd "Temp: " ; Temp
      End If
      If _sec = 5 Then
      Goto Checklights
      End If
    
      If Pinc.1 = 0 Then
      Menu
      End If
    
    
    'Wait 1
    Loop
    
    
    End
    
    'called from ds1307clock.lib
    Getdatetime:
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 0                                                ' start address in 1307
    
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307r                                          ' send address
      I2crbyte _sec , Ack
      I2crbyte _min , Ack                                       ' MINUTES
      I2crbyte _hour , Ack                                      ' Hours
      'I2crbyte Weekday , Ack                                    ' Day of Week
      I2crbyte _day , Ack                                       ' Day of Month
      I2crbyte _month , Ack                                     ' Month of Year
      I2crbyte _year , Nack                                     ' Year
      I2cstop
      _sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour)
      _day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year)
    Return
    
    Setdate:
      _day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year)
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 4                                                ' starting address in 1307
      I2cwbyte _day                                             ' Send Data to SECONDS
      I2cwbyte _month                                           ' MINUTES
      I2cwbyte _year                                            ' Hours
      I2cstop
    Return
    
    Settime:
      _sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour)
      I2cstart                                                  ' Generate start code
      I2cwbyte Ds1307w                                          ' send address
      I2cwbyte 0                                                ' starting address in 1307
      I2cwbyte _sec                                             ' Send Data to SECONDS
      I2cwbyte _min                                             ' MINUTES
      I2cwbyte _hour                                            ' Hours
      I2cstop
    Return
    
    
    
    ' SUBS *******************************************************************
    Sub Enterdatetime()
       Cls
       X1 = 05
       Aa = 0
       Do
       If X1 > 99 Then X1 = 00
       If X1 < 1 Then X1 = 99
       Waitms 300
       Locate 1 , 1
       Lcd "Geef Het Jaar: " ; X1 ; "  "
       Getkey
       J1 = X1
       Loop Until Aa = 1
    
    
       Cls
       Aa = 0
       X1 = 06
       Do
       If X1 > 12 Then X1 = 01
       If X1 < 1 Then X1 = 12
       Waitms 300
       Locate 1 , 1
       Lcd "Geef de maand: " ; X1 ; "  "
       Getkey
       M1 = X1
       Loop Until Aa = 1
    
       Cls
       Aa = 0
       X1 = 15
       Do
       If X1 > 31 Then X1 = 01
       If X1 < 1 Then X1 = 31
       Waitms 300
       Locate 1 , 1
       Lcd "Geef de dag: " ; X1 ; "  "
       Getkey
       D1 = X1
       Loop Until Aa = 1
    
       _year = J1
       _month = M1
       _day = D1
    
       Gosub Setdate
    
       Cls
       Aa = 0
       X1 = 12
       Do
       If X1 > 24 Then X1 = 01
       If X1 < 1 Then X1 = 24
       Waitms 300
       Locate 1 , 1
       Lcd "Geef het uur: " ; X1 ; "  "
       Getkey
       H1 = X1
       Loop Until Aa = 1
    
       Cls
       Aa = 0
       X1 = 30
       Do
       If X1 > 59 Then X1 = 00
       If X1 < 01 Then X1 = 59
       Locate 1 , 1
       Lcd "Geef minuten: " ; X1 ; "  "
       Getkey
       Min1 = X1
       Loop Until Aa = 1
    
       _hour = H1
       _min = Min1
       _sec = 0
       Gosub Settime
    End Sub
    
    Sub Getkey()
       Waitms 300
       If Pinc.3 = 0 Then Incr X1
       If Pinc.2 = 0 Then Decr X1
       If Pinc.1 = 0 Then
       Aa = 1
       Else
       Aa = 0
       End If
    
    End Sub
    Sub Getkey2()
       Waitms 300
       If Pinc.3 = 0 Then Incr Z1
       If Pinc.2 = 0 Then Decr Z1
       If Pinc.1 = 0 Then
       Aa = 1
       Else
       Aa = 0
       End If
    
    End Sub
    
    Sub Menu()
    Aa = 0
    X1 = 0
    Cls
    Locate 1 , 1
    Lcd "   Menu   "
    Locate 2 , 1
    Lcd "up/down voor keuze"
    Do
    Getkey
    If X1 = 1 Then
    Locate 4 , 1
    Lcd "klok instellen "
    Elseif X1 = 2 Then
    Locate 4 , 1
    Lcd "SW1 programeren"
    Elseif X1 = 3 Then
    Locate 4 , 1
    Lcd "SW1-2 programeren"
    Elseif X1 = 4 Then
    Locate 4 , 1
    Lcd "SW2 programeren"
    Elseif X1 = 5 Then
    Locate 4 , 1
    Lcd "SW2-2 programeren"
    Elseif X1 = 6 Then
    Locate 4 , 1
    Lcd "SW3 programeren"
    Elseif X1 = 7 Then
    Locate 4 , 1
    Lcd "SW3-2 programeren"
    Elseif X1 = 8 Then
    Locate 4 , 1
    Lcd "SW4 programeren"
    Elseif X1 = 9 Then
    Locate 4 , 1
    Lcd "SW4-2 programeren"
    Elseif X1 = 10 Then
    Locate 4 , 1
    Lcd "menu verlaten  "
    Elseif X1 > 10 Then
    X1 = 1
    Elseif X1 < 1 Then
    X1 = 10
    End If
    
    Loop Until Aa = 1
    
    If X1 = 10 Then
    Cls
    Return
    Elseif X1 = 9 Then
    Gosub T4s
    Elseif X1 = 8 Then
    Gosub T4
    Elseif X1 = 7 Then
    Gosub T3s
    Elseif X1 = 6 Then
    Gosub T3
    Elseif X1 = 5 Then
    Gosub T2s
    Elseif X1 = 4 Then
    Gosub T2
    Elseif X1 = 3 Then
    Gosub T1s
    Elseif X1 = 2 Then
    'Temp1 = "Lights1on "
    'Temp2 = "Lights1off"
    Gosub T1
    Elseif X1 = 1 Then
    Enterdatetime
    
    End If
    End Sub
    
    T1:
    Cls
    Locate 1 , 1
    Lcd "SW1 aan progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights1on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW1 uit progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights1off
    Writeeeprom M1
    Return
    
    T1s:
    Cls
    Locate 1 , 1
    Lcd "SW1 aan progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights1_on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW1 uit progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights1_off
    Writeeeprom M1
    Return
    
    T2:
    Cls
    Locate 1 , 1
    Lcd "SW2 aan progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights2on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW2 uit progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights2off
    Writeeeprom M1
    Return
    
    T2s:
    Cls
    Locate 1 , 1
    Lcd "SW2 aan progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights2_on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW2 uit progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights2_off
    Writeeeprom M1
    Return
    
    T3:
    Cls
    Locate 1 , 1
    Lcd "SW3 aan progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights3on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW3 uit progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights3off
    Writeeeprom M1
    Return
    
    T3s:
    Cls
    Locate 1 , 1
    Lcd "SW3 aan progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights3_on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW3 uit progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights3_off
    Writeeeprom M1
    Return
    
    T4:
    Cls
    Locate 1 , 1
    Lcd "SW4 aan progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights4on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW4 uit progr 1"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights4off
    Writeeeprom M1
    Return
    
    T4s:
    Cls
    Locate 1 , 1
    Lcd "SW4 aan progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights4_on
    Writeeeprom M1
    
    Cls
    Locate 1 , 1
    Lcd "SW4 uit progr 2"
    
    Aa = 0
    Gosub Lamp
    Writeeeprom H1 , Lights4_off
    Writeeeprom M1
    Return
    
    Lamp:
    Do
       If Z1 > 24 Then Z1 = 01
       If Z1 < 1 Then Z1 = 24
       Waitms 300
       Locate 2 , 1
       Lcd "Geef het uur: " ; Z1 ; "  "
       Getkey2
       H1 = Z1
       Loop Until Aa = 1
    Do
       If Z1 > 59 Then Z1 = 00
       If Z1 < 01 Then Z1 = 59
       Waitms 300
       Locate 2 , 1
       Lcd "Geef de minuten: " ; Z1 ; "  "
       Getkey2
       M1 = Z1
       Loop Until Aa = 1
    Return
    
    Checklights:
    Readeeprom Eventhrs , Lights1on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.6 = 1
                 Locate 4 , 1
    Lcd "sw1+"                                                  'turn on light 1
             End If
          End If
    
          Readeeprom Eventhrs , Lights1off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.6 = 0
                Locate 4 , 1
    Lcd "sw1-"                                                  'turn off light 1
             End If
          End If
    
    Readeeprom Eventhrs , Lights1_on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.6 = 1
                 Locate 4 , 1
    Lcd "sw1s+"                                                 'turn on light 1 second
             End If
          End If
    
          Readeeprom Eventhrs , Lights1_off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.6 = 0
                Locate 4 , 1
    Lcd "sw1s-"                                                 'turn off light 1 second
             End If
          End If
    
    
    Readeeprom Eventhrs , Lights2on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.5 = 1
                 Locate 4 , 7
    Lcd "sw2+"                                                  'turn on light 2
             End If
          End If
    
          Readeeprom Eventhrs , Lights2off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.5 = 0
                Locate 4 , 7
    Lcd "sw2-"                                                  'turn off light 2
             End If
          End If
    
    
    Readeeprom Eventhrs , Lights2_on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.5 = 1
                 Locate 4 , 7
    Lcd "sw2s+"                                                 'turn on light 2  second
             End If
          End If
    
          Readeeprom Eventhrs , Lights2_off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portd.5 = 0
                Locate 4 , 7
    Lcd "sw2s-"                                                 'turn off light 2 second
             End If
          End If
    
    
    Readeeprom Eventhrs , Lights3on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.7 = 1
                 Locate 4 , 13
    Lcd "sw3+"                                                  'turn on light 3
             End If
          End If
    
          Readeeprom Eventhrs , Lights3off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.7 = 0
                Locate 4 , 13
    Lcd "sw3-"                                                  'turn off light 3
             End If
          End If
    
    Readeeprom Eventhrs , Lights3_on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.7 = 1
                 Locate 4 , 13
    Lcd "sw3s+"                                                 'turn on light 3 second
             End If
          End If
    
          Readeeprom Eventhrs , Lights3_off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.7 = 0
                Locate 4 , 13
    Lcd "sw3s-"                                                 'turn off light 3 second
             End If
          End If
    
    Readeeprom Eventhrs , Lights4on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.6 = 1
                 Locate 3 , 13
                 Lcd "sw4+"                                     'turn on light 4
             End If
          End If
    
          Readeeprom Eventhrs , Lights4off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.6 = 0
                Locate 3 , 13
    Lcd "sw4-"                                                  'turn off light 4
             End If
          End If
    
    Readeeprom Eventhrs , Lights4_on
    Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.6 = 1
                 Locate 3 , 13
                 Lcd "sw4s+"                                    'turn on light 4 second
             End If
          End If
    
          Readeeprom Eventhrs , Lights4_off
          Readeeprom Eventmin
          If Eventhrs = _hour Then
             If Eventmin = _min Then
                Portb.6 = 0
                Locate 3 , 13
    Lcd "sw4s-"                                                 'turn off light 4 second
             End If
          End If
    
    
    Goto Start
    
    
    Sub Gettemp()
    1wreset
    1wwrite Skip_rom
    1wwrite Write_sp
    1wwrite 0
    1wwrite 0
    1wwrite &H7F
    
    
    
    1wreset
    1wwrite Skip_rom
    1wwrite Convert
    Waitms 800
    
    1wreset
    1wwrite Skip_rom
    1wwrite Read_sp
    
    Scrachpad(1) = 1wread()
    Scrachpad(2) = 1wread()
    Tmp = Scrachpad(2) * 256
    Tmp = Tmp + Scrachpad(1)
    Wynik = Tmp
    Wynik = Wynik / 16
    Temp = Fusing(wynik , "#.##")
    Oldmin = _min
    End Sub
    
    
    
    
    End
    mein iedee ist um ein schaltuhr su machen der 4 220 volt contacte seperat schalted und am liebsten mit 2 oder mehr versiedene seiten die man programieren kan.naturlich die uhr ist aug su programieren.
    die seiten fon die 4 contacten werden ins eeprom geschieben.

    bis so weit lauft alles aber leider habe ich gein platz mehr um die andere sachen drin su bekommen.

    grusse Rene aus Holland

Seite 2 von 3 ErsteErste 123 LetzteLetzte

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

12V Akku bauen