arrays - Use of memory in c++ -
i'm not sure how pose question, here goes:
when programming on atmel mcu's in c++ tend mix 'program'-variables , 'user'-variables in same datamemory. in time hassle because want make few presets can loaded or saved. , not want 'program'-variables saved because program generate correct values based on 'user'-values. common practice split in memoryplaces? eg. timercounter in pgm-memory, thresholdbyuser in data-memory?
in program i've made several different functions have own set of uservariables. eg: settings has 5 uservariables, generator has 6 uservariables etc... make 1 big array , make
#define settingsgeneratorspeed 1, #define settingsbacklight 2
places, call them such:array[generatorspeed], array[settingsbacklight]
or still split , collect them using struct orso?
working on atmelstudio 4.0 atmega644 on stk500.
thanks can give!
assuming using at(x)mega, when referring atmel mcu's: iirc depends compiler suite using. gcc, if have static int, go pgm , copied ram when program runs. hence, if want variables not in pgm memory, must make them stack or heap variables. constants , statics reside in both. if wan't have pgm constants only, can specifiy that, requires special read operations.
Comments
Post a Comment