Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

External interrupt PIC16F877A

Status
Not open for further replies.

Jyothi@Pic

New Member
Hi,

I have interfaced IR Remote with PIC16F877A. IR Receiver is connected to external interrupt Pin RB0. When remote is pressed, control goes to ISR & collects the data, Displays the data on serial port. When the key is pressed second time control doesnt goes to ISR. On Reset only interrupt is happening but only once. Interrupt Flag (INTF) is cleared in ISR. Interrupt (INTE) is always enabled.

Can anybody pls give me solution.

Thanks in advance.
 
Hi,

I have interfaced IR Remote with PIC16F877A. IR Receiver is connected to external interrupt Pin RB0. When remote is pressed, control goes to ISR & collects the data, Displays the data on serial port. When the key is pressed second time control doesnt goes to ISR. On Reset only interrupt is happening but only once. Interrupt Flag (INTF) is cleared in ISR. Interrupt (INTE) is always enabled.

Can anybody pls give me solution.

Thanks in advance.

hi,
Post you code [ enclose the code in the /CODE]
Select all your code and then click the '#' in the top menu bar.:)
 
External Interrupt Code

Code:
/CODE


#include "Prototype.h"

unsigned int IR_Data = 0, x, Var;
unsigned char IR_Count = 0, Sensor_Check = 0, z, i;
bit Flag = 0;

void main()
{
	Serial_Init();

	TRISB = 0x01;						// 0th Bit of PortB as Input ( External Interrupt ) & Remaining Pins as Output
	
	RBPU = 0;							// Turn On all Internal Pull Ups
	GIE = 1;							// Global Interrupt Enable
	PEIE = 1;							// Phepipheral Interrupt Enable Bit
	INTEDG = 0;							// Interrupt on Rising Edge of RB0/INT
	INTE = 1;							// Enables RB0/INT External Interrupt 
	

	while( 1 )
	{
		
		if( Sensor_Check == 1 )
		{
			Sensor_Check = 0;
			
			for( i = 0; i < 16; i++)
			{
				if( ( IR_Data<<i ) & 0x8000 )
				Send_Byte( 0x30 );
				else Send_Byte( 0x31 );
			}
			
			Send_Enter();
			IR_Data = 0;
		}

		INTE = 1; INTF = 0;
	}
}

static void interrupt isr( void ) 	
{
	
	INTE = 0; INTF = 0;
	
	while( IR_Count < 0x0E )					  
  	{
    	if( ( !IR ) && ( IR_Count < 0x0E ) )		  
		{						   			  
	  		IR_Data|= IR;	  		              
	  		IR_Data <<=1;
	  		Delay_IR();
	  		IR_Count++;						  
		}
													  
		if( ( IR ) && ( IR_Count < 0x0E ) )			  
    	{
      		IR_Data <<= 1; 							 
	  		IR_Data |= IR;							 
	  		Delay_IR();							 
	 	 	IR_Count++;						 
		}
 	}

 	Sensor_Check = 1;
}
 
hi @pic,
I use assembler, not C, many others here do, I'm sure they will respond.:)
 
You appear to turn the inte interrupt off in your ISR.

Try removing the red bit,
Code:
static void interrupt isr( void ) 	
{
	[COLOR="Red"]INTE = 0;[/COLOR] INTF = 0;	
	while( IR_Count < 0x0E )

Mike.
 
re:external interrupt

I made the changes you told but still interrupt is happening only once

give me some other solutions...........please
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top