right pins

This commit is contained in:
Inamr 2024-04-09 16:46:54 +02:00
parent 63aa397b78
commit 23904b03ea
2 changed files with 13 additions and 5 deletions

View File

@ -8,7 +8,7 @@ volatile uint16_t falling_edge_counter = 0;
void TCA0_init() { void TCA0_init() {
TCA0.SINGLE.INTCTRL = TCA_SINGLE_OVF_bm ; TCA0.SINGLE.INTCTRL = TCA_SINGLE_OVF_bm ;
TCA0.SINGLE.CTRLA = TCA_SINGLE_ENABLE_bm | TCA_SINGLE_CLKSEL_DIV1024_gc ; /* Sysclk /1024 */ 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() { void TCA0_update_period_ms() {
@ -23,7 +23,7 @@ uint16_t RPM_calculation() {
} }
void PORT_init(){ 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(); RPM_calculation();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm ; TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm ;
sei(); sei();
} }
ISR(PORTB_PORT_vect){ ISR(PORTD_PORT_vect){
PORTB.INTFLAGS = PIN2_bm; cli();
falling_edge_counter ++; falling_edge_counter ++;
PORTD.INTFLAGS = PIN2_bm;
sei();
} }

View File

@ -42,7 +42,7 @@
<platform>3</platform> <platform>3</platform>
</toolsSet> </toolsSet>
<packs> <packs>
<pack name="AVR-Dx_DFP" vendor="Microchip" version="2.3.272"/> <pack name="AVR-Dx_DFP" vendor="Microchip" version="2.4.286"/>
</packs> </packs>
<ScriptingSettings> <ScriptingSettings>
</ScriptingSettings> </ScriptingSettings>
@ -184,6 +184,8 @@
<property key="memories.programmemory" value="true"/> <property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/> <property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="false"/> <property key="poweroptions.powerenable" value="false"/>
<property key="programmerToGoFilePath"
value="C:/Users/inami/Documents/mikrokontrollersystemer-prosjekt/prosjekt.X/debug/default/prosjekt_ptg"/>
<property key="programoptions.eraseb4program" value="true"/> <property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/> <property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges" <property key="programoptions.preservedataflash.ranges"