Sobakava
Full Member level 6
I'm trying to detect external interrupts using NRF9E5 / 8051 core RF transceiver microcontroller. Development environment is Keil C51
At first I was confused with ISR declarations:
void INT0_ISR( void ) interrupt 0 //0x03{
// Ext INT0 handler
}
void INT1_ISR( void ) interrupt 2 //0x13{
// Ext INT1 handler
}
Is that correct?If so, I still can't figure out why I can't detect external interruptsI enabled the interrupt using EX1 bit.
void INT0_ISR( void ) interrupt 0 //0x03{
// Ext INT0 handler
LED ^= 1; // toggle LED
}void INT1_ISR( void ) interrupt 2 //0x13
{
// Ext INT1 handler
LED ^=1; // toggle LED
}
void main ( void ) {
PO_DIR = 0x57; // P07 output P05 LED. Rest is input
EX0 = 1;
EX1 = 1;
EA = 1;
while( 1 ) {
P07=1; delayms(1);
P07=0; delayms(1);
}
}
Using this piece of code, I could never detect the interrupts applied by an external source or micro-switch with pull up resistors connected to P03 and P04.
These pins are configured as inputs. Interrupts are enabled including global interrupt.
I also enabled a timer0 overflow interrupt to test if any interrupt works. It works.
I tried to toggle LED in main loop. It is also OK.
Somehow I can not generate interrupts using INT1 and INT0 pins. I also tried both configurations; level sensitive mode and edge sensitive mode. It does not help too.
Any ideas? Any tested code for this MCU or any other 8051 core microcontorller with INT0_N and INT1_N interrupt inputs?
Regards
At first I was confused with ISR declarations:
void INT0_ISR( void ) interrupt 0 //0x03{
// Ext INT0 handler
}
void INT1_ISR( void ) interrupt 2 //0x13{
// Ext INT1 handler
}
Is that correct?If so, I still can't figure out why I can't detect external interruptsI enabled the interrupt using EX1 bit.
void INT0_ISR( void ) interrupt 0 //0x03{
// Ext INT0 handler
LED ^= 1; // toggle LED
}void INT1_ISR( void ) interrupt 2 //0x13
{
// Ext INT1 handler
LED ^=1; // toggle LED
}
void main ( void ) {
PO_DIR = 0x57; // P07 output P05 LED. Rest is input
EX0 = 1;
EX1 = 1;
EA = 1;
while( 1 ) {
P07=1; delayms(1);
P07=0; delayms(1);
}
}
Using this piece of code, I could never detect the interrupts applied by an external source or micro-switch with pull up resistors connected to P03 and P04.
These pins are configured as inputs. Interrupts are enabled including global interrupt.
I also enabled a timer0 overflow interrupt to test if any interrupt works. It works.
I tried to toggle LED in main loop. It is also OK.
Somehow I can not generate interrupts using INT1 and INT0 pins. I also tried both configurations; level sensitive mode and edge sensitive mode. It does not help too.
Any ideas? Any tested code for this MCU or any other 8051 core microcontorller with INT0_N and INT1_N interrupt inputs?
Regards