Pumpkin, Inc.

Pumpkin User Forums

Salvo stop working on adding 7th task?

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®).

Salvo stop working on adding 7th task?

Postby kamyip » Thu Dec 18, 2003 8:09 am

hi aek,

This is what I've done:
1) took out all binsem and eflag events
2) put all task to same priority 10.

The program still stuck when the 7th task was added.

I put break at the any of the task at the point before it goes into the for(; loop, but the strangely it did not even get there?

Please advise how do I check the all the tasks has been created successfully.

Over 2 u.

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

Re: Salvo stop working on adding 7th task?

Postby aek » Thu Dec 18, 2003 8:35 am

It should work fine with 7 tasks (and more ...).

Please check:

1) Return code from your calls to OSCreateTask -- should be OSNOERR.

2) Your definition of the event flag control block (efcb) for your third event. See OSCreateEFlag() example in Salvo User Manual for the proper way to create an eFlag. You need to use OSEFCBP()

I suspect what is happening is that your tcbArea is overlapping your efcbArea -- this will definitely cause problems. Proper creating and declaration of the eFlag will fix that ...

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

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

Re: Salvo stop working on adding 7th task?

Postby kamyip » Thu Dec 18, 2003 12:00 pm

Hi,

I'm using Salvo LE + MPLAB 6.4 + C18 to do some simple led switching and event signalling.
Everything works well until I add in the 7th tasks. The program seems to hang. I've no idea what's the problem. Pls help.

My source code:
///salvocfg.h #define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_GLOBALS OSF
#define OSLIBRARY_CONFIG OSA
#define OSEVENTS 3
#define OSEVENT_FLAGS 1
#define OSMESSAGE_QUEUES 0
#define OSTASKS 7

// salvoTaskRoutine.c
#define TASK_COUNT_P OSTCBP(1)
#define TASK_LEDALARM_P OSTCBP(2)
#define TASK_LEDAUTO_P OSTCBP(3)
#define TASK_LEDEVENT_P OSTCBP(4)
#define TASK_BEEP_P OSTCBP(5)
#define TASK_PB_P OSTCBP(6)
#define TASK_LCDLITE_P OSTCBP(7) //problem!
//Defination of all task priorities here
#define PRIO_COUNT 10
#define PRIO_LEDALARM 10
#define PRIO_LEDAUTO 2
#define PRIO_LEDEVENT 2
#define PRIO_BEEP 5
#define PRIO_PB 10
#define PRIO_LCDLITE 2
//Defination of all events here
#define BINSEM_UPDATE_PORT_P OSECBP(1)
#define BINSEM_UPDATE_BEEP OSECBP(2)
#define EFLAG_KEYS_P OSECBP(3)
//Defination of all task label here
_OSLabel(TaskCount1)
_OSLabel(TaskLedAlarm1)
_OSLabel(TaskLedAuto1)
_OSLabel(TaskLedEvent1)
_OSLabel(TaskLedEvent2)
_OSLabel(TaskBeep1)
_OSLabel(TaskBeep2)
_OSLabel(TaskBeep3)
_OSLabel(TaskPB1)
_OSLabel(TaskLcdLite1)
//Defination of all OSCreate here
#define OSCreateInit();
OSCreateTask(TaskCount,TASK_COUNT_P,PRIO_COUNT);
OSCreateTask(TaskLedAlarm, TASK_LEDALARM_P, PRIO_LEDALARM);
OSCreateTask(TaskLedAuto, TASK_LEDAUTO_P, PRIO_LEDAUTO);
OSCreateTask(TaskLedEvent, TASK_LEDEVENT_P, PRIO_LEDEVENT);
OSCreateTask(TaskBeep, TASK_BEEP_P, PRIO_BEEP);
OSCreateTask(TaskPB, TASK_PB_P, PRIO_PB);
OSCreateTask(TaskLcdLite, TASK_LCDLITE_P, PRIO_LCDLITE);
OSCreateBinSem(BINSEM_UPDATE_PORT_P, 0);
OSCreateBinSem(BINSEM_UPDATE_BEEP, 0);
OSCreateEFlag(EFLAG_KEYS_P,&eFlagKeys,0x00);
//global variables
OSgltypeEfcb eFlagKeys;

//Defination of all task routines here
void TaskCount( void )
void TaskLedAlarm( void )
void TaskLedAuto( void )
void TaskLedEvent( void )
void TaskBeep( void )
void TaskPB( void )
void TaskLcdLite( void )
{
for (;
OS_Yield(TaskLcdLite1);
}
//Main program
#include "p18f458.h
#include "mymain.h"
#include "salvo.h"
#include "salvoTaskRoutine.c"
void main( void )
{
InitHardware();
OSInit();
OSCreateInit();
OSEi();
for (;
OSSched();
}

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

Re: Salvo stop working on adding 7th task?

Postby aek » Fri Dec 19, 2003 7:27 am

Hello.
quote:
Please advise how do I check the all the tasks has been created successfully.
OSCreatTask() returns an error code -- just compare it to OSNOERR.

Also, you can usually look at the structures of the tasks within MPLAB -- watch OStcbArea[0], OStcbArea[1], etc. Task 7 will be in OStcbArea[6].

If you still can't get it to work, .zip up the whole project and send it to support.

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

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

Re: Salvo stop working on adding 7th task?

Postby aek » Sat Dec 20, 2003 2:35 am

You seem to be doing everything correctly .. so I don't know what the problem could be.

Zip it up and sent it in ... I don;t think it's C18 or MPLAB ...

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

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

Re: Salvo stop working on adding 7th task?

Postby kamyip » Sat Dec 20, 2003 5:01 am

Hi again,

One last try before I send my zip program to technical support.
I've check thru the watch window on OStcbArea and suprisingly there is only 6 task display ie [0],[1]..[5], eventhough there are 7 OSCreateTask that return OSNOERR.

In the salvocfg.h I've #define OSTASK 7, so I should see 7 tcb but didn't. ps. the salvocfg.h file is on the same directory as my main.c.

Could this be some problem with my configuration or worse something wrong with the C18 compiler +MPLab IDE6.4??

1 last try...........

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

Re: Salvo stop working on adding 7th task?

Postby aek » Mon Dec 22, 2003 10:30 am

Hello.

I sent you a private email with the MPLAB v6.4 project that I built from your source code -- everything works fine. At this point, I'm not sure why you were having the problem ...

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

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


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron