Discussion forum for the BasicX family of microcontroller chips.
|
Help! My question is, should I even bother? Is this futile? I am attempting to make a PID controller using a barebones BX24, no RAM Sandwich or LCD+. I'm happy with my interface running a Hitachi HD44780 based Optrex LCD 2-line display and four input buttons (Mode select, UP, DOWN and Commit) but am stymied by getting even a trivial background task to run. According to the project's .MMP file I am using only 37 bytes of module level (static) RAM and the deepest call stack is 21 bytes, or about 32-bytes including its largest nested call. The program uses 4700 bytes of code memory. I've attempted a trivial global flag-setting background task with 40, 80 and 120-byte task-stacks with no luck. I've made tiny mutitasking programs to confirm my understanding and I've scoured this group's archives, the BasicX site, Google Groups (Usenet) and AltaVista, but this thing just doesn't go! I understand that without seeing the code there's a lot of useful details absent, so my question at a gross level is simply, should I bother? Is the barebones BX24 capable of mutitasking in a non- trivial application? Thanks very much for any help, Charles Rich |
|
|
|
the BX is capable uf running multipal tasks, and quite well. your bigest limit will be ram. send me your MPP file so that I can see what you have to play with. 256 total for the 24. - comport quques - stack space + resable varables ' this is good. define a few globals (2) and use them in subs & functions as scrach pad bytes. it does help. - nested subs 'this is very bad + a wast of space. for the bx it is better to have many sections of code doing the same thing then to neest the loops too deep. 2 deep max or you are wasting ram. (I was bit with this when I started coding for the bx) --- wrote: > Help! My question is, should I even bother? Is this futile? > > I am attempting to make a PID controller using a barebones BX24, no > RAM Sandwich or LCD+. I'm happy with my interface running a Hitachi > HD44780 based Optrex LCD 2-line display and four input buttons (Mode > select, UP, DOWN and Commit) but am stymied by getting even a trivial > background task to run. > > According to the project's .MMP file I am using only 37 bytes of > module level (static) RAM and the deepest call stack is 21 bytes, or > about 32-bytes including its largest nested call. The program uses > 4700 bytes of code memory. > > I've attempted a trivial global flag-setting background task with 40, > 80 and 120-byte task-stacks with no luck. I've made tiny mutitasking > programs to confirm my understanding and I've scoured this group's > archives, the BasicX site, Google Groups (Usenet) and AltaVista, but > this thing just doesn't go! > > I understand that without seeing the code there's a lot of useful > details absent, so my question at a gross level is simply, should I > bother? Is the barebones BX24 capable of mutitasking in a non- > trivial application? > > Thanks very much for any help, > Charles Rich > __________________________________________________ |
|
One common thing I have seen is that there is a lack of understanding that the multitasking is not preemptive. It is a round robin tasking system. This means, if you one of your tasks does not have a sleep call in it, the others will not be given a chance to run. If this is the case, just throw in a few Sleep( 0 ) calls in loops and the such and things will start to move. --- In basicx@y..., crich@f... wrote: > Help! My question is, should I even bother? Is this futile? > > I am attempting to make a PID controller using a barebones BX24, no > RAM Sandwich or LCD+. I'm happy with my interface running a Hitachi > HD44780 based Optrex LCD 2-line display and four input buttons (Mode > select, UP, DOWN and Commit) but am stymied by getting even a trivial > background task to run. > > According to the project's .MMP file I am using only 37 bytes of > module level (static) RAM and the deepest call stack is 21 bytes, or > about 32-bytes including its largest nested call. The program uses > 4700 bytes of code memory. > > I've attempted a trivial global flag-setting background task with 40, > 80 and 120-byte task-stacks with no luck. I've made tiny mutitasking > programs to confirm my understanding and I've scoured this group's > archives, the BasicX site, Google Groups (Usenet) and AltaVista, but > this thing just doesn't go! > > I understand that without seeing the code there's a lot of useful > details absent, so my question at a gross level is simply, should I > bother? Is the barebones BX24 capable of mutitasking in a non- > trivial application? > > Thanks very much for any help, > Charles Rich |
|
|
|
From: <> writes: > According to the project's .MMP file I am using only 37 bytes of > module level (static) RAM and the deepest call stack is 21 bytes, > or about 32-bytes including its largest nested call. The program > uses 4700 bytes of code memory. > [...] > I understand that without seeing the code there's a lot of useful > details absent, so my question at a gross level is simply, should > I bother? Is the barebones BX24 capable of mutitasking in a non- > trivial application? If the call stack really only uses 32 bytes, then multitasking should be no problem. But it's very difficult to say without seeing the code. Any chance you could post it? Or at least the general requirements? -- Frank Manning -- NetMedia, Inc. |
|
|
|
From: <> writes: > According to the project's .MMP file I am using only 37 bytes of > module level (static) RAM and the deepest call stack is 21 bytes, > or about 32-bytes including its largest nested call. The program > uses 4700 bytes of code memory. > [...] > I understand that without seeing the code there's a lot of useful > details absent, so my question at a gross level is simply, should > I bother? Is the barebones BX24 capable of mutitasking in a non- > trivial application? If the call stack really only uses 32 bytes, then multitasking should be no problem. But it's very difficult to say without seeing the code. Any chance you could post it? Or at least the general requirements? -- Frank Manning -- NetMedia, Inc. |
|
|
|
Thanks Frank, I have been unrolling the nested calls in the program in order to flatten the call stack. So the code may look like a mess but I have uploaded it to the bx24 files area of the group. I am mostly encouraged by just hearing that it *should* multitask fine. This is apparently just part of the learning curve for me. I'd like to thank everyone who has commented on this so far. I have learned a lot from you all. Thanks, Charles Rich (Seattle-area, USA) --- In basicx@y..., "Frank Manning" <fmanning@n...> wrote: > From: <crich@f...> writes: > > > According to the project's .MMP file I am using only 37 bytes of > > module level (static) RAM and the deepest call stack is 21 bytes, > > or about 32-bytes including its largest nested call. The program > > uses 4700 bytes of code memory. > > [...] > > I understand that without seeing the code there's a lot of useful > > details absent, so my question at a gross level is simply, should > > I bother? Is the barebones BX24 capable of mutitasking in a non- > > trivial application? > > If the call stack really only uses 32 bytes, then multitasking should be no > problem. > > But it's very difficult to say without seeing the code. Any chance you could > post it? Or at least the general requirements? > > -- Frank Manning > -- NetMedia, Inc. |
|
From: Charles Rich <> > I have been unrolling the nested calls in the program in > order to flatten the call stack. So the code may look > like a mess but I have uploaded it to the bx24 files > area of the group. [...] Well, I wouldn't call the code a mess. In fact, it's not very often I see indentation that good -- I only found one or two mistakes. Other than that, it's right up there with Peter Anderson's code, if you ask me. I don't see any obvious problems with the multitasking part. What symptoms are you seeing? Does the program hang or what? Also, what setting are you using for the maximum length of variable length strings? -- Frank Manning -- NetMedia, Inc. |