Interrupt change


hi,
i have push button on pin 13 of 328p.
i've been using following code change interrupt:
code: [select]

volatile long ticks = 0;
long oldticks=0;

signal(pcint0_vect) {
 ticks++;
}

void setup()
{
 serial.begin(9600);
 digitalwrite(13,high);
 pinmode(13, input);
 pcmsk0 |= 32;
 pcicr |= 1;
}

void loop() {
 if (ticks>oldticks)
 {
   oldticks=ticks;
   serial.println("interrupt");
 }
}

first question:
is interrupt change needed or there label pcint0_vect applies pin 13?
second question:
what need change same thing on 2560?

thanks,
ri

well, looked in 2560 datasheet , answered own question...
the pin 13 on 2560 pcint7.
so changing this:
 pcmsk0 |= 32;
to this:
 pcmsk0 |= 128;
did trick.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Interrupt change


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums