Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 8th January 2009, 10:47 AM   #1
Default External interrupt PIC16F877A

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.
Jyothi@Pic is offline  
Old 8th January 2009, 11:28 AM   #2
Default

Quote:
Originally Posted by Jyothi@Pic View Post
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.
__________________
Eric " Good enough is Perfect "
I will NOT answer PM's requesting technical help, please use the Forum
PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 8th January 2009, 11:41 AM   #3
Default 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;
}
Jyothi@Pic is offline  
Old 8th January 2009, 11:44 AM   #4
Default

hi @pic,
I use assembler, not C, many others here do, I'm sure they will respond.
__________________
Eric " Good enough is Perfect "
I will NOT answer PM's requesting technical help, please use the Forum
PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/
ericgibbs is offline  
Old 8th January 2009, 01:11 PM   #5
Default

You appear to turn the inte interrupt off in your ISR.

Try removing the red bit,
Code:
static void interrupt isr( void ) 	
{
	INTE = 0; INTF = 0;	
	while( IR_Count < 0x0E )
Mike.
Pommie is online now  
Old 9th January 2009, 04:53 AM   #6
Default re:external interrupt

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

give me some other solutions...........please
Jyothi@Pic is offline  
Reply

Tags
external, interrupt, pica

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
ps/2, pic external interrupt problem v1r05 Micro Controllers 2 11th September 2008 01:49 PM
RB0 External Interrupt Problem Suraj143 Micro Controllers 6 30th August 2007 07:26 AM
how to handle external interrupt anch Micro Controllers 1 3rd June 2006 03:21 AM
external interrupt neelam29 Micro Controllers 4 11th March 2006 02:50 PM
external interrupt address neelam29 Micro Controllers 4 25th February 2006 03:00 AM



All times are GMT. The time now is 04:28 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker