??? 12/03/05 11:52 Read: times |
#104621 - LPC922 Comparator Interrupt Problems. |
Dear Forum Members,
I am using P89LPC922 micros in some of my products. In one product design some functional abnormilities were reported by one of my customer. I investigated the problem in detail and found that the comparator output flag oscillating and cause interrupt to get triggered more than ones were it should ideally get triggered only once. The comparator 1 of lpc922 is used for zero cross detection of AC mains supply. The hardware connection is as shown below. The input on right side is 2.5V AC from a step down transformer. The code for interrupt initialisation is as follows. PT0AD=0x70; // Disable digital inputs on comparators. P0M2=0x00; // All pins in port 0 made input only. P0M1=0xFF; CMP1=0x24; // Comparator A Ext Ref. Output enable. ms_delay(10); // 10ms Delay to start comparator properly. EC=1; // Enable Comparator Interrupt. EA=1; // Enable Global Interrupt. I have worked on this problem for couple of days and couldnt solve it. The interrupt should come every 10ms upon detecting the zero cross [ 50Hz line freq. ] but at every zero cross it comes 2 to 3 times. As a quick fix i tried putting some dummy nop in Comparator interrupt routine and the repeated interrupt problem gets fixed. I dont have a DSO to test the things. From my experimentation one thing is clear the interrupt comes again and again upto 100us after real zero cross. Please help me with this problem. Thanks & Regards, Prahlad Purohit |