> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of Isaac Marino Bavaresco > Sent: 23 May 2009 01:03 > To: Microcontroller discussion list - Public. > Subject: Re: [EE] RTOS like this? > > > This is my proof of concept for a preemptive scheduler for PIC16 MCUs. > Not quite working, but shows the concept (in MPLB-SIM). > > Sometimes one task gets "lost", but the others keep taking rounds. I > think I will need to rewrite the scheduler (interrupt routine) in > assembly for it to work correctly. > > The context is not saved/restored correctly yet (STATUS, FSR, etc.), > only the PC. Sorry to be a bit negative, but this only works as well as it does because your tasks are so simple. You are saving the return address at just one point in your task, yet the scheduler could interrupt it anywhere. Even if you added context saving this would never work correctly with tasks that compiler to more than a couple of instructions. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist