Hi,
I have written a interuppt program for 1 second time delay. I am inserting the code with this mail, I am using pca with timer0 overflow as time base for pca. the timer 0 overflows at every 250us which is inturn given to PCA with 4000 times count. The code is working fine as single module , but when I attach this code with my on going project code the code is not working, I have not used any special registers of the chip AT89C51ED2, and in all EEPROM programs I have used EA=0 and EA=1 at begining and end of program. If there is any suggestion , plz help me to get out of this problem.
void timer_routine(void) interrupt 7 using 2 { EA=0; //disable all interrupt CL=0x5F; //loading 0xfo5f to pca counter CH=0xF0; CCF1=0; //clearing capture compare flag CF=0; //clearing pca counter overflow flag P2_6=~P2_6; //complementing the portpin EA=1; //enable all interrupt } void main() { IEN0=0xC0; //enable all interupt and pca interupt TMOD |=0x02; //set timer0 as timer TL0=0x00; //reload timer value as 0x1800 TH0=0x18; TF0=0; CMOD=0x05; //select timer 0 as pca clock and enable pca capture interupt CCAP1L=0x0A; //filling non zero values CCAP1H= 0x4F; CCAPM1=0x49; //setting ecom1 and mat1 and eccf1bits to use as software timer and enabling capture interupt CL=0x5F; // filling the pca timer CH=0xF0; CCAP1L=0xFF; //filling the capture ,compare modules CCAP1H= 0xFF; TR0=1; //run timer0 CR=1; //run pca timer P2_6=0; while(1); }