Multi-File question
Zeus
Posts: 79
Hello Everyone,
Does anyone out there know if it is possible to create a multi-file project, thereby taking advantage of larger capacity chips like a BS2sx, without having to create several separate/individual programs? I need the capacity of a larger stamp but for simplicities sake I am hesitant to break it out into several different programs.
Thanks,
Zeus
Does anyone out there know if it is possible to create a multi-file project, thereby taking advantage of larger capacity chips like a BS2sx, without having to create several separate/individual programs? I need the capacity of a larger stamp but for simplicities sake I am hesitant to break it out into several different programs.
Thanks,
Zeus
Comments
Zeus - partitioning a multi-slot program is not much of a big deal. All one needs to keep in mind is that all slots require the same variable declarations, and at some point, operation must be passed off to another slot.
Case in point...I'm currently working on a menu-driven project that is easily taking up 8K worth of memory. All I need to do is partition my individual sub-menu code into a separate BS2 memory slots. It's all one big program, but broken up into sub-sections (think function calls in C). As the user moves through the menus, different slots are run.
Check this link for more info:
http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv87.pdf
Come on in, the water's fine! :cool:
Thanks for the link, I came across this this other day but could not find it again.
Maybe I am missing something but the following line indicates that the main program is referencing a second/separate program, no?
{$STAMP BS2e, Thermo_LCD.BSE}
Zeus
Each slot's code does reside in a separate file. One of the first few lines in slot 0 (zero) describes/defines the other slot files so they auto-load into their respective memory slots when slot 0 (zero) is loaded.
Does that present a problem?
Yes and no. Yes, in that I did not realize when I started this that it would grow so large that I would have to look at a larger stamp, given this I didn't exactly lay my program out such that it could easily be converted to a series of modular programs. No, in that it can be done with a multi-file structure. If it can't be written as one large file then so be it and I will have to re-write my code a bit, but if it can be done as one continuous file I would be able to resume my coding immediately.
Zeus
There is the need for one slot to "RUN" another slot when the code approaches the end of allocated memory. Which is why (for me), slicing up each menu's code into multiple slots works well.
So you are saying that I will have to load multiple programs due to the size, correct?
Jake
I'm struggling with the terms we're using...but, yes, you'll need to load separate files that contain the complete program. Each file contains up to 2K worth of code that would be loaded into a given memory slot.
Is there a chance you can relate a bit more details of your progam so that suggestions could be made on partitioning? If not, understood.
Dave
How is this done?
Hi NWCCTV,
In my particular case, I have a program that consists of a number of menus that display on a 4X20 LCD: "sign on", "run or program", "select this", "select that", "save selections" (the names are changed to protect the innocent).
Navigation through the menus is done via a rotary encoder and choosing menu items is done with a single button switch.
Each of the 5 menu's code is contained in a separate BS2pe source file (extension .bpe).
The list of source files to load resides in a line at the top of the "sign on" file:
The "sign on" code is loaded into BS2pe memory slot 0. "run or program" into slot 1, "select this" into slot 2, "select that" into slot 3, and "save selections" gets loaded into memory slot 4.
To "hand off" operation from one slot to another in this case, when "sign on" has completed its output to the LCD, it executes a RUN 1 statement. At that time, the code in memory slot 1 begins to execute ("run or program" and its menu). When "run or program" is finished, it executes a RUN 2 statement...and so on...and so on. Actually, I do a bit of error checking and if things don't go as planned, program execution gets routed back to the first memory slot with "sign on".
Did that make any sense?