diff --git a/prosjekt.X/fan_speeeed.c b/prosjekt.X/fan_speeeed.c
index 26c7292..d686cab 100644
--- a/prosjekt.X/fan_speeeed.c
+++ b/prosjekt.X/fan_speeeed.c
@@ -8,7 +8,7 @@ volatile uint16_t falling_edge_counter = 0;
void TCA0_init() {
TCA0.SINGLE.INTCTRL = TCA_SINGLE_OVF_bm ;
TCA0.SINGLE.CTRLA = TCA_SINGLE_ENABLE_bm | TCA_SINGLE_CLKSEL_DIV1024_gc ; /* Sysclk /1024 */
-TCA0.SINGLE.PERBUF = 0x0F42;
+TCA0_update_period_ms();
}
void TCA0_update_period_ms() {
@@ -23,7 +23,7 @@ uint16_t RPM_calculation() {
}
void PORT_init(){
- PORTB.PIN2CTRL = PORT_ISC_FALLING_gc;
+ PORTD.PIN2CTRL = PORT_ISC_FALLING_gc;
}
@@ -33,10 +33,16 @@ ISR ( TCA0_OVF_vect ) {
RPM_calculation();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm ;
+
sei();
}
-ISR(PORTB_PORT_vect){
- PORTB.INTFLAGS = PIN2_bm;
+ISR(PORTD_PORT_vect){
+ cli();
falling_edge_counter ++;
+
+ PORTD.INTFLAGS = PIN2_bm;
+ sei();
+
+
}
diff --git a/prosjekt.X/nbproject/configurations.xml b/prosjekt.X/nbproject/configurations.xml
index 8884ea2..f9bbb88 100644
--- a/prosjekt.X/nbproject/configurations.xml
+++ b/prosjekt.X/nbproject/configurations.xml
@@ -42,7 +42,7 @@
3
-
+
@@ -184,6 +184,8 @@
+