#define PCICR *((volatile uint8_t *)0x68) //dis is a main register n we have to enable d appropriate bit to select the correct port(like b or c or d)
#define PCIFR *((volatile uint8_t *)0x3B)
#define PCMSK2 *((volatile uint8_t *)0x6D) /*dis is a local register when enabled by the main register we selected that port n now we have to select the pin form that selected port to acts as the interrupt pin*/
#define PCMSK1 *((volatile uint8_t *)0x6C)
#define PCMSK0 *((volatile uint8_t *)0x6B)
void setup()
{
// pin change interrupt works on any change of signal like falling and rising
PCICR |=(1<<0);
PCMSK0 |=(1<<3);
pinMode(13,OUTPUT);
pinMode(13,LOW);
Serial.begin(9600);
}
void loop()
{
}
ISR(PCINT0_vect)
{
int x,y=1;
x = digitalRead(11);
Serial.println(y);
if(x==1)
{
y++;
if((y%2)==0)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
}