Hi,
I want the below code explanation please.
1.how to use using?what is the meaning of using interrupt 0 using 2 ? 2. how to assign irq & fiq addresses ?
#include "reg51.h" typedef unsigned long uint32;
// INT0 ISR (Bank Register Settting) void led_rotate_left (void) interrupt 0 using 2{
char xdata *IRQSOFTA = 0xff18; char xdata *IRQSOFTCLEARA = 0xff1c; char xdata *IRQENABLEA = 0xff20; char xdata *IRQENCLEARA = 0xff24; char xdata *IRQRAWSTATUSA = 0xff28; char xdata *IRQSTATUSA = 0xff2c;
unsigned char p2out; // output to port 2 pins unsigned char p2in; // input from port 2 pins
char xdata *PORT0 = 0xf000; char xdata *PORT1 = 0xf100; char xdata *PORT2 = 0xf200;
// Disable any further interrupts on INT0 for duration of ISR *IRQENCLEARA = 0x01;
// Clear the interrupt source *PORT0 = 0x01; *PORT0 = 0x00; // Clear the interrupt source *PORT1 = 0x01; *PORT1 = 0x00;
p2in = *PORT2 & 0xff; // read LED status
if (p2in == 0x80) { p2out = 0x01; } else { p2out = p2in<<1; }
// Put result on port 2 outputs (LEDs) *PORT2 = p2out & 0xff;
// Re-enable INT0 interrupts *IRQENABLEA = 0x01;
}
// INT1 ISR void led_rotate_right (void) interrupt 2 using 2 {
char xdata *FIQSOFTA = 0xff00 char xdata *FIQSOFTCLEARA = 0xff04; char xdata *FIQENABLEA = 0xff08; char xdata *FIQENCLEARA = 0xff0c; char xdata *FIQRAWSTATUSA = 0xff10; char xdata *FIQSTATUSA = 0xff14;
unsigned char p2out; // output to port 2 pins unsigned char p2in; // input from port 2 pins char xdata *PORT0 = 0xf000; char xdata *PORT1 = 0xf100; char xdata *PORT2 = 0xf200;
// Disable any further interrupts on INT1 for duration of ISR *FIQENCLEARA = 0x01;
// Clear the interrupt source *PORT1 = 0x01; *PORT1 = 0x00; // Clear the interrupt source *PORT0 = 0x01; *PORT0 = 0x00; (null) p2in = *PORT2 & 0xff; // read LED status
if (p2in == 0x01) { p2out = 0x80; } else { p2out = p2in>>1; }
// Re-enable INT0 interrupts *FIQENABLEA = 0x01; }
void main (void) {
char xdata *FIQENABLEA = 0xff08; ' char xdata *IRQENABLEA = 0xff20;
char xdata *PORT2 = 0xf200;
// Enable interrupts by setting EAL, EX0 and EX1 bits in Interrupt Enable SFR. IE = 0x85; //Ie = 1000 0101
// Enable irq interrupt 0 of CoreInterrupt (Connected to Core8051s INT0) *IRQENABLEA = 0x01; //0000 0001 // Enable fiq interrupt 0 of CoreInterrupt (Connected to Core8051s INT1) *FIQENABLEA = 0x01; //0000 0001
// Initialize the LED pattern *PORT2 = 0x07;//0x01; // 0000 0111
// infinite loop while (1);
please kindly reply as soon as possible.
thanks & regards shruthi nd