Nachdem ich mein Winterprojekt wieder aufgenommen habe, stehe ich aktuell beim Xmega-ADC an und komme auf keinen "grünen Zweig"!
Grundsätzlich hat alles im Singlemode bereits soweit funktioniert, ich möchte aber meine Messungen im Freerunn-Mode durch Interrupts ausgelöst realisieren.
Leider ist die Situation aktuell so, daß ich keinen Sample-Durchlauf hinbekomme, da der Interrupt erst gar nicht ausgelöst wird.
Ich muß 16 Kanäle samplen - hab das aber mal auf ADCA_CH0 beschränkt. Seltsamerweise sehe ich im Simulator in der oberen Auswahlspalte zwar alle möglichen INT vom Xmega aber keinen für ADC_A.
Der INT vom ADC_B hingegen ist sichtbar, lässt sich aber auch nicht simulieren wenn ich den jeweiligen INT drücke. Der INT von PORT_C (Taster) funktioniert einwandfrei sowohl im SIM als auch in "Real".
Gibt es irgendwelche Bugs im SIM bezüglich Xmega ADC oder sehe ich den Wald vor lauter Bäume nicht?
Was passt im Code nicht, daß der ADC-Interrupt nicht kommt?
Für Anregungen wäre ich sehr dankbar
Vielen Dank
LG Walter
Xmega_ADC_SIM01.jpg
Alles anzeigen
Grundsätzlich hat alles im Singlemode bereits soweit funktioniert, ich möchte aber meine Messungen im Freerunn-Mode durch Interrupts ausgelöst realisieren.
Leider ist die Situation aktuell so, daß ich keinen Sample-Durchlauf hinbekomme, da der Interrupt erst gar nicht ausgelöst wird.
Ich muß 16 Kanäle samplen - hab das aber mal auf ADCA_CH0 beschränkt. Seltsamerweise sehe ich im Simulator in der oberen Auswahlspalte zwar alle möglichen INT vom Xmega aber keinen für ADC_A.
Der INT vom ADC_B hingegen ist sichtbar, lässt sich aber auch nicht simulieren wenn ich den jeweiligen INT drücke. Der INT von PORT_C (Taster) funktioniert einwandfrei sowohl im SIM als auch in "Real".
Gibt es irgendwelche Bugs im SIM bezüglich Xmega ADC oder sehe ich den Wald vor lauter Bäume nicht?
Was passt im Code nicht, daß der ADC-Interrupt nicht kommt?
Für Anregungen wäre ich sehr dankbar
Vielen Dank
LG Walter
Xmega_ADC_SIM01.jpg
Quellcode
- $regfile = "xm256a3def.dat"
- $crystal = 16000000 ' oscillator 16MHz
- $hwstack = 100 ' für Interrupt-Handler+Gosub
- $swstack = 100 ' für Gosub und Variablen
- $framesize = 100 ' Wertübergabe von Variablen
- $prog &HFF , &HFF , &H00 , &HFF , &H00 , &HFF , &HFF ' Jtag disabled.
- 'include the following lib and code, the routines will be replaced since they are a workaround
- $lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
- 'first enable the osc of your choice
- Config Osc = Disabled , Pllosc = Disabled , Extosc = Enabled , Range = 12mhz_16mhz , Startup = Xtal_256clk , 32khzosc = Disabled , 32mhzosc = Disabled '16MHz
- 'configure the systemclock
- Config Sysclock = External , Prescalea = 1 , Prescalebc = 1_1 '16MHz
- 'Config Interrupts
- Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled , Hi = Enabled 'Enable Lo, Mid und Hi Level Interrupts
- Config Com4 = 38400 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 'Portd.6 and Portd.7 an COM4 beim Xmega
- Open "COM4:" For Binary As #1
- '
- '
- '
- 'ADC-Config für Zellenmessung-------------------------------------------------------------------------------------
- '-----------------------------------------------------------------------------------------------------------------
- Dim Calibration_word As Word
- Dim Calibration_word1 As Word
- Dim Adca_byte_0 As Byte At Calibration_word Overlay
- Dim Adca_byte_1 As Byte At Calibration_word + 1 Overlay
- Dim Adcb_byte_0 As Byte At Calibration_word1 Overlay
- Dim Adcb_byte_1 As Byte At Calibration_word1 + 1 Overlay
- 'First we read the Calibration bytes form Signature Row (to get the real 12-Bit)
- Adca_byte_0 = Readsig(&H20)
- Adca_byte_1 = Readsig(&H21)
- Adcb_byte_0 = Readsig(&H24)
- Adcb_byte_1 = Readsig(&H25)
- 'Write factory calibration values to calibration register
- Adca_call = Adca_byte_0
- Adca_calh = Adca_byte_1
- Adcb_call = Adcb_byte_0
- Adcb_calh = Adcb_byte_1
- Config Porta = Input ' ADCA für Zellenmessung
- Config Portb = Input ' ADCB für Zellenmessung
- Portcfg_mpcmask = &B11111111 'nachfolgende PINCTRL gilt für alle Pins von PORTA
- Porta_pin0ctrl = &B00_000_111 'Digital Input Buffer Disabled for ADC-PortA,
- Portcfg_mpcmask = &B11111111 'nachfolgende PINCTRL gilt für alle Pins von PORTB
- Portb_pin0ctrl = &B00_000_111 'Digital Input Buffer Disabled for ADC-PortB,
- '