![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
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. | |
| |
| | #2 | |
| Quote:
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/ | ||
| |
| | #3 |
| 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;
}
| |
| |
| | #4 |
|
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/ | |
| |
| | #5 |
|
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 )
| |
| |
| | #6 |
|
I made the changes you told but still interrupt is happening only once give me some other solutions...........please | |
| |
|
| 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 |