I have an application which requires that a single chip do two separate tasks:
1) maintain very tight, continuous control of an integrator output
2) occasionally check an ADC input to see if the integrator needs to be adjusted and, if yes, to do some mathematical calculations on the input and make a correction to the integrator target output.
I was pretty excited when the multi-tasking chips came along because I thought it would be a piece of cake to assign the integrator to one task and all the 'overhead' to another task, and ordered some 20M2 chips to make that conversion.
But it seems that it ain't that straight forward. In multi-tasking mode, the setfreq command is taken off the table, and the chip seems to run at its default frequency. For me, this slows everything down, and the integrator, even in its own separate task environment, doesn't maintain as good control as it does when it shares resources with the other tasks in a 32MHz environment. In the single-task environment, I wrote the code so that the integrator runs exclusively until the output is 'perfect' then jumps to the other tasks, runs them once, then jumps right back to the integrator to make sure that it's output remains stable.
So, my question is: am I missing something and the multi-tasking approach really should work better, or have I simply discovered an unfortunate truth about the limitations of multi-tasking a picaxe chip?
1) maintain very tight, continuous control of an integrator output
2) occasionally check an ADC input to see if the integrator needs to be adjusted and, if yes, to do some mathematical calculations on the input and make a correction to the integrator target output.
I was pretty excited when the multi-tasking chips came along because I thought it would be a piece of cake to assign the integrator to one task and all the 'overhead' to another task, and ordered some 20M2 chips to make that conversion.
But it seems that it ain't that straight forward. In multi-tasking mode, the setfreq command is taken off the table, and the chip seems to run at its default frequency. For me, this slows everything down, and the integrator, even in its own separate task environment, doesn't maintain as good control as it does when it shares resources with the other tasks in a 32MHz environment. In the single-task environment, I wrote the code so that the integrator runs exclusively until the output is 'perfect' then jumps to the other tasks, runs them once, then jumps right back to the integrator to make sure that it's output remains stable.
So, my question is: am I missing something and the multi-tasking approach really should work better, or have I simply discovered an unfortunate truth about the limitations of multi-tasking a picaxe chip?