Pumpkin, Inc.

Pumpkin User Forums

mismatch result between MPLAB SIM and real chip

If you can't make Salvo do what you want it to do, post it here.

mismatch result between MPLAB SIM and real chip

Postby aek » Fri Apr 11, 2003 6:09 am

Hi Sunny.

Have you defined MAKE_WITH_FREE_LIB in your project file?

If you are using a freeware library and that salvocfg.h you posted, you will need to define this symbol.

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

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

Re: mismatch result between MPLAB SIM and real chip

Postby aek » Fri Apr 11, 2003 6:33 am

Hi Sunny.

In your email to Pumpkin Support, you mentioned that you're using Salvo Lite. This means that you must do a library build.

Your problem is that you are using a salvocfg.h that is not "matched" to your application. Even if you did define MAKE_WITH_FREE_LIB, so that this part of the salvocfg.h was active:

code:
#define OSUSE_LIBRARY       TRUE
#if defined(MAKE_WITH_FREE_LIB)
#define OSLIBRARY_TYPE OSF
#elif defined(MAKE_WITH_STD_LIB)
#define OSLIBRARY_TYPE OSL
#endif
#define OSLIBRARY_GLOBALS OSF
#define OSLIBRARY_CONFIG OSM
#define OSLIBRARY_VARIANT OSNONE

#define OSEVENTS 0
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 1


your application could not possibly work because this is for a Salvo MPLAB-C18 library that supports only multitasking (OSLIBRARY_CONFIG=OSM).

For a library build using sfc18sft.lib, please change your salvocfg.h to have only these configuration options:

code:
#define OSUSE_LIBRARY       TRUE
#define OSLIBRARY_TYPE OSF
#define OSLIBRARY_GLOBALS OSF
#define OSLIBRARY_CONFIG OST
#define OSLIBRARY_VARIANT OSNONE

This will allow you to use all of Salvo's features, including timeouts, with up to 3 tasks and 5 events. Also, make sure that you are using MPLAB-C18's small memory model.

Chapter 8 * Libraries in the User Manual has more information on creating the right salvocfg.h for use with Salvo libraries.

Regards,

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

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

Re: mismatch result between MPLAB SIM and real chip

Postby sunny » Fri Apr 11, 2003 11:41 am

Hi,

After I complete my code verify it in MPLAB SIM, the code run as what I expected.

code:
for(;;)
{
OS_WaitSem( SAMPLE_EN_P, OSNO_TIMEOUT, TaskSampling_1 );
OS_DelayTS( 1, TaskSampling_2 );

if( !T3CONbits.TMR3ON )
{
T3CONbits.TMR3ON = 1;
LATBbits.LATB7 = 1;
}

ConvertADC();
LATBbits.LATB6 = !LATBbits.LATB6;
while( BusyADC() ); //wait for ADC
*p_data_buf = ADRESH;
p_data_buf++;
if( OSReadSem( SAMPLE_EN_P ) == 0 )
{
T3CONbits.TMR3ON = 0;
OSCreateTask( TaskUploadData, OSTCBP(3), 10 );
}
}

The TaskUploadData is created after finish 200 time of the TaskSampling.

After I download the code into the pic, the TaskSampling can only run for 100 times and then go into the idle state. I find that when I remove the OSReadSem, the TaskSampling can signal for 200 times. Do I make a mistake for using this function?

there is the cfg file

code:
/************************************************************ 
Copyright (C) 1995-2002 Pumpkin, Inc. and its
Licensor(s). Freely distributable.

$Source: C:\RCS\d\salvo\tut\tu1\syse\salvocfg.h,v $
$Author: aek $
$Revision: 3.4 $
$Date: 2002-10-06 15:31:40-07 $

Header file for tutorial programs.

************************************************************/

#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() ClrWdt()
#define OSEVENTS 5
#define OSTASKS 3
#define OSLOC_ALL

/* for delay task */
#define OSBYTES_OF_DELAYS 1
#define OSBYTES_OF_TICKS 1
#define OSENABLE_SEMAPHORES TRUE
#define OSENABLE_TIMEOUTS TRUE

#define OSENABLE_EVENT_READING TRUE

#define OSENABLE_IDLING_HOOK TRUE
#else

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

/* 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 */
/* for project) PICmicros with more RAM. */
#define OSEVENTS 0
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 1

#endif


Thanks

Sunny

[This message has been edited by aek (edited April 11, 2003).]

sunny
 
Posts: 7
Joined: Mon Mar 24, 2003 12:00 am
Location: hong kong


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron