Pumpkin, Inc.

Pumpkin User Forums

Pic18 + C18 + OSDelay (major trouble)

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

Re: Pic18 + C18 + OSDelay (major trouble)

Postby aek » Wed Dec 08, 2010 1:01 pm

All of these questions are covered quite extensively in the manual and in the particular compiler reference manual ...
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby Daani4all » Thu Jan 13, 2011 9:50 am

I have read it all over and over, still I can't get it to work? Am I picking the wrong files added to my project or what? this is really annyoing since I follow a guide in my book "Designing Embedded Systems With PIC Microcontrollers" there is a complete chapter with a very precise guide. Even though I install salvo, add the files the book says I get this error?

There are several folders with same filenames right? the reference doesnt tell me wich one to use? I need the basic features like Delays?
The book says that I must add the mem.c file to my project too? is that really necessery?

I now have the lib file and the linker script


Please someone help me out :/
Daani4all
 
Posts: 14
Joined: Wed Dec 01, 2010 4:29 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby Daani4all » Thu Jan 13, 2011 10:25 am

Okay, I now "understood" that it is sfc18lfa.lib I should add to my project, So I did. I also added 18f8722_g.lkr to linker script. I set the directories library search path and linker script search path to salvo and mcc18 folder. I added mem.c and salvocfg (from syse) Im using C18 compiler.

In the code:


Code: Select all
#pragma config OSC = INTIO67, FCMEN = OFF, IESO = OFF, PWRT = OFF, BOREN = SBORDIS, BORV = 3, WDT = OFF
#pragma config WDTPS = 32768, MODE = MC, ADDRBW = ADDR20BIT, DATABW = DATA16BIT, WAIT = OFF, CCP2MX = PORTC
#pragma config ECCPMX = PORTE, LPT1OSC = OFF, MCLRE = ON, STVREN = ON, LVP = OFF, BBSIZ = BB2K, XINST = OFF

#include <salvo.h>
#include "salvocfg.h"
#undef OSC
#include <p18f8722.h>
#include <stdio.h>
#include "portmap.h"

void Count_Task( void );


_OSLabel(Count_Task1)
_OSLabel(Display_Task1)
_OSLabel(delay1)
_OSLabel(delay2)

void main( void )
{


      Init();
      OSInit();

      OSCreateTask(Count_Task, OSTCBP(1), 10);

      while(1)
      {
         
         OSSched();      
      }
}

void Count_Task( void )
{
   

   while(1)
   {
      LED1status = 1;

      OSDelay(2, delay1);

      LED1status = 0;

      OSDelay(6, delay2);

      OS_Yield(Count_Task1);
   }
}



error:

Debug build of project `D:\Tekniska H
Daani4all
 
Posts: 14
Joined: Wed Dec 01, 2010 4:29 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby aek » Thu Jan 13, 2011 12:36 pm

OS_Delay(), not OSDelay().
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby Daani4all » Thu Jan 13, 2011 12:40 pm

I have tried with both, Im getting a lot of different errors all the time. It's really confusing. Have nowhere to turn for help other than here. Really glad for your quick response

I just created a new project (once again for the millionth time)
added all the files, linked, set the library search path, linker search path

included salvo.h

and got this error:

MPLINK 4.37, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Error - could not find definition of symbol 'OSdelayQP' in file 'init.o'.
Errors : 1


and when I dont get that error i get this one:


MPLINK 4.37, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Error - symbol 'OScTcbP' has multiple definitions.
Errors : 1

I dont know if this has something to do with it but when I try to compile the lib file only it says

C:\salvo\lib\mcc18\sfc18lfa.lib:1:Error: syntax error
Daani4all
 
Posts: 14
Joined: Wed Dec 01, 2010 4:29 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby aek » Thu Jan 13, 2011 1:09 pm

1. Please post your salvocfg.h.

2. Have you added Salvo's mem.c to your project?
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby Daani4all » Thu Jan 13, 2011 1:15 pm

mem.c is added and included

salvocfg.h:


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

$Source: C:\\RCS\\d\\salvo\\tut\\tu3\\syse\\salvocfg.h,v $
$Author: aek $
$Revision: 3.6 $
$Date: 2003-07-30 17:31:30-07 $

Header file for tutorial programs.

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

#if   defined(MAKE_WITH_FREE_LIB)
/*                                                          */
/*  Salvo Lite build                                        */
/*                                                          */
#define OSUSE_LIBRARY            TRUE
#define OSLIBRARY_TYPE            OSF
#define OSLIBRARY_GLOBALS          OSF
#define OSLIBRARY_CONFIG          OSM
#define OSEVENTS                    0  /* multitasking only */
#define OSEVENT_FLAGS               0
#define OSMESSAGE_QUEUES            0
#define OSTASKS                     2


#elif defined(MAKE_WITH_STD_LIB)
/*                                                          */
/*  Salvo LE & Pro library build                            */
/*                                                          */
#define OSUSE_LIBRARY            TRUE
#define OSLIBRARY_TYPE            OSL
#define OSLIBRARY_GLOBALS          OSF
#define OSLIBRARY_CONFIG          OSM
#define OSEVENTS                    0  /* multitasking only */
#define OSEVENT_FLAGS               0
#define OSMESSAGE_QUEUES            0
#define OSTASKS                     2


#elif defined(MAKE_WITH_SOURCE)
/*                                                          */
/*  Salvo Pro source-code build                             */
/*                                                          */
#define OSEVENTS               0  /* multitasking only */
#define OSTASKS                       2


#else

#error No MAKE_WITH_??? symbol defined. See salvocfg.h.

#endif

#if !defined(SYSE)

#error SYSE must be defined for this MPLAB-C18 tutorial project ...

#endif
Daani4all
 
Posts: 14
Joined: Wed Dec 01, 2010 4:29 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby aek » Thu Jan 13, 2011 1:43 pm

That's not your salvocfg.h --- that's Pumpkin's.

Please create your _own_ salvocfg.h, from scratch, and build with it. You are using features of that file that you do not understand / are not controlling properly.

E.g. your salvocfg.h ought to be ONLY:

Code: Select all
#define OSUSE_LIBRARY            TRUE
#define OSLIBRARY_TYPE            OSF
#define OSLIBRARY_GLOBALS          OSF
#define OSLIBRARY_CONFIG          OSA // e.g. for sfc18sfa.lib
#define OSEVENTS                    1
#define OSEVENT_FLAGS               0
#define OSMESSAGE_QUEUES            0
#define OSTASKS                     2


Note that for this salvocfg.h, you need to link to sfc18sfa.lib .
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby Daani4all » Thu Jan 13, 2011 1:49 pm

anyways I changed the salvocfg and got this error:

MPLINK 4.37, Linker
Copyright (c) 1998-2010 Microchip Technology Inc.
Error - symbol 'OScTcbP' has multiple definitions.
Errors : 1

it must have somethind to do with the mem.c file, when I take it away the build is succeded

the salvocfg is right now:

#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_GLOBALS OSF
#define OSLIBRARY_CONFIG OSA
#define OSEVENTS 3
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 2

I have a presentation of salvo in 9 days for the entire program including a couple of companies haha, what a failure for me when I cant get it to work :S
Daani4all
 
Posts: 14
Joined: Wed Dec 01, 2010 4:29 pm

Re: Pic18 + C18 + OSDelay (major trouble)

Postby aek » Thu Jan 13, 2011 2:34 pm

The User manual for Salvo + MPLAB C18: http://www.pumpkininc.com/content/doc/m ... -mcc18.pdf .

Are you building successfully now?

It doesn't help me when you post just the error -- I _always_ need to see the entire build results.
-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

PreviousNext

Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 3 guests

cron