Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - FAQ - Zum CC1-Forum - Zum CC-Pro-Forum

Schaltuhr Programmierung Kategorie: Programmierung (von guido - 28.11.2004 19:39)
Ich nutze:
C-Control II Unit, CC2-ReglerBoard, OSOPT V3.0
Hallo @all

Ich  habe mal wieder ein Programmtechnisches Problem

Folgendes Programm soll fĂĽr verschieden Situationen verschieden Schaltzeiten zur VerfĂĽgung stellen
mir erschein es jedoch sehr umfangreich um die Zeiten zu speichern wie kann ich das Problem
anders Lösen ??
Ich bin fĂĽr jede Hilfe dankbar

Mfg Guido

Hier der Code


//----------------------------
//berechnung der Schaltzeiten
//----------------------------
function schaltuhr () returns byte
{
 byte u;
 int hour, min, time;
 hour=system.hour();
 min=system.minute();
 time=(hour*100)+ min;

     if var.safe1==0 // Programm Gäste aktiv
     {
        if var.zeit1[0]<time and time<var.zeit1[1] u=-1;//Schaltzeit 1
        else
        if var.zeit1[2]<time and time<var.zeit1[3] u=-1;//Schaltzeit 2
        else
        if var.zeit1[4]<time and time<var.zeit1[5] u=-1;//Schaltzeit 3
        else
        if var.zeit1[6]<time and time<var.zeit1[7] u=-1;//Schaltzeit 4
        else u=0;
     }
     else
     if var.safe1==1 // Programm Gäste im Haus aktiv
     {
        if var.zeit2[0]<time and time<var.zeit2[1] u=-1;//Schaltzeit 1
        else
        if var.zeit2[2]<time and time<var.zeit2[3] u=-1;//Schaltzeit 2
        else
        if var.zeit2[4]<time and time<var.zeit2[5] u=-1;//Schaltzeit 3
        else
        if var.zeit2[6]<time and time<var.zeit2[7] u=-1;//Schaltzeit 4
        else u=0;
     }
     else
     if var.safe1==2 // Programm Allein aktiv
     {
        if var.zeit3[0]<time and time<var.zeit3[1] u=-1;//Schaltzeit 1
        else
        if var.zeit3[2]<time and time<var.zeit3[3] u=-1;//Schaltzeit 2
        else
        if var.zeit3[4]<time and time<var.zeit3[5] u=-1;//Schaltzeit 3
        else
        if var.zeit3[6]<time and time<var.zeit3[7] u=-1;//Schaltzeit 4
        else u=0;

     }
     else
     if var.safe1==3 // Programm Tag aktiv
     {
        if var.zeit4[0]<time and time<var.zeit4[1] u=-1;//Schaltzeit 1
        else
        if var.zeit4[2]<time and time<var.zeit4[3] u=-1;//Schaltzeit 2
        else
        if var.zeit4[4]<time and time<var.zeit4[5] u=-1;//Schaltzeit 3
        else
        if var.zeit4[6]<time and time<var.zeit4[7] u=-1;//Schaltzeit 4
        else u=0;

     }
     else
     if var.safe1==4 // Programm Nacht aktiv
     {
        if var.zeit5[0]<time and time<var.zeit5[1] u=-1;//Schaltzeit 1
        else
        if var.zeit5[2]<time and time<var.zeit5[3] u=-1;//Schaltzeit 2
        else
        if var.zeit5[4]<time and time<var.zeit5[5] u=-1;//Schaltzeit 3
        else
        if var.zeit5[6]<time and time<var.zeit5[7] u=-1;//Schaltzeit 4
        else u=0;

     }
     else
     {
        if var.safe1==5 //Programm 24h
        if var.zeit6[0]<time and time<var.zeit6[1] u=-1;//Schaltzeit 1
        else
        if var.zeit6[2]<time and time<var.zeit6[3] u=-1;//Schaltzeit 2
        else
        if var.zeit6[4]<time and time<var.zeit6[5] u=-1;//Schaltzeit 3
        else
        if var.zeit6[6]<time and time<var.zeit6[7] u=-1;//Schaltzeit 4
        else u=0;

     }

return u;
}



//----------------------------


    Antwort schreiben


Antworten:

Re: Schaltuhr Programmierung (von AndrĂ© H. - 28.11.2004 21:30)
    Re: Schaltuhr Programmierung (von guido - 29.11.2004 20:10)
        Re: Schaltuhr Programmierung (von guido - 3.12.2004 11:53)
            Re: Schaltuhr Programmierung (von Thomas - 3.12.2004 14:32)
                Re: Schaltuhr Programmierung (von guido - 5.12.2004 14:01)
                    Re: Schaltuhr Programmierung (von AndrĂ© H. - 19.12.2004 0:14)
                    Re: Schaltuhr Programmierung (von Thomas - 5.12.2004 22:29)