Subject: Interrupts
Hallo,
ich hab jetzt mal zum Testen von Interrupts ein kleines Programm geschrieben, aber es funktioniert nicht
#include <led.h>
#include <button.h>
#include <avr/interrupt.h>
#include <avr/io.h>
static volatile int x;
ISR(INT0_vect){
x++;
}
void init(){
DDRD &= ~(1<<PD2); /* Button 0 als Eingang */
PORTD |= (1<<PD2); /* pull-up*/
GICR |= (1<<INT0); /* INT0 - Interrupt anschalten */
MCUCR |= (1<<ISC01)|(1<<ISC00); /*steigende Flanke*/
}
void main(void){
init();
while(1){
sb_led_on(x);
}
}
Was ist daran falsch, es macht mir die 1. Led an, und dann passiert nix bei Tastendruck.
Gruß
Zerotan
ich hab jetzt mal zum Testen von Interrupts ein kleines Programm geschrieben, aber es funktioniert nicht

#include <led.h>
#include <button.h>
#include <avr/interrupt.h>
#include <avr/io.h>
static volatile int x;
ISR(INT0_vect){
x++;
}
void init(){
DDRD &= ~(1<<PD2); /* Button 0 als Eingang */
PORTD |= (1<<PD2); /* pull-up*/
GICR |= (1<<INT0); /* INT0 - Interrupt anschalten */
MCUCR |= (1<<ISC01)|(1<<ISC00); /*steigende Flanke*/
}
void main(void){
init();
while(1){
sb_led_on(x);
}
}
Was ist daran falsch, es macht mir die 1. Led an, und dann passiert nix bei Tastendruck.
Gruß
Zerotan
Show profile
Link to this post