Architecture for phase controlled triac
Posted: Wed Nov 08, 2017 2:05 pm
I am designing a lighting controller and I'm having a bit of trouble figuring out how to handle the fast timing needed for phase control.
The circuit has four triacs. The AC signal is also being fed back to an input through an optocoupler that is used to detect zero crossings. I have the zero crossing input configured to generate an interrupt on falling edge. This part is working fine. The way I have designed it is to have a task for each triac. The zero crossing interrupt will give a semaphore to the triac tasks. The next part is where I'm having trouble. The tasks will then need to delay anywhere between 10uS to a full half AC cycle (120 Hz). My original thought was to just do a vTaskDelay of that time but I can't get micro second resolution.
After the phase delay the triac output would be turned on - then a 10uS delay - then back off again. The task would then wait on the next semaphore from the zero crossing input.
Any thoughts?
The circuit has four triacs. The AC signal is also being fed back to an input through an optocoupler that is used to detect zero crossings. I have the zero crossing input configured to generate an interrupt on falling edge. This part is working fine. The way I have designed it is to have a task for each triac. The zero crossing interrupt will give a semaphore to the triac tasks. The next part is where I'm having trouble. The tasks will then need to delay anywhere between 10uS to a full half AC cycle (120 Hz). My original thought was to just do a vTaskDelay of that time but I can't get micro second resolution.
After the phase delay the triac output would be turned on - then a 10uS delay - then back off again. The task would then wait on the next semaphore from the zero crossing input.
Any thoughts?