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

BASCOM-AVR : Filling byte arrays : REPLY

$
0
0
MWS wrote: > I know Bascom is easy to handle, but that doesn't mean one has to write such horrible code. > First, you use up sram to put constant data in it (it looks it is never changed), and for initializing > the sram you use up flash. > Why don't you read the data directly out of flash ? Put it in "Data" lines and copy it via Read() > or Lookup() into your array, this would greatly reduce sram use, the same as flash, as every > Code: > Datas(n) = &Hxx > additionally costs several words of flash. Reading out of flash reduces this code-mess into a > few lines and in the same would reduce the probably of an indexing error, while > hand-numbering all these variables. Horrible code? Well, I won't dispute that... I am not a programmer, I am a hardware guy that writes code to make the hardware work. That is how I came to Bascom years ago... because it is very powerful and at the rather simple level at which I code, that is what I want. And the Atmel AVR uCs are cheap and powerful. The code in my original post was a simplified example of a larger piece. I suspect that if you saw the whole thing that it would cause cardiac arrest. But it is working now. I am using a mega8 and I still have 35% flash remaining and my last variable is at 489 (decimal) out of about 900 bytes. I did find in the Bascom-AVR Archives an elegant example of an ASCII-to- morse code program using string variables that is far simpler (and easier to understand) than mine that I will use in any future beacon. This may have been what hgrueneis was suggesting in his post but until I saw the actual code, I did not know how to approach the string method. Thank you for your interest... Sid

Viewing all articles
Browse latest Browse all 20698

Latest Images

Trending Articles



Latest Images