enniom
Joined: 20 Oct 2009 Posts: 537
|
Posted: Sat Oct 31, 2015 3:10 pm Post subject: Config UART and Config OSC on XMEGA |
|
|
After a number of attempts, it appears as if there is a relationship between the statements Config UART and Config OSC.
In this example, the UART will work properly:
Code: | $regfile = "xm192a3def.dat"
$hwstack = 1200
$swstack = 1200
$framesize = 1200
$crystal = 32000000
Config Osc = Disabled , 32mhzosc = Enabled
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'use 32 MHz
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM5:" For Binary As #1
Print #1, "Hello"
End
|
In this example, the UART will not send serial data:
Code: | $regfile = "xm192a3def.dat"
$hwstack = 1200
$swstack = 1200
$framesize = 1200
$crystal = 32000000
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'use 32 MHz
Config Osc = Disabled , 32mhzosc = Enabled
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM5:" For Binary As #1
Print #1, "Hello"
End
|
But if any other executable command is inserted between the two Config statements, then the UART will function properly again. ..... Seems strange.......
Code: | $regfile = "xm192a3def.dat"
$hwstack = 1200
$swstack = 1200
$framesize = 1200
$crystal = 32000000
Config Sysclock = 32mhz , Prescalea = 1 , Prescalebc = 1_1 'use 32 MHz
Config Osc = Disabled , 32mhzosc = Enabled
Dim I as Byte 'Insert
I = 1 'Insert
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM5:" For Binary As #1
Print #1, "Hello"
End
|
E
(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 ) |
|