Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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?
 

do you disable the timer0 isr before you exit the ISR routine... its a rule to disable the interrupt flag before exiting the function????????
put the code here please......
 

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top