Hallo Forum,
ich versuche bisher vergeblich den RTC32 Counter des ATXMega256A3BU zum laufen zu bekommen. Habe verschiedene Beispiele getestet, ich sehe aber aktuell noch nicht wo das Problem ist.
Hat jemand ein lauffähiges Beispiel für einen ATXMega mit RTC32 (ATXMega256A3BU) oder kann mir sagen wo der Fehler in meinem Code ist?
Liebe Grüße
Andreas
Alles anzeigen
ich versuche bisher vergeblich den RTC32 Counter des ATXMega256A3BU zum laufen zu bekommen. Habe verschiedene Beispiele getestet, ich sehe aber aktuell noch nicht wo das Problem ist.
Hat jemand ein lauffähiges Beispiel für einen ATXMega mit RTC32 (ATXMega256A3BU) oder kann mir sagen wo der Fehler in meinem Code ist?
Liebe Grüße
Andreas
BASCOM-Quellcode
- '(
- '*******************************************************************************
- Controller Belegung:
- UART 1
- UART C1
- RX PC6 PIN22
- TX PC7 PIN23
- UART 2
- UART C0
- Rx Pc2 Pin18
- TX PC3 PIN19
- I2C
- SDA PD0 PIN26
- SCL PD1 PIN27
- I2C INT PC1 PIN17
- SPI
- CS PD4 PIN30
- MOSI PD5 PIN31
- MISO PD6 PIN32
- SCK PD7 PIN33
- GPIO
- LED DATA PC0 PIN16
- '*******************************************************************************
- ')
- '$programmer = 16 'USBprog Programmer/ AVR ISP mkII (Atmel)
- $programmer = 13 'MSC Bootloader
- $regfile = "xm256a3budef.dat"
- $crystal = 32000000
- $hwstack = 64
- $swstack = 64
- $framesize = 64
- $lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
- Config Osc = Enabled , 32mhzosc = Enabled , Extosc = Enabled , Startup = Extclk
- Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1
- Config Clock = Soft , Rtc32 = 1khz_32khz_crystosc , Gosub = Sectic
- Config Priority = Static , Vector = Application , Lo = Enabled
- Enable Interrupts
- 'UARTC0, PIN 18, 19
- Config Com1 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART C0
- Config Com2 = 19200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 ' use USART C0
- 'Open all UARTS
- Open "com2:" For Binary As #1
- Print "COM 1"
- Print #1 , "COM 2"
- Config Porte.2 = Output
- Leddata2 Alias Porte.2
- Leddata2 = 0
- Config Porte.3 = Output
- Leddata3 Alias Porte.3
- Leddata3 = 0
- Dim Count As Byte
- Dim Lsyssec As Long
- Dim Second_tick As Bit
- Do
- Incr Count
- Print "hallo com 1 " ; Count
- Print #1 , "hallo com 2 " ; Count
- Toggle Leddata2
- Waitms 250
- If Second_tick = 1 Then
- Second_tick = 0 ' Flag Reset
- Toggle Leddata3
- Lsyssec = Syssec() ' Number, which represents the System Second
- Print Time$ ; " " ; Lsyssec
- Print #1 , Time$ ; " " ; Lsyssec ' print the system time
- End If
- ' print the time
- Loop
- 'Interrupt Routine for 32-Bit RTC
- Sectic:
- Second_tick = 1
- Return
- Close #1
- End
Mancher Baum hätte wohl sein Wachstum eingestellt, wenn er gewusst hätte was hinterher für ein Mist auf seinem Papier geschrieben wird.