PDA

View Full Version : Multitasking Ideas



HYETİK
- 14th April 2009, 09:52
I want to do two or more processes at the same time, I searhed on net and find some ideas for multitasking with pic mcu.

And what you think about it?

tenaja
- 14th April 2009, 14:59
You can either use interrupts, or you can use a loop where you poll conditions to perform different operations.

Just like Windows before dual processors, the PIC cannot multitask. It can only give time slices each task. It is up to you how to allocate the time slices.

Melanie
- 14th April 2009, 18:25
Actually I disagree... PICs can multitask...

... from another thread (to paraphrase a quote from BattleStar Galactica "all of this has happened before and will be again")...

--- available from use of the SEARCH button ----

Usually you need multiple or parallel processors to do multitasking. Most computers give the illusion of multitasking through a process of time-slicing - ie devoting a portion of the overall CPU time to a given job, then switching to another task. If done fast enough then you have your multi-tasking illusion (typical example is Microsoft Windows).

Actually PICs do genuinely multitask quite well. They're able to sample an ADC channel, perform multiple Timer functions, execute PWM trains, catch data in the USART and perform Analogue Comparisons all genuinely simultaneously whilst your program is doing something completely different. It's called using the features provided within your PIC and the secrets of exploiting these multitasking features are... in the Datasheet.

tenaja
- 15th April 2009, 00:05
Well, ok, the peripherals can multitask, but the code execution cannot.

Bruce
- 15th April 2009, 01:08
PICs can multitask...
Yep. As far as hardware is concerned, they definitely can multi-task.

As for firmware, nope. Not even the fastest controller can. They all execute program
instructions line-by-line - no matter how creative the programmer is. And time-slicing
is for sure not real multi-tasking

HYETİK
- 15th April 2009, 07:48
I agree with him time slicing is not multitasking, it is another form of code execution line by line:(

I think that if I use one more pic I can multiask comfortable. In my latest project I used a main controller Pic 18f452 and a slave pic 16f628 to do real multitask. And it really working:)

I send slave pic processes serially,when it doing its process, main mcu does another things:)

When the main processor doing program saving or something else, slave pic cut material,count etc. However it is a industrial machine,it work fine. Now it has no problem,hope it has no problem.

HYETİK
- 15th April 2009, 07:50
And I couldn't use time slicing operation, for me it is so complex:(

Thanks all:)
Hasan.