Interactive Triac control.
/* Triac */
char trstate = 0;
char tron = 0;
+unsigned long trtime;
unsigned short trdelay = 0;
void init(void)
PORTD |= 1;
zok = 0;
trstate = 1;
+ trtime = mnow;
}
} else if(trstate == 1) {
- PORTD &= ~1;
- trstate = 0;
+ if(mnow > trtime + 500) {
+ PORTD &= ~1;
+ trstate = 0;
+ }
}
}
sei();
display(0);
- tron = 1;
- trdelay = 5000;
-
while(1) {
mnow = getticks();
ledcycle();
/*
disphex((ttimea & 0xff000) >> 12);
*/
-#if 1
+#if 0
/*
Temp display
*/
display(ttimea / 1000);
}
#endif
+#if 1
+ /*
+ Phony Triac control
+ */
+ if(pval != 0) {
+ cur += pval;
+ if(cur < 0)
+ cur = 0;
+ if(cur > 99)
+ cur = 99;
+ display(cur);
+ trdelay = 10000 - ((unsigned short)cur * 100);
+ pval = 0;
+ }
+ if(sstate == 2) {
+ tron = !tron;
+ sstate = 0;
+ }
+#endif
#if 0
/*
Pulse counter display