Exact match. Not showing close matches.
'[PIC:] Has anyone made their own multitasker for a'
|I wass considering making a crude multitasker for the PIC
and even the SX device. Especially with SX devices with its
blinding up-to 100MIPS speed, it would benefit from such
a multitasking scheme. The way I would do it is to create
a number or threads that execute every interrupt cycle,
which interval depends on the timer overflow. For example, an interrupt can be set to occur ever 20us. And if there are
32 threads, each thread would excute every 640us.
The program flow in each thread would procede a certain
amount of cycles, and to the discretion of the programmer,
the routine would exit and return from interrupt. Before
exiting the routine, the PC could be saved and when the
same routine runs again, the program flow could resume at the same spot. Why do all of this? It would allow me to have (in this case) 32 seperate processes that can run relatively independent of each other. In high speed devices such as the SX processor, there can be much idle time while reading and writing to an I2C eeprom, doing an A/D reading etc. This method could maximize efficiency and allow more complex operations. I would love to hear comments and ideas from others.
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
i once did that on a 8049 in the late 80s.
I used an empty main loop to wait for the next int. Therefore all threads
did need to finish before the next int happened. Since every task was ended
before a second int, there was no need to store the exit point which is
always the same. Also the routines are always executed from the start. That
means no worry about the next entry point.
Drawback is to always waste some time in the empty mainloop.
On the other hand, if you let your threads execute until the next int
happens then you would waste no time but you will need to store your exit
point for the next entry.
But i think you will have no good chance to do that because the next int
pop you off your actual task without any warning.
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.
More... (looser matching)
- Last day of these posts
- In 2001
, 2002 only
- New search...