Pumpkin, Inc.

Pumpkin User Forums

PC and Methods

If you have a general question or comment regarding Salvo, post it here.

PC and Methods

Postby brodie677 » Thu Apr 02, 2009 8:25 am

Hi,

I'm still trying to get a feel for how Salvo works, and have a few questions regarding how the stack is manipulated. If the following code were to run on an 8 bit PIC other than the PIC18, how does the PC value get saved so that after TaskA executes the call OS_Yield(), it returns to the next intruction which is a call to another method myFunction(). I'm just really curious as to how the PC value is saved with those models of the PIC's. Also another question that stemmed from this situation, will the call to myFuction() end in a disaster? Also would code like this be supported with the PIC24 devices and the C30 compiler?

void myFunction(void)
{
OS_Yield();
}

void TaskA( void )
{
while (1)
{
OS_Yield();
myFunction();
}
}

brodie677
 
Posts: 1
Joined: Wed Apr 01, 2009 11:00 pm

Re: PC and Methods

Postby aek » Thu Apr 02, 2009 9:03 am

Salvo's internals are laid bare at the assembly level -- all you have to do is build a project, and trace through the assembly (e.g. in MPLAB's sim) to see how it's done.

Salvo application code is _identical_ for every target supported. So what works for PIC18 also works for PIC24, PIC32, MSP430, ARM7, ... at the user level, in C. Underneath, of course, the code can be quite different.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: PC and Methods

Postby Phil W » Sun Apr 05, 2009 5:11 am

Besides, what you are trying to do in salvo is illegal. You cannot perform a context switching action in a function called from a task. You must be at task level before doing so.

PhilW

Phil W
 
Posts: 36
Joined: Tue Jan 14, 2003 12:00 am
Location: penrith nsw australia


Return to General

Who is online

Users browsing this forum: No registered users and 2 guests

cron