Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20767

BASCOM-AVR : Bug when using more than 64k Flash on ATMega 1284P : NEWTOPIC

$
0
0
I may have found a strange bug, when more than 64k of the flash in an ATMega 1284P is used. Look at the attached program, which is an excerpt of a very long program but where the bug already shows up. $regfile = "m1284pdef.dat" $framesize = 200 $swstack = 200 $hwstack = 200 $crystal = 20000000 Dim Float1 As Single Dim Delta_phase As Dword Dim Dds_constant As Dword Dim Freq_ As Single Dim F_irq As Dword Freq_ = 1000 F_irq = _xtal / 256 Dds_constant = &HFFFFFFFF / F_irq Float1 = Freq_ * Dds_constant Delta_phase = Float1 End DATA ......... When you uncompress the attached RAR-file and compile it the program at first uses [u:9e3918a88f]less[/u:9e3918a88f] than 64k of the flash because at the end the second half of the DATA-lines is remarked. If you simulate the program the variable "Float1" is correctly calculated as 5.4975E+7. Now delete the "'(" and the "')" at the second half of the data lines (label: "White_noise_data:") and recompile. The program now is bigger than 64k and if you simulate it the variable Float1 is suddenly 0??? Any idea if this is a real bug or if I oversee a stupid error of mine? Remark: The (sometimes very long) DATA lines were calculated with Open Office Calc, then stored as a CSV-file then loaded into a text editor and from there copied into the BASCOM editor. Kind regards Roger Now [b:9e3918a88f][color=red:9e3918a88f](BASCOM-AVR version : 2.0.7.6 )[/b:9e3918a88f][/color:9e3918a88f]

Viewing all articles
Browse latest Browse all 20767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>