Pumpkin, Inc.

Pumpkin User Forums

problem with tutorials with Slavo Lite

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

problem with tutorials with Slavo Lite

Postby kamyip » Thu Oct 09, 2003 8:45 am

I'm using MPLAB C18 with MPLAB IDE V6.x. and is new to Salvo.
Have been trying out tutorials in Capter 4 of Salvo user manual.
1)
I'm having problem with getting semaphores event running as per page 68 &69. The TaskShow()'s OS_WaitSem(SEM_UPDATE_PORT_P,OSNO_TIMEOUT,TaskShowl) does not seems to do anything eventhough semaphores has been signal????
kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: problem with tutorials with Slavo Lite

Postby aek » Mon Oct 13, 2003 2:53 am

Hello.

Are you writing your own application following the tutorials, or are you using the one in salvo ut u4syse?

What is your testing environment? Simulator? MPLAB-ICE2000? ICD2?

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

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

Re: problem with tutorials with Slavo Lite

Postby kamyip » Mon Oct 13, 2003 4:59 am

quote:
Originally posted by aek:
Hello.

Are you writing your own application following the tutorials, or are you using the one in salvo ut u4syse?

What is your testing environment? Simulator? MPLAB-ICE2000? ICD2?


kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: problem with tutorials with Slavo Lite

Postby kamyip » Mon Oct 13, 2003 5:19 am

quote:
Originally posted by kamyip:

I'm using the exact source code from tut4.
On MPLAB 6.3 i've tried the code both on Sim as well as ICD2. Pls find below my salvo config file:

#if !defined (MAKE_WITH_FREE_LIB) && !defined (MAKE_WITH_STD_LIB)

/* */
/* configuration options for project that's made using the */
/* source files. */
/* */
#define OSCLEAR_WATCHDOG_TIMER() asm(" clrwdt")
#define OSENABLE_IDLING_HOOK TRUE
#define OSENABLE_SEMAPHORES TRUE
#define OSEVENTS 1
#define OSTASKS 2
#define OSLOC_ALL bank1

#else

/* */
/* configuration options for projects that are made using */
/* either the freeware or standard libraries. Multitasking */
/* with events only, events services called only from */
/* background. */
/* */
#define OSUSE_LIBRARY TRUE
#if defined(MAKE_WITH_FREE_LIB)
#define OSLIBRARY_TYPE OSF
#define OSLIBRARY_GLOBALS OSF
#elif defined(MAKE_WITH_STD_LIB)
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_GLOBALS OSL
#endif
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB

/* these were added for v2.3.0 to minimize RAM requirements */
/* so that the application could fit on the 16F84. They */
/* aren't needed (and mem.c need not be a node in the */
/* project) for PICmicros with more RAM. */
#define OSEVENTS 1
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 3


#endif


AND THE MAIN.C file:
//project set for P18c452
#include "main.h" //as per salvo tut file

#include <salvo.h>
#include <mem.c>
#define TASK_COUNT_P OSTCBP(1) /* task #1 */
#define TASK_SHOW_P OSTCBP(2) /* task #2 */
#define PRIO_COUNT 10 /* task priorities*/
#define PRIO_SHOW 10 /* "" */
#define SEM_UPDATE_PORT_P OSECBP(1) /* semaphore #1 */

_OSLabel(TaskCount1)
_OSLabel(TaskShow1)

unsigned int counter;

void TaskCount( void )
{
for (; {
counter++;

if ( !(counter & 0x01FF) )
OSSignalSem(SEM_UPDATE_PORT_P);

OS_Yield(TaskCount1);
}
}

void TaskShow( void )
{
InitPORT();
PORT = 0x00;

for (; {
OS_WaitSem(SEM_UPDATE_PORT_P, OSNO_TIMEOUT, TaskShow1);

PORT &= ~0xFE;
PORT |= ( counter >> 8 ) & 0xFE;
}
}

void main( void )
{
Init();

OSInit();

OSCreateTask(TaskCount, TASK_COUNT_P, PRIO_COUNT);
OSCreateTask(TaskShow, TASK_SHOW_P, PRIO_SHOW);

OSCreateSem(SEM_UPDATE_PORT_P, 0);

counter = 0;

for (;
OSSched();
}

/* Things below this line are only required */
/* because we're using the same salvocfg.h */
/* for all the different versions (source, */
/* freeware library, standard library) of the */
/* tutorial programs. Normally, this stuff */
/* would not be required. */
/* OSIdlingHook() is required by all */
/* libraries other than multitasking-only. */
/* */
void OSIdlingHook( void )
{
;
}

OBSERVATION:
1)SEM_UPDATE_PORT_P was set to 0x02 on OSSignalSem
2)OS_WaitSem does not seem to decrement this value.It just goes back to the kernel without updating the port

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: problem with tutorials with Slavo Lite

Postby aek » Tue Oct 14, 2003 7:35 am

Hello.
quote:
void OSIdlingHook( void )
{
;
}

OBSERVATION:
1)SEM_UPDATE_PORT_P was set to 0x02 on OSSignalSem
2)OS_WaitSem does not seem to decrement this value.It just goes back to the kernel without updating the port


1. Make sure you have the latest version of Salvo -- v3.2.2-a does not include OSIdlingHook() in salvo ut uNmain.c because it's already in the libraries ...

2. Running salvo ut u4syse u4lite.mcp in MPLAB v6.30 and the MPLAB Simulator, watching PORTB shows that it is gradually incrementing (as it should). This can only happen if OS_WaitBinSem() is succeeding.

3. Ah, you said that SEM_UPDATE_PORT_P was 0x02. But the current version of the tutorials uses binSems (i.e. BINSEM_UPDATE_PORT_P), not semaphores.

So, it's possible that there's some problem between the version of Salvo that you have, and MPLAB v6.30. Only Salvo 3.2.2 and later properly supports MPLAB v6.30.

Also, note that all of Salvo's context switches (e.g. OS_Yield(), OS_WaitXyz(), etc.) are unconditional context switches, i.e. a task will always return to the scheduler in a Salvo context switch, regardless of the value of the event being tested (if applicable). This guarantees that the highest-priority eligible task will run after any context switch. If the event was available, AND the task was the highest-priority eligible event, then that task will be the one that the scheduler dispatches next. Otherwise another, higher-priority task will run. Therefore it is a little difficult to follow the context-switching mechanism, especially at the C level.

Please upgrade to Salvo Lite v3.2.2-a, and with MPLAB v6.30 or higher (we haven't tested higher than v6.30, but it should be OK) you should be able to observe the correct behavior.

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

[This message has been edited by aek (edited October 14, 2003).]

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

Re: problem with tutorials with Slavo Lite

Postby kamyip » Wed Oct 15, 2003 12:18 am

Thanks, I guessed it must have been the wrong version, strange though because this version came package with my MPLAB C18 CD.I'll download a newer version and try it out.

quote:
Originally posted by aek:
Hello. 1. Make sure you have the latest version of Salvo -- v3.2.2-a does not include OSIdlingHook() in salvo ut uNmain.c because it's already in the libraries ...

2. Running salvo ut u4syse u4lite.mcp in MPLAB v6.30 and the MPLAB Simulator, watching PORTB shows that it is gradually incrementing (as it should). This can only happen if OS_WaitBinSem() is succeeding.

3. Ah, you said that SEM_UPDATE_PORT_P was 0x02. But the current version of the tutorials uses binSems (i.e. BINSEM_UPDATE_PORT_P), not semaphores.

So, it's possible that there's some problem between the version of Salvo that you have, and MPLAB v6.30. Only Salvo 3.2.2 and later properly supports MPLAB v6.30.

Also, note that all of Salvo's context switches (e.g. OS_Yield(), OS_WaitXyz(), etc.) are [b]unconditional context switches, i.e. a task will always return to the scheduler in a Salvo context switch, regardless of the value of the event being tested (if applicable). This guarantees that the highest-priority eligible task will run after any context switch. If the event was available, AND the task was the highest-priority eligible event, then that task will be the one that the scheduler dispatches next. Otherwise another, higher-priority task will run. Therefore it is a little difficult to follow the context-switching mechanism, especially at the C level.

Please upgrade to Salvo Lite v3.2.2-a, and with MPLAB v6.30 or higher (we haven't tested higher than v6.30, but it should be OK) you should be able to observe the correct behavior.

[/B]


kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: problem with tutorials with Slavo Lite

Postby kamyip » Wed Oct 15, 2003 5:33 am

OK, it is working now. Thanks for the support.

quote:
Originally posted by kamyip:
Thanks, I guessed it must have been the wrong version, strange though because this version came package with my MPLAB C18 CD.I'll download a newer version and try it out.


kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: problem with tutorials with Slavo Lite

Postby aek » Thu Oct 16, 2003 2:16 am

You're welcome.

Salvo v3.2.2-a will be on the next MPLAB IDE CD-ROM from Microchip.

Of course, by then we'll probably release v3.3. Oh, well!

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

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

Re: problem with tutorials with Slavo Lite

Postby kamyip » Thu Oct 16, 2003 5:41 am

Slavo RTOS is a great product. I never knew what I've missed on before this. I think I'll be getting the Salvo LE soon. Thakns for the prompt support.

Kam

quote:
Originally posted by aek:
You're welcome.

Salvo v3.2.2-a will be on the next MPLAB IDE CD-ROM from Microchip.

Of course, by then we'll probably release v3.3. Oh, well!


kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 3 guests

cron