I need to do simple thing, but I got big problem!
My project is to make PID temperature control for water heater.
I need to control (cut) sinusoidal. This is easy job. I have one optocuppler to detect zero cross and then after xx time open SCR
I got one interpret to detect zero cross and start timer. When timer reach value open SCR and wait few uS and
Everything working random and non stable. ESP is crashing. What do I do wrong?
Code: Select all
void IRAM_ATTR vhod1_ISR() { //interupt zero cross
timerAlarmEnable(int_timer);
}
void IRAM_ATTR prozi_SCR(){ // interupt timer
digitalWrite(grelec,HIGH);
delayMicroseconds(100);
digitalWrite(grelec,LOW);
timerAlarmDisable(int_timer);
}
Code: Select all
attachInterrupt(nula, vhod1_ISR, RISING); // zero cross interupt
int_timer = timerBegin(0, 80, true); // timer
timerAttachInterrupt(int_timer, &prozi_SCR, true);
timerAlarmWrite(int_timer, 1000000, true);