Pumpkin, Inc.

Pumpkin User Forums

Configure for other Pics

If you're having difficulty with Salvo's configuration options, post it here.

Configure for other Pics

Postby Salvo Tech Support » Tue Aug 14, 2001 1:50 am

Hi, and welcome to the Forums.

If you want to compile an existing project that's part of the Salvo distribution (e.g. any of the projects in salvo utorial u1-tu6), and you're using a PICmicro that's different from the one that the project was compiled for (e.g. the sysa projects are all for the 16C77, 16F877 and similar PICmicros), then here's what you do:

1) In MPLAB under Edit Project, delete the node that is the library used (e.g. sfp42Cm-.lib in tu1free.pjt) by selecting the library and choosing Delete Node.

2) In Chapter 8 * Libraries of the User Manual, look up the alphanumeric code for the processor you're using. E.g. if it's a 16F84, the code is 40A.

3) Add a library node back into the project, matching all the type, configuration and variant codes of the one you removed, but with the correct processor code. E.g. for the 16F84, you'll want sfp40Am-.lib. In the Add Node window you'll have to change the "List files of type" field to "Libraries (*.lib)", and you'll have to navigate / browse to the salvolibrary directory.

4) Change processor types under Development Mode in the Edit Project window, and recompile. If the target processor has enough ROM and RAM to run the application, then you should have a successful compile.

The important things to know are 1) the library has to match the processor type, as well as the configuration and variant expected by the project (the configuration and variant "codes" can be seen in the project's salvocfg.h file), and 2) you also have to change the Development Mode in MPLAB to match the processor you have.

This example shows how to recompile existing freeware projects (e.g. tu1free.pjt). Projects that use the standard libraries will use the slp*.lib libraries instead of the sfp*.lib libraries. Projects compiled with the source code (available only with the full version of Salvo) generally require only that you change the processor type in the Edit Project window.

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited August 14, 2001).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: Configure for other Pics

Postby srhoar » Tue Aug 14, 2001 10:12 am

I went thru your tutorials just fine. But when using MPLAB if I just change the uP to 16f84A I get all kinds of errors.

Q: What do you need to change in tut1 in order to change to a different uP?

srhoar
 
Posts: 5
Joined: Mon Aug 13, 2001 11:00 pm
Location: arlington,tx,usa

Re: Configure for other Pics

Postby aek » Wed Aug 15, 2001 9:59 am

The tutorial programs tu5-tu6 use Timer2 (TMR2) to generate a periodic interrupt and call OSTimer(). The 16F84 has no TMR2.

If you re-make one of these v2.2.0 projects for the 16F84, the compiler will complain that PR2, T2CON, TMR2IE, PEIE and TMR2IF cannot be found (because they don't exist on the 16F84). Note that all of these are used only in main.c. This means that you could change the code to use TMR0 to generate an interrupt every 10ms and delete the code that references TMR2 and its flags. This would result in a working application that runs on the 16F84.

We'll look into converting the tutorial programs tu5-tu6 to use TMR0 instead of TMR2. That way they'll work on all the PIC16 processors.

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

[This message has been edited by aek (edited August 15, 2001).]

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

Re: Configure for other Pics

Postby aek » Wed Aug 15, 2001 11:18 am

It turns out there are a few more things that you must do to get tu5 and tu6 to work with the F84. You have to follow the instructions in AN-1 and also in the libraries chapter and reduce the RAM that's allocated to Salvo. The libraries used expect 4 tasks and 5 events, but only three tasks and one event are used, and the rest of the RAM pushes the compile over the F84's available RAM.

Anyway, here's tu5main.c to work with the F84 as well as all the other PIC16 PICmicros. You can cut and paste it into tutorial u5main.c.

code:
#include <salvo.h>

#define TASK_COUNT_P OSTCBP(1) /* task #1 */
#define TASK_SHOW_P OSTCBP(2) /* "" #2 */
#define TASK_BLINK_P OSTCBP(3) /* "" #3 */
#define PRIO_COUNT 10 /* task priorities*/
#define PRIO_SHOW 10 /* "" */
#define PRIO_BLINK 2 /* "" */
#define SEM_UPDATE_PORT_P OSECBP(1) /* semaphore #1 */
#define TMR0_RELOAD 156 /* for 100Hz ints */

unsigned int counter = 0;

_OSLabel(TaskCount1)
_OSLabel(TaskShow1)
_OSLabel(TaskBlink1)

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

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

OS_Yield(TaskCount1);
}
}

void TaskShow( void )
{
for ( ; ; ) {
OS_WaitSem(SEM_UPDATE_PORT_P, TaskShow1);

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

void TaskBlink( void )
{
TRISB = 0x00;
PORTB = 0x00;

for ( ; ; ) {
PORTB ^= 0x01;

OS_Delay(50, TaskBlink1);
}
}

void main( void )
{
T0CS = 0; PSA = 0; PS2 = 1; PS1 = 0; PS0 = 1;
T0IE = 1;

OSInit();

OSCreateTask(TaskCount, TASK_COUNT_P, PRIO_COUNT);
OSCreateTask(TaskShow, TASK_SHOW_P, PRIO_SHOW);
OSCreateTask(TaskBlink, TASK_BLINK_P, PRIO_BLINK);

OSCreateSem(SEM_UPDATE_PORT_P, 0);

OSEnableInts();

for ( ; ; )
OSSched();
}

void interrupt IntVector( void )
{
if ( T0IE && T0IF ) {
T0IF = 0;
TMR0 -= TMR0_RELOAD;

OSTimer();
}
}

void OSIdleFnHook( void )
{
;
}


and here's tu5main.csysasalvocfg.h

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


#define OSBYTES_OF_DELAYS 1
#define OSCOMPILER OSHT_PICC
#define OSENABLE_SEMAPHORES TRUE
#define OSEVENTS 1
#define OSTARGET OSPIC16
#define OSTASKS 3
#define OSLOC_ALL bank1


#else


#define OSUSE_LIBRARY TRUE
#ifdef MAKE_WITH_FREE_LIB
#define OSLIBRARY_TYPE OSF
#elif defined(MAKE_WITH_STD_LIB)
#define OSLIBRARY_TYPE OSL
#endif
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB

#define OSEVENTS 1
#define OSTASKS 3


#endif


and here are the build results

code:
Linking:
Command line: "C:HT-PICBINPICC.EXE -G -INTEL -MTU5FREE.map -16F84 -oTU5FREE.HEX
-fakelocal -Isalvoinclude -Isalvosource salvo utorial u5MAIN.OBJ D:SALVOSOURCEMEM.OBJ D:SALVOLIBRARYSFP40AAB.LIB "
Enter PICC -HELP for help

Memory Usage Map:

Program ROM $0000 - $0053 $0054 ( 84) words
Program ROM $018B - $03FF $0275 ( 629) words
$02C9 ( 713) words total Program ROM

Bank 0 RAM $000C - $0019 $000E ( 14) bytes
Bank 0 RAM $003C - $0044 $0009 ( 9) bytes
$0017 ( 23) bytes total Bank 0 RAM

Bank 1 RAM $001A - $003B $0022 ( 34) bytes total Bank 1 RAM

Build completed successfully.


You'll have to delete sfp42Cab.lib from the project, use Copy Node to add mem.c as a node in the project, and add the sfp40Aab.lib library. See AN-1, Chapter 8 and the rest of this thread for more info.

To compile and run tu6 you'll need to make the same edits to change the TMR2 stuff to TMR0.

These updates tu5 and tu6 programs will be part of v2.3.

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

[This message has been edited by aek (edited August 15, 2001).]

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


Return to Configuration

Who is online

Users browsing this forum: No registered users and 1 guest

cron