goule Posted May 4, 2008 Report Share Posted May 4, 2008 Hi people,My user-project is a midi controller with 17 sensors, each of which has a 16 letters name (2 blocs of 8 characters)and the user can change the name at any moment by moving a data wheel on any letter.Here is the way the arrays are declared : unsigned char CTL_NAME_PART1[17][9]; // the ninth character is for \0 unsigned char CTL_NAME_PART2[17][9]; Today these arrays are initialized byte after byte from the content of the bankstick. But I'm not very satisfied with a solution that relies on the content of the bankstick. I want to find a way to initialize the arrays, and I want to avoid doing it letter by letter. The problem is when I try this : CTL_NAME_PART1[0] = "Whatever string"; I get a "cannot assign values to aggregates" error ... any idea ?I already tried other solutions, some of them telling me I hadn't enough memory to do this ... is it bad news ?Is there a real risk to rely on the content of the bankstick ? For instance, what happens if the bankstick module itself gets unplugged ? Is all the data lost ?Thanks for your help !Olivier Quote Link to comment Share on other sites More sharing options...
stryd_one Posted May 4, 2008 Report Share Posted May 4, 2008 Well firstly that string's too long ;) Although maybe that's not the problem, it doesn't help that we aren't looking at real code... I can see a few reasons that might not work...Just to demonstrate why it's important to show the real code, when I tried what you said, unsigned char CTL_NAME_PART1[17][9]; // the ninth character is for \0 CTL_NAME_PART1[0]= "whatever"; I got this: main.c:74: error 47: indirections to different types assignment from type 'const-char code-[9] ' to type 'unsigned-char' Which is expected because I'm trying to assign the string from codespace to ram. You need to use memcpy or similar for that. (Note that the last time I tried memcpy it didn't work and I didn't try ito fix it yet) In order to get the error you referred to, I had to do this: unsigned char mytest[9]={"Whatever"}; CTL_NAME_PART1[0] = mytest[0]; So... do like my sig, and copy and paste, please!The memory errors may or may not be problematic, uhm... can you copy and paste for us ;) Quote Link to comment Share on other sites More sharing options...
audiocommander Posted May 4, 2008 Report Share Posted May 4, 2008 Hi Olivier,Today these arrays are initialized byte after byte from the content of the bankstick. But I'm not very satisfied with a solution that relies on the content of the bankstick. I want to find a way to initialize the arrays' date=' and I want to avoid doing it letter by letter.[/quote'] why don't you use the EEPROM for additionally storing the last loaded/saved or initial patch? There should be enough space to store 17 strings...I don't know why you think it's so bad to read it char by char. The best other approach I can imagine would be to read the whole 64 byte page, but I don't see how that could fit into your 17 * 17 * 9 pattern.Cheers,Michael Quote Link to comment Share on other sites More sharing options...
goule Posted May 4, 2008 Author Report Share Posted May 4, 2008 Hey guys thanks for showing up ;DEEPROM would have been great solution but 17*16=272 bytes ... bit too much :( (256 available)I did the test to totally unplug the bankstick module & replug it; of course everything's still there :-[ I was a fool to have doubts about this ...I'll go for the simplier BankStick way of storing my names. I got 8 sticks so I'll dedicate 7 for the presets (with the FFU fiels I can store 64 presets per module, that gives 7*64=448 presets which is already way too much 8)The end is near ! ;D :)Thanks guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.