TMR0 and SERIAL both ISR not working in single program

Status
Not open for further replies.

scorrpeio

Full Member level 5
Joined
Dec 26, 2006
Messages
286
Helped
10
Reputation
20
Reaction score
9
Trophy points
1,298
Visit site
Activity points
3,496
Hello,
I have written code for 89V51RD2 in C where I used both TMR0 and Serial ISR
In that after TMR0 ISR gets executed, Serial ISR stops working.

I tested Serial ISR separately by removing TMR0 ISR. In that case Serial ISR works without creating any problem.
But as soon as TMR0 ISR comes in picture, Serial stops working.

Can anyone tell me how to remove this problem?
 

Code:
void UART_INIT(void)
{
	TXD		=	1;			//TXD Pin set as I/P		
	RXD		=	1;			//RXD Pin set as I/P		
	SCON	=	0x50;		//mode1, 8bit UART, Reception Enable
	TMOD 	= 	0x20;		//timer 1 8-bit auto-reload
	TH1 	= 	UART_SetBaudRate(CLK_110592, 
				UART_BAUD_9600);		//Baud Rate 9600 8-n-1
	TL1 	= 	TH1;						//Reload count
	ES		=	ACTIVE_HIGH_ON;	       //Enable Serial Intr 
	PS		=	ACTIVE_HIGH_ON;		//Set High Priority of Serial Intr
	EA		=	ACTIVE_HIGH_ON;		//Enable Global Intr
	TR1 	= 	ACTIVE_HIGH_ON;					// Start timer
}

Code:
void ISR_UART(void) interrupt 4 
{
     if	(RI)
    {
         //copying the SBUF in the buffer and checking whether whole frame is       
         // received or not
        
     }
}

Code:
void TIMER_INIT(void)
{
	TMOD	|=	0X01;
	TH0		=	0XFC;	//1MSEC COUNT 65535-922
	TL0		=	0X66;

HIGHPRIORITY_TIMER0INTR	=	ACTIVE_HIGH_OFF;	//Set Timer0 interrupt as  
                                                                                //low priority

	ENABL_ETIMER0INTR		=	ACTIVE_HIGH_ON;
	ENABL_GLOBALINTR		=	ACTIVE_HIGH_ON;
}

Code:
void ISR_TIMER0(void) interrupt 1  //using 2
{
	TIMER0_INTR_FLAG	=	ACTIVE_HIGH_OFF;
	START_TIMER0		=	ACTIVE_HIGH_OFF;
	TH0					=	0XFC;	//TIMER OF 1MSEC
	TL0					=	0X66;
	START_TIMER0		=	ACTIVE_HIGH_ON;

	if(u8_ColumnNo>15)
	{
		  u8_ColumnNo		=	0;
		  Enable_74LS138	=	1;
	}
	ROW_0_TO_7		=	0xFF;
	ROW_8_TO_15		=	0XFF;
	COLUMN_0_TO_7	=	~(1<<u8_ColumnNo);
	if(u8_ColumnNo>=8)
	{
		COLUMN_8_TO_15	=	COLUMN_8_TO_15 + 0X10;
	}
	ROW_0_TO_7		=	u8_DisplayBuffer[u8_ColumnNo<<1];
	ROW_8_TO_15		=	u8_DisplayBuffer[(u8_ColumnNo<<1)+1];
	u8_ColumnNo++;
	
	
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…