Not sure what you mean by Preemptive but if you are talking about running three or four simple tasks in a timely manner, there may be a simple way. What are you trying to do? Bill ----- Original Message ----- From: "andrew kelley" To: "Microcontroller discussion list - Public." Sent: Friday, January 20, 2006 6:25 PM Subject: [PIC]: Preemptive multitasking on p16 core > Hello all, > > Just browing around the piclist.com site a little.. According to > http://www.sxlist.com/techref/microchip/multitasking.htm pre-emptive > multitasking on a p16 core is not likely possible. > > However, I think that it should be able to be done, because, if I were > to setup an interrupt to be every X cycles, and have a state variables > for each task, in the interrupt I would be able to save the state of > status and w, and goto to the next routine. Say the tasks are 1,2,3.. > step 0: Begin running routine 1 > step 1: Interrupt routine 1, goto routine 2, > step 2: Interrupt routine 2, goto routine 3, > step 3: Interrupt routine 3, goto routine 1, > step 4: Interrupt routine 1, return to routine 3, > step 5: Interrupt routine 3, return to routine 2, > step 6: Interrupt routine 2, return to routine 1, > step 7: repeat from step 1. > > Granted, this limits the call depth, but it should work nonetheless. > The routines would receive equal amounts of time per second, but not > the same position in time.. Like this: 123 132 123 132, they are out > of sequence, for lack of a better explanation. > > -- > andrew > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist