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.

serial interrupt problem

Status
Not open for further replies.

manikandanshine

Full Member level 1
Joined
Aug 15, 2012
Messages
99
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,298
Location
india
Activity points
1,809
sir in my project i use serial interrupt and external interrupt.but i cant use both interrupt at the same time.when i enable the serial interrupt,it doesnot come to main program.program flow went to interrupt section.it doesnt consider other interrupt as well as it doesnt come to main program...here i am using
pic16f877a+hitech c compiler.could anyone help me.......plz......
thanks in advance..........
 

Hi,
Without seeing your code, its difficult to say whats the problem here .Anyway you can follow one of a method as shown in below, even though its belongs to PIC18F with C18, make necessary changes to your PIC & compiler. Here the controller just enters to Interrupt when a first byte is recieved. After that its manually read the bytes . Also you can go with a complete Interrupt based reading (transferring the recieved bytes to some array)

Code:
PIE1bits.RC1IE = 1;
 INTCON |= 0xC0;         // Set GIE, PEIE

#pragma interrupt InterruptHandlerHigh

void  InterruptHandlerHigh ()
{
   if(PIR1bits.RC1IF)                // if a RX interrupt occured
   {	
	PIE1bits.RC1IE = 0;         // Disable serial interrupt for manual reading  (optional , you can go with complete INT based reading)
                 
	*uart_buf = 	RCREG1;     // Read first byte (pointing to an array)
	while((*uart_buf!=0x0D))       // Read data untill 'enter' key is pressed  (this is in my case & you can use any other option)
	{
		 uart_buf++;
		 while(!USART1_DataRdy());
		 *uart_buf = USART1_Read();
	}
	
         *uart_buf = '\0';		// Write null at the end of the string
	
	PIE1bits.RC1IE = 1;     // Enable serial interrupt
	}

Rgds
Geo
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top