Code:
$regfile = "xm64a3def.dat"
$crystal = 32000000
$framesize = 100
$hwstack = 100
$swstack = 100
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
Config Com2 = 38400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM2:" For Binary As #1
Dim Timer0_reload_value As Byte
Timer0_reload_value = 100
Dim Pwm_input As Byte
Pwm_input = 0
Config Tcc0 = Normal , Prescale = 1024 , Resolution = 8
Tcc0_per = Timer0_reload_value
Config Dma = Enabled , Doublebuf = Disabled , Cpm = Ch01rr23
Config Dmach0 = Enabled , Burstlen = 1 , Chanrpt = Enabled , Tci = Lo , Eil = Lo , Singleshot = Enabled , Sar = Burst , Sam = Fixed , Dar = Burst , Dam = Fixed , Trigger = &H02 , Btc = 1 , Repeat = 0 , Sadr = Varptr(timer0_reload_value) , Dadr = Varptr(tcc0_per)
Config Dmach1 = Enabled , Burstlen = 1 , Chanrpt = Enabled , Tci = Lo , Eil = Lo , Singleshot = Enabled , Sar = Burst , Sam = Fixed , Dar = Burst , Dam = Fixed , Trigger = &H01 , Btc = 1 , Repeat = 0 , Sadr = Varptr(tcc0_per) , Dadr = Varptr(pwm_input)
On Dma_ch1 Timer_ovf_int
Config Porte.0 = Input
Porte_pin0ctrl = &B00_011_010 'enable pullup, react on falling edge
Config Event_system = Dummy , Mux0 = Porte.0 , Digflt0 = 8 Mux1 = Tcc0_ovf
'Settings:
'DMACH0: Trigger = EV_SYS_CH1 (TCC0_OVF) , timer0_reload_value --> tcc0_per
'DMACH1: Trigger = EV_SYS_CH0 (PORTE.1) , tcc0_per --> pwm_input
Enable Interrupts
Config Priority = Static , Vector = Application , Lo = Enabled
Print #1 , "START"
Print #1 ,
Do
Loop
Timer_ovf_int:
Print #1 , "Taster betätigt!"
Return
End
Weiß jemand, warum die ISR so oft aufgerufen wird und wie ich es verhindern kann, sodass PRO Tasterdruck nur EIN dma Transfer durchgeführt wird?
Lesezeichen