/Designs/dum/SW/2patra/1np/main.c
2,27 → 2,27
 
#case
 
#define S105A1 input(PIN_A0)
#define R110A1U input(PIN_A1)
#define R110A1D input(PIN_A2)
#define S104A1 input(PIN_A3)
#define R104A1U input(PIN_A4)
#define R104A1D input(PIN_A5)
#define R104B1U input(PIN_A6)
#define R104B1D input(PIN_A7)
#define S105AN input(PIN_A0) // Kuchyne hlavni svetlo severni vypinac
#define R110NJU input(PIN_A1) // Roleta koupelna
#define R110NJD input(PIN_A2)
#define S104AZ input(PIN_A3) // Svetlo laborator vypinac u dveri
#define R104VZU input(PIN_A4) // Roleta laborator vychod
#define R104VZD input(PIN_A5)
#define R104JZU input(PIN_A6) // Roleta laborator jih
#define R104JZD input(PIN_A7)
 
#define S103A1 input(PIN_B0)
#define S103A2 input(PIN_B1)
#define S103A3 input(PIN_B2)
#define R103A1U input(PIN_B3)
#define R103A1D input(PIN_B4)
#define S106A1 input(PIN_B5)
#define S107A2 input(PIN_B6)
#define S109A1 input(PIN_B7)
#define S103JZ input(PIN_B0) // Svetlo loznice jih vypinac u dveri
#define S103JN input(PIN_B1) // -"- vypinac KAKL
#define S103JV input(PIN_B2) // -"- vypinac mama
#define R103VZU input(PIN_B3) // Roleta loznice vypinac u dveri
#define R103VZD input(PIN_B4)
#define S106AV input(PIN_B5) // Hlavni svetlo trucovna vypinac u dveri do kuchyne
#define S107AN input(PIN_B6) // Svetlo satna vypinac do chodby
#define S109AJ input(PIN_B7) // Svetlo tech. mistnost vypinac do chodby
 
#define OS101 PIN_C0
#define OS105B PIN_C1
#define OS105C PIN_C2
#define OS101A PIN_C0 // Spinac svetla v bunecce prizemi
#define OS105V PIN_C1 // Svetlo nad chlebarnou
#define OS105N PIN_C2 // Severni svetlo kuchyne
 
//#define PIN_C3 31763
//#define PIN_C4 31764
31,14 → 31,14
//#define PIN_C6 31766 //TX
//#define PIN_C7 31767 //RX
 
#define S101A1 input(PIN_D0)
#define S101A2 input(PIN_D1)
#define S105B1 input(PIN_D2)
#define S105C1 input(PIN_D3)
#define S105D1 input(PIN_D4)
#define S102A1 input(PIN_D5)
#define S110A1 input(PIN_D6)
#define S108A1 input(PIN_D7)
#define S101AN input(PIN_D0) // Hlavni svetlo bunecka severni vypinac bliz u dveri
#define S101AJ input(PIN_D1) // Hlavni svetlo bunecka jizni vypinac
#define S105VV input(PIN_D2) // Vypinac nad chlebarnou
#define S105NZ input(PIN_D3) // Svetlo kuchyne sever vypinac zapadni
#define S105ZZ input(PIN_D4) // Svetlo kuchyne zapad vypinac zapadni
#define S102AN input(PIN_D5) // Vypinac chodba dole u schodu
#define S110AN input(PIN_D6) // Vypinac koupelna sever
#define S108AV input(PIN_D7) // Dvere do spajzu
 
/*
#define PIN_E0 31776
88,31 → 88,31
#define LED1 PIN_J7
#define LED2 PIN_J6
 
int1 s105A1;
int1 r110A1U;
int1 r110A1D;
int1 s104A1;
int1 r104A1U;
int1 r104A1D;
int1 r104B1U;
int1 r104B1D;
int1 s105AN; // Predchozi stav vypinacu
int1 r110NJU;
int1 r110NJD;
int1 s104AZ;
int1 r104VZU;
int1 r104VZD;
int1 r104JZU;
int1 r104JZD;
int1 s103JZ;
int1 s103JN;
int1 s103JV;
int1 r103VZU;
int1 r103VZD;
int1 s106AV;
int1 s107AN;
int1 s109AJ;
int1 s101AN;
int1 s101AJ;
int1 s105VV;
int1 s105NZ;
int1 s105ZZ;
int1 s102AN;
int1 s110AN;
int1 s108AV;
 
int1 s103A1;
int1 s103A2;
int1 s103A3;
int1 r103A1U;
int1 r103A1D;
int1 s106A1;
int1 s107A2;
int1 s109A1;
 
int1 s101A1;
int1 s101A2;
int1 s105D1;
int1 s102A1;
int1 s110A1;
int1 s108A1;
 
#define send(s) \
{\
printf("%s\r\n",#s);\
136,61 → 136,62
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
s105A1=S105A1;
r110A1U=R110A1U;
r110A1D=R110A1D;
s104A1=S104A1;
r104A1U=R104A1U;
r104A1D=R104A1D;
r104B1U=R104B1U;
r104B1D=R104B1D;
s103A1=S103A1;
s103A2=S103A2;
s103A3=S103A3;
r103A1U=R103A1U;
r103A1D=R103A1D;
s106A1=S106A1;
s107A2=S107A2;
s109A1=S109A1;
s101A1=S101A1;
s101A2=S101A2;
s105D1=S105D1;
s102A1=S102A1;
s110A1=S110A1;
s108A1=S108A1;
s105AN=S105AN; // Poznamenej vychozi stav vypinacu
r110NJU=R110NJU;
r110NJD=R110NJD;
s104AZ=S104AZ;
r104VZU=R104VZU;
r104VZD=R104VZD;
r104JZU=R104JZU;
r104JZD=R104JZD;
s103JZ=S103JZ;
s103JN=S103JN;
s103JV=S103JV;
r103VZU=R103VZU;
r103VZD=R103VZD;
s106AV=S106AV;
s107AN=S107AN;
s109AJ=S109AJ;
s101AN=S101AN;
s101AJ=S101AJ;
s105VV=S105VV;
s105NZ=S105NZ;
s105ZZ=S105ZZ;
s102AN=S102AN;
s110AN=S110AN;
s108AV=S108AV;
 
while(TRUE)
{
if(s105A1!=S105A1) {s105A1=S105A1; send(S15A);}
if(r110A1U!=R110A1U) {r110A1U=R110A1U; send(R1aAU);}
if(r110A1D!=R110A1D) {r110A1D=R110A1D; send(R1aAD);}
if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);}
if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);}
if(s105D1!=S105D1) {s105D1=S105D1; send(S15D);}
if(s105AN!=S105AN) {s105AN=S105AN; send(S15A);}
if(r110NJU!=R110NJU) {r110NJU=R110NJU; send(R1aNU);}
if(r110NJD!=R110NJD) {r110NJD=R110NJD; send(R1aND);}
 
if(!S105VV) {output_low(OS105V);} else {output_high(OS105V);}
if(!S105NZ) {output_low(OS105N);} else {output_high(OS105N);}
if(s105ZZ!=S105ZZ) {s105ZZ=S105ZZ; send(S15Z);}
if(s104A1!=S104A1) {s104A1=S104A1; send(S14A);}
if(r104A1U!=R104A1U) {r104A1U=R104A1U; send(R14AU);}
if(r104A1D!=R104A1D) {r104A1D=R104A1D; send(R14AD);}
if(r104B1U!=R104B1U) {r104B1U=R104B1U; send(R14BU);}
if(r104B1D!=R104B1D) {r104B1D=R104B1D; send(R14BD);}
if(s104AZ!=S104AZ) {s104AZ=S104AZ; send(S14A);}
if(r104VZU!=R104VZU) {r104VZU=R104VZU; send(R14VU);}
if(r104VZD!=R104VZD) {r104VZD=R104VZD; send(R14VD);}
if(r104JZU!=R104JZU) {r104JZU=R104JZU; send(R14JU);}
if(r104JZD!=R104JZD) {r104JZD=R104JZD; send(R14JD);}
if(s103A1!=S103A1) {s103A1=S103A1; send(S13A);}
if(s103A2!=S103A2) {s103A2=S103A2; send(S13A);}
if(s103A3!=S103A3) {s103A3=S103A3; send(S13A);}
if(r103A1U!=R103A1U) {r103A1U=R103A1U; send(R13AU);}
if(r103A1D!=R103A1D) {r103A1D=R103A1D; send(R13AD);}
if(s103JZ!=S103JZ) {s103JZ=S103JZ; send(S13A);}
if(s103JN!=S103JN) {s103JN=S103JN; send(S13A);}
if(s103JV!=S103JV) {s103JV=S103JV; send(S13A);}
if(r103VZU!=R103VZU) {r103VZU=R103VZU; send(R13VU);}
if(r103VZD!=R103VZD) {r103VZD=R103VZD; send(R13VD);}
if(s106AV!=S106AV) {s106AV=S106AV; send(S16A);}
if(s107AN!=S107AN) {s107AN=S107AN; send(S17A);}
if(s109AJ!=S109AJ) {s109AJ=S109AJ; send(S19A);}
if(s106A1!=S106A1) {s106A1=S106A1; send(S16A);}
if(s107A2!=S107A2) {s107A2=S107A2; send(S17A);}
if(s109A1!=S109A1) {s109A1=S109A1; send(S19A);}
if(s101AN!=S101AN) {s101AN=S101AN; send(S11A);}
if(s101AJ!=S101AJ) {s101AJ=S101AJ; send(S11A);}
if(s101A1!=S101A1) {s101A1=S101A1; send(S11A);}
if(s101A2!=S101A2) {s101A2=S101A2; send(S11A);}
if(s102A1!=S102A1) {s102A1=S102A1; send(S12A);}
if(s110A1!=S110A1) {s110A1=S110A1; send(S1aA);}
if(s108A1!=S108A1) {s108A1=S108A1; send(S18A);}
if(s102AN!=S102AN) {s102AN=S102AN; send(S12A);}
if(s110AN!=S110AN) {s110AN=S110AN; send(S1aA);}
if(s108AV!=S108AV) {s108AV=S108AV; send(S18A);}
}
}