Ldom Posted July 14, 2008 Report Share Posted July 14, 2008 Hi there,I haven't received the hardware yet from Mike but I'm already thinking about the program for the application I want to build. Basically, I want to build a live song sequencer tool for my SP-404 Roland sampler triggered by a foot controller. I play the bass (hence the foot controller) and the SP-404 plays the rest of the music. I want to control the transitions by foot, so the idea is to get the midibox to get input from the foot controller and then send specific notes to the SP-404 to start/stop samples. To achieve this, I'll need a little bit of space to save the transitions (that I'll group into a song). I'll input those songs and settings through a simple 5-button/LCD user interface.On to my question... I'm new to MIOS and I've noticed the PIC is a flash-based chip. Which means (correct me if I'm wrong) that the 32K of flash memory are used by the 8k of the MIOS bootloader and the program we write.My asumption is that the rest is available to save data. Am I correct? If yes, what is the typical amount of user data we can count on?Also, how do I know what is the available space on the flash or where does it start? I've seen the MIOS_FLASH_Read/Write() functions but I haven't found a function or a way that we'll let me find where the available memory starts. Or do I just have to know what is the size of my program and then use the memory that starts right after its last byte?Any help will be greatly appreciated.Thanks in advance,Laurent Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 14, 2008 Report Share Posted July 14, 2008 Hi,the memory size of the PIC depends on the specific PIC you are using.two topics, that should cover your basic questions:http://www.midibox.org/forum/index.php/topic,5962.0.htmlhttp://www.midibox.org/forum/index.php/topic,8904.0.htmlbest,Michael Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 15, 2008 Report Share Posted July 15, 2008 If your sequence data is entered at run-time, which you said it is, then it needs to be dynamic...better to save it in the PIC's internal SRAM (IE, use a variable) or an external bankstick, than in the codespace where it cannot be changed. On top of the 32-96k of codespace, you also have 2-4k of variables, which is way more than you need :)Do you prefer to code in C or ASM? Quote Link to comment Share on other sites More sharing options...
Ldom Posted July 15, 2008 Author Report Share Posted July 15, 2008 Thanks for your messages.Yes, the sequence data will be entered at run-time. I'm still a little bit confused by the terms I read in the PIC litterature. I read there is the RAM, the data EEPROM and the Program Memory. I take it that the data EEPROM is to be used with the MIOS_EEPROM_Read/Write functions, and I also understand that the program memory cannot be used for data storage (which is fine). My problem is to save the song sequence data that has been entered by the user (me...) so that after a power off/on my programmed song is still there. If the RAM is volatile and erased when the beast boots, and since I bought a PIC18F452 then I guess my only choice will be to use data banks, as 256 bytes will quickly be too small. Just in case: the RAM is volatile, isn't it?I code in C. I haven't done ASM since my school days but I guess I could get back to it if necessary.Thanks for your help,Laurent Quote Link to comment Share on other sites More sharing options...
audiocommander Posted July 15, 2008 Report Share Posted July 15, 2008 if the 256 bytes are too less for you (which probably is not the case if you intend to store just one patch to be read after starting up), you could also just store a reference to your bankstick patch to point to an "autosave" patch or the last opened/stored patch.That's how I've done it and it works fine. Also, no double read/save operations are required.rgds,m. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 15, 2008 Report Share Posted July 15, 2008 256 bytes will quickly be too smallLet me guess: you don't usually write code for embedded stuff? :DYeh it is nonvolatile. You can use the banksticks as AC mentioned for nonvolatile storage. Quote Link to comment Share on other sites More sharing options...
Ldom Posted July 15, 2008 Author Report Share Posted July 15, 2008 Let me guess: you don't usually write code for embedded stuff? Actually I do, but for slightly larger systems (AMR9-based with 32-MB flash and 32-MB RAM).Now I was saying that because I know I will want to save data for more than a couple songs. My initial calculation were :Average of : 6 transitions per song, one transition is about 3 samples on + 3 samples off. Transition step is index (4 bits) + sample id (1 byte) + action code (4 bits). So in total, a song would use 6 x 6 x 2 bytes = 72 bytes + maybe 10 chars for the name. Which means I could save 3 or 4 songs in the 256 bytes.What do you think? Should I compress more?Regards,Laurent Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 15, 2008 Report Share Posted July 15, 2008 Hmmm maybe this is just that you're unfamiliar with midiboxing then... we get a lot of PC programmers trying to code midibox like windows and you know that ain't gonna work ;)But.... I think maybe you're seeing an obstacle that isnt there... If you have a look at the BankStick page you can see that it's up to 512k of storage.Browse around, and hit the search engines dude! Quote Link to comment Share on other sites More sharing options...
Ldom Posted July 15, 2008 Author Report Share Posted July 15, 2008 Well, after this conversation I feel much better. Yes, I'll definitely use banksticks when I'll need to overcome the storage limitation. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
stryd_one Posted July 15, 2008 Report Share Posted July 15, 2008 No sweat man, keep us posted, it sounds interesting! 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.