??? 11/24/04 07:23 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#81805 - Thyristor problem Responding to: ???'s previous message |
I've had another look at your code. I think you are doing too much work in the EXINT0 - how many cycles does this code take to execute? When things don't work as expected, cut out all the extra stuff and just leave what is necessary. When you have this cut down version working, then add stuff in. You can always back track when things stop working. Cut out stuff like calculating the rms etc and the for loop - why does this need to be in the interrupt? Always strive to keep your interrupts lean and mean. Having two interrupt routines closely coupled is a recipe for weird bugs. Since you're using timer1 for your 100uS tick - have the timer ISR take care of the zero cross input, that way you get rid of the EXTINT0 ISR. The 8051 hardware will latch the interrupt status if the the external interrupt but since the EXTINT0 interrupt is not enabled, you will have to reset the interrupt flag yourself. What micro are you using? I'm also guessing you thyristor drive circuit is using a pulse transformer since you pulse the output. With my earlier post I spoke of phase and frequency locking my timer to the external zero crossing. This is done to filter out interference from the mains that can shift the detected zero crossing. In some cities, mains signalling is used to turn on street lights and/or off peak services. This signal is so strong and not synchronised with the mains that when it passes through zero crossing it can cause a few mS of zero cross shift in the zero cross detector - this causes flickering. Not the sort of thing you want your light dimmer to do at 5pm every day! Human eyes are very sensitive to small brightness changes, that's why you have to go to lengths to ensure that noise is filtered out - as little as 10uS of phase change can cause the brightness to visibly change. Since you piece of equipment is meant for industrial use, you would want to filter out noise also as this could cause too much power or too little to be supplied due to a machine starting or welding etc... |