View previous topic :: View next topic |
Author |
Message |
timbak
|
Posted: Sat Feb 08, 2014 9:16 am Post subject: Atmega256a3bu problem with new (2.0.7.7) version |
|
|
Code doesn't work in chip when compiled in the new (2.0.7.7) version, and doesn't give any errors. In 2.0.7.6 it works well.
I tried to compile with old .dat file (from 2.0.7.6) but get an error 222:
Code: | Illegal character [expected (, got ')' [LBYTE(_UART_BASE)]]
Illegal character [expected (, got ')' [LBYTE(_UART_BASE)+$10]] |
Code: | $regfile = "xm256a3budef.dat"
$crystal = 32000000
$hwstack = 100
$swstack = 100
$framesize = 100
'***************************************************************************************************
Const Xtal_clock = 16000000
Const Pll_multi = 2
'' internal multiplier clock is not distrybuted
Const Prescale_a = 1
Const Prescale_b = 1
Const Prescale_c = 1
Const Cpu_clock = Xtal_clock * Pll_multi / Prescale_a / Prescale_b / Prescale_c
''calculated just for "print"
Config Osc = Disabled , Extosc = Enabled , Range = 12mhz_16mhz , Startup = Xtal_256clk , 32khzosc = Enabled
''Set the Multiplication factor and select the clock Reference for the PLL
Cpu_ccp = &HD8
Osc_pllctrl = &B11_0_00000 + Pll_multi ' EXTERNAL clock Source and Multiplication factor OR mask
Set Osc_ctrl.4 ' PLL enable
''must be writen manually
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1
'***************************************************************************************************
Config Priority = Static , Vector = Application , Lo = Enabled , Hi = Enabled
Config Com1 = 115200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM1:" For Binary As #1
On Usartc0_rxc Bt_in
Enable Usartc0_rxc , Hi
Enable Interrupts
Dim Z As Byte
Do
Wait 1
Print #1 , "Test"
Loop
End
Bt_in:
Z = Inkey(#1)
If Z = 123 Then
Goto &H20000
Else
Gosub Uart_sub
End If
Return
Uart_sub:
Print Chr(z);
Return |
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Feb 08, 2014 12:32 pm Post subject: |
|
|
Always check register.mcselec.com ! The enhancements/bugs contain info about changes since the release :
xmega, config OSC : when using external osc, enable the internal osc as well.
So for you : Config Osc = Enabled , Extosc = Enabled , Range = 12mhz_16mhz , Startup = Xtal_256clk , 32khzosc = Enabled
This is a bug caused by an improvement. the improvement is to wait for the status bits till the oscillator is ready. But when not using the internal osc, this bit can become 1 despite it is not enabled, leading to a wrong compare.
So as a workaround, enable the internal osc. _________________ Mark |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|