9,11 → 9,13 |
|
Rozmisteni desek: |
|
[CAN] |
[IN J] [IN D] |
[OUT A] [CPU] |
[IN D] |
[OUT E] |
[IN H] [IN J] |
[OUT B] |
[CPU] |
|
[OUT F] [OUT B] [OUT E] |
[OUT G] [CAN] [OUT A] [OUT F] |
|
*/ |
#include "main.h" |
25,9 → 27,11 |
#use fast_io(F) |
#use fast_io(D) |
#use fast_io(J) |
#use fast_io(H) |
#use fast_io(G) |
|
#define T_REVERS 5 // 5*256 ms = 1,25 s; pred prepnutim rele (zastaveni motoru a vybiti kondenzatoru) |
#define T_START 2 // 2*256 ms = 0,5 s; po prepnuti rele do sepnuti triaku |
#define T_REVERS 2 // 2*256 ms = 0,5 s; pred prepnutim rele (zastaveni motoru a vybiti kondenzatoru) |
#define T_START 1 // 1*256 ms = 0,3 s; po prepnuti rele do sepnuti triaku |
#define T_GO 117 // 117*256 ms = 30 s; max. beh rolety |
#define T_GO_ZALUZIE 6 // cca 1,5 s; beh zaluzie (pouze na preklopeni lamel) |
#define T_RECEIVE 10 // cca 2,6 s |
77,7 → 81,13 |
#define OS203A PIN_E6 // t7 Svetlo Kaklik koupelna |
#define RE PIN_E7 // t8 Rele pro rizeni smeru rolet |
|
//#define I.... input(PIN_D0) // A |
//#define O.... PIN_G0 // t8 |
//#define O.... PIN_G1 // t7 |
//#define O.... PIN_G2 // t6 |
#define OS208A PIN_G3 // t5 Svetlo Zizala stred |
#define OS100A PIN_G4 // t4 Svetlo prujezd venku |
|
//#define I.... input(PIN_D0) // A |
#define IS201AZ input(PIN_D1) // B Vypinac chodba 2.n.p. zapad u Kaklika |
#define IS207AJ input(PIN_D2) // C Vypinac klubovna |
#define IR207VD input(PIN_D3) // D Vypinac roleta klubovna dolu |
93,8 → 103,18 |
#define IS204AJ input(PIN_J4) // E Vypinac svetlo radiomistnost u dveri na chodbu |
#define IR204ZD input(PIN_J5) // F Vypinac roleta radiomistnost dolu |
#define IR204ZU input(PIN_J6) // G Vypinac roleta radiomistnost nahoru |
//#define I.... input(PIN_J7) // H |
//#define I.... input(PIN_J7) // H |
|
#define IS208AN input(PIN_H0) // A Vypinac svetlo stred Zizala u dveri na chodbu //POZOR! Jsou prohozeny rolety J a V a smery U a D |
#define IR208JD input(PIN_H1) // B Vypinac roleta vychod Zizala nahoru u dveri |
#define IR208JU input(PIN_H2) // C Vypinac roleta vychod Zizala dolu u dveri |
#define IR208VD input(PIN_H3) // D Vypinac roleta jih Zizala nahoru u dveri |
#define IR208VU input(PIN_H4) // E Vypinac roleta jih Zizala dolu u dveri |
//#define I.... input(PIN_H5) // F |
//#define I.... input(PIN_H6) // G |
#define Ispec input(PIN_H7) // H specialni vypinac u rozvadece 2.n.p. |
|
|
int1 s201AV; |
int1 s201AZ; |
int1 s207AJ; |
109,11 → 129,17 |
int1 s204AJ; |
int1 r204ZD; |
int1 r204ZU; |
int1 s208AN; |
int1 r208VU; |
int1 r208VD; |
int1 r208JU; |
int1 r208JD; |
int1 ispec; |
|
#bit CREN = 0xFAB.4 // USART enable register |
|
#define LED1 PIN_C0 |
#define LED2 PIN_C1 |
#define LED1 PIN_C0 // Vyvedeno na desku portu G |
#define LED2 PIN_C1 // Vyvedeno na desku portu G |
|
#define ON(port) output_low(port); |
#define OFF(port) output_high(port); |
127,6 → 153,8 |
#define R207V 4 |
#define R202J 5 |
#define R204Z 6 |
#define R208V 7 |
#define R208J 8 |
|
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN, RUN_UP_WAITING} relay_state; |
relay_state relay; // Stavy rele |
166,6 → 194,8 |
if (rol[R207V]==RUN) ON(OR207V); |
if (rol[R202J]==RUN) ON(OR202J); |
if (rol[R204Z]==RUN) ON(OR204Z); |
if (rol[R208V]==RUN) ON(OR208V); |
if (rol[R208J]==RUN) ON(OR208J); |
} |
|
void run(int8 roleta) // Spust konkretni roletu |
179,6 → 209,8 |
case R207V: ON(OR207V); break; |
case R202J: ON(OR202J); break; |
case R204Z: ON(OR204Z); break; |
case R208V: ON(OR208V); break; |
case R208J: ON(OR208J); break; |
} |
} |
|
193,6 → 225,8 |
case R207V: OFF(OR207V); break; |
case R202J: OFF(OR202J); break; |
case R204Z: OFF(OR204Z); break; |
case R208V: OFF(OR208V); break; |
case R208J: OFF(OR208J); break; |
} |
} |
|
270,13 → 304,16 |
set_tris_b(0); |
set_tris_e(0); |
set_tris_f(0); |
set_tris_g(0x20); |
set_tris_d(0xFF); // Vstupy |
set_tris_j(0xFF); |
set_tris_h(0xFF); |
|
output_a(0xFF); // Vsechno zhasni a zastav |
output_b(0xFF); |
output_f(0xFF); |
output_e(0xFF); |
output_g(0xFF); |
stop_all(); |
|
relay=RUN_UP_WAITING; // Rele je na zacatku vypnuto |
308,6 → 345,12 |
s204AJ=IS204AJ; |
r204ZD=IR204ZD; |
r204ZU=IR204ZU; |
s208AN=IS208AN; |
r208VU=IR208VU; |
r208VD=IR208VD; |
r208JU=IR208JU; |
r208JD=IR208JD; |
ispec=Ispec; |
|
timer_run=0; // Zastav vsechny casovace |
timer=0; |
455,6 → 498,7 |
if(s205A!=IS205A) {s205A=IS205A; output_toggle(OS205A); zakmity=ZAKMIT;} |
if(s204AJ!=IS204AJ) {s204AJ=IS204AJ; output_toggle(OS204A); zakmity=ZAKMIT;} |
if(s202AN!=IS202AN) {s202AN=IS202AN; output_toggle(OS202A); zakmity=ZAKMIT;} |
if(s208AN!=IS208AN) {s208AN=IS208AN; output_toggle(OS208A); zakmity=ZAKMIT;} |
|
if(r207VU!=IR207VU) {r207VU=IR207VU; up(R207V); zakmity=ZAKMIT;} |
if(r207VD!=IR207VD) {r207VD=IR207VD; down(R207V); zakmity=ZAKMIT;} |
462,6 → 506,12 |
if(r202ND!=IR202ND) {r202ND=IR202ND; down(R202J); zakmity=ZAKMIT;} |
if(r204ZU!=IR204ZU) {r204ZU=IR204ZU; up(R204Z); zakmity=ZAKMIT;} |
if(r204ZD!=IR204ZD) {r204ZD=IR204ZD; down(R204Z); zakmity=ZAKMIT;} |
if(r208VU!=IR208VU) {r208VU=IR208VU; up(R208V); zakmity=ZAKMIT;} |
if(r208VD!=IR208VD) {r208VD=IR208VD; down(R208V); zakmity=ZAKMIT;} |
if(r208JU!=IR208JU) {r208JU=IR208JU; up(R208J); zakmity=ZAKMIT;} |
if(r208JD!=IR208JD) {r208JD=IR208JD; down(R208J); zakmity=ZAKMIT;} |
|
if(ispec!=Ispec) {ispec=Ispec; output_toggle(OS100A); zakmity=ZAKMIT;} |
} |
else zakmity--; |
|