??? 11/24/04 10:30 Read: times |
#81818 - Did the changes but still flickering. Responding to: ???'s previous message |
Hi Russell,
I have made the changes as per your suggestions. I removed the external 0 interrupt and integrated the flag bit detection with timer 1 interrupt. set the interrupt priority flag for timer 1 with all other bits of priority register 0. But the bulb still flickering. Here is my new timer 1 ISR. /*********Interrupt function for timer 1**************** This interrupt is always on and is 100us*/ void t1_isr(void) interrupt 3 using 2 { SYSTIME++; //increament the SYSTIME variable used for fire timing if (IE0) //If zero cross detected. { SYSTIME=0; //increase systimer. cycles++; IE0=0; //Clear zero cross flag. firecount=4; //set fire couter. } if (SYSTIME>99) //If SYSTIME exceeding 100 it is a zero cross. { SYSTIME=0; //reset system timer. firecount=4; //set fire counter. } if (onfire && SYSTIME>firedly && firecount && fwbit) { FIREPORT=!FIREPORT; //Put the fire pulse firecount--; //Reduce remining pulse counter. } else FIREPORT=1; //Make fire pin 1 to keep transistor off. fwbit=!fwbit; //fwbit to make firing pulse 200us ioport=OPSTATUS; } I have also removed the square root and RMS calculations from interrupt and put it in the main program. I tried checking with my analog o'scope but on scope it seems fine. I don't have access to a DSO. Thanks & Regards, Prahlad Purohit |