Page 1 of 1

PIC18 and labels

PostPosted: Thu Feb 13, 2003 2:19 am
by luben
Hello,

When talking about PIC18 uP there is no sense to use labels in all OS_XXX services - the address could be fetched from the stack. Of course, to keep the style of PIC16 services the user could write some sensless label, that don't cares.

Regards
Luben


Re: PIC18 and labels

PostPosted: Thu Feb 13, 2003 9:24 am
by aek
Hi Luben.

Keep in mind that the label-based approach is faster than anything you can do with the PIC18's stack registers. So while it is a bother, it also gives the best performance.

In fact, Salvo's fastest context switches are with the label-based approach of PICC and PICC-18. Of course this also has a lot to do with the static overlay model used for parameters and local variables ...

------------------


Re: PIC18 and labels

PostPosted: Thu Feb 13, 2003 9:25 am
by luben
quote:
since each non-running task needs to have its last PC stored on the stack.

I think that it's not necessary to hold data in the stack - when returning the control to the kernel the program will read the current address and hold it in some variable. After that, when returning the control to the task the kernel fetches the address from this variable, add some value and jumps to this address.

Regards
Luben


Re: PIC18 and labels

PostPosted: Thu Feb 13, 2003 9:27 am
by jtemples
It seems that using the PIC's stack would impose an upper limit on the number of tasks that could exist in an application, since each non-running task needs to have its last PC stored on the stack.