??? 11/26/04 04:40 Read: times |
#81977 - Hey Friends Problem Solved. Responding to: ???'s previous message |
Dear Forum Members,
The flickering problem is solved. Billions of thanks to RUSSELL, OLEG & KAI for you great help. The problem was improper synchronisation of firing delay time with the zero cross. 1. At the start I was using INT0 for zero cross detection and timer 1 to time the firing delay. Since I could detect only one half cycle start the other zero cross was not properly detected and caused flickering. 2. Later I integrated my Timer 1 and INT0 functions inside timer 1 and removed External interrupt completely but still used IE0 edge detect flag for zero cross detection and timer synchronization with zero cross. Doing this improved the code readablilty and reduced code size but couldn't solve flickering problem. 3. I changed my hardware a bit and connected the zero cross coming from LM311 to P1.3 PCA module 0 pin. In software I enabled PCA module 0 in capture mode with interrupt and detect both transitions. Also set the highest proprity for PCA interrupt. and second priority for Timer 1. 3 and 4 th priority for rest of the interrupts. For zero cross I was using PCA and for firing delay I used Timer 1 in 8 bit auto reload mode. This reduced flickering to some extent but not completely. 4. Oleg pointed out that 'fwbit'[now ttbit] a bit variable used in firing part was not properly synchronised with zero cross rendereing 100us firing inaccruacy. Upon setting this bit with zero cross totally eliminated the flickering. Thanks once again Oleg. 5. Thanks Russell for your continous support with excellent explainatory posts. Although the problem is solved but still I will use your Phase and Frequency locking technique to make it better. And I remember it was you who first suggested to use PCA and believe me it is because of PCA that timer 1 is getting synchronised properly with zero cross. Thank you Russell for your efforts. 6. Thanks Kai & Russell you pointed out the causes of zero cross drift and filtering remedies to eliminate these problems. I have installed a filter after Kai's suggestion and probably the problem is solved because of the filter. Thanks Kai for your helpfull input. Thanks to all the forum members for their help and support. Regards, Prahlad Purohit |