Page 1 of 1

OStypeMsgP problem..

PostPosted: Mon Apr 24, 2006 9:47 am
by Code_Nerd
Im not really sure how can address this problem, as I have quite a bit of code that goes with it..
I am using salvo with MPLAB on a PIC18F458..
I am getting "Syntax" Error everywhere I have OSTypeMsgP in my program..
code:
#ifndef LIGHTS_H_
#define LIGHTS_H_


void Lights()
{
TMR0IF = 0;
GIE = 1;
OStypeMsgP msgP;
static char cars, time;


That is a snippet of some code..
I have a main.c, car_count.h, Light.h, My_delay.h files in my project..

I have included the <salvo.h> in the main.c file..

I am pretty much stuck here, because everything looks good to me??

Thankyou
Code


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 2:38 am
by Code_Nerd
Here it is..
code:
#define OSUSE_LIBRARY				TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_GLOBALS OSF

#define OSEVENTS 5
#define OSEVENT_FLAGS 0
#define OSMESSAGE_QUEUES 0
#define OSTASKS 3


Thanks for your reply..


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 2:43 am
by aek
That looks OK -- what's the exact error? Post the build results.

You're using an a-library (good, it has message events enabled), OSEVENTS > 0, this doesn't involve message queues, so that looks pretty good.

Did you change the related Salvo include header? Likely not.

Hmmm .. if you still can't fix it, .zip up the project and send it to support.

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


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 2:54 am
by Code_Nerd
The build report is as follows.. Doesnt really tell you much?

Clean: Deleting intermediary and output files.
Clean: Deleted file "F:PIC C ProgramsSem2Sem2.mcs".
Clean: Done.
Executing: "C:Program FilesMCC18inmcc18.exe" -p=18F458 /i"C:Program FilesMCC18h" /i"C:Program FilesSalvoinc" "Main.c" -fo="Main.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.02 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 27
F:PIC C ProgramsSem2Main.c:38:Error: syntax error
Halting build on first failure as requested.
BUILD FAILED: Wed Apr 26 08:54:04 2006


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 2:59 am
by aek
No, it doesn't.

Can you post the main.c and identify where line 38 is?

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


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 3:02 am
by Code_Nerd
Main.c
I have amalgamated all the files into one Main file now.. Sorry for the size of it..
code:
#include <salvo.h>
#include <timers.h>
/*#include "Car_Count.h"
#include "Lights.h"
#include "My_Delay.h"*/

#define TASK_CARS_P OSTCBP(1)
#define TASK_LIGHTS_P OSTCBP(2)
#define TASK_DELAY_P OSTCBP(3)

#define cnt_msg OSECBP(1)
#define send_cnt_sem OSECBP(2)
#define car_sig_sem OSECBP(3)
#define time_delay OSECBP(4)
#define delay OSECBP(5)

#define mainR PORTCbits.RC0
#define mainY PORTCbits.RC1
#define mainG PORTCbits.RC2
#define sideR PORTCbits.RC3
#define sideY PORTCbits.RC4
#define sideG PORTCbits.RC5

#define TMR0IE INTCONbits.TMR0IE
#define TMR0IF INTCONbits.TMR0IF
#define GIE INTCONbits.GIE
#define RBPU INTCON2bits.RBPU

#pragma interrupt ISR


void Lights(void)
{
static char cars, time;
TMR0IF = 0;
GIE = 1;

Line 38 ------>OStypeMsgP msgP;

OpenTimer0(TIMER_INT_ON & TO_8BIT & TO_SOURCE_INT & TO_PS_1_1);

while(1)
{
PORTC = 0x0C; //Green on Main, Red on Side
OSDelay(1000, lights1);
time = 10; //Send messagebox asking for 10 seconds
mainG = 0;
mainY = 1;
OSDelay(300, lights6);

mainY = 0;
mainR = 1;
sideG = 1;
OSSignalMsg(cnt_msg, (OStypeMsg) &time);
OS_Yield(lights2);

OS_WaitMsg(car_val, &msgP, OSNO_TIMOUT, lights3);
cars = *(char *)msgP;

if(cars > 10)
{
time = 5;
OSSignalMsg(cnt_msg, (OStypeMsg) &time);
OS_Yield(lights4);
OS_WaitMsg(car_val, &msgP, OSNO_TIMOUT, lights5);
}
sideG = 0;
sideY = 1;
OSDelay(300, lights7);


}
}


void Cars_Count(void)
{
static unsigned char count = 0;
static unsigned char tmrcnt = 0;
static char time;
OStypeMsgP msgP;

msgP = OSTryMsg(cnt_msg);
count = 0;
if(msgP)
{
time = *(char *)msgP;
OSSignalMsg(time_delay, (OStypeMsgP) &time);
OS_Yield(car_count1);
}

while(!OSTryBinSem(delay)) //Test for Sem from Delay to signal time is up
{
if(OSTryBinSem(car_sig_sem)) //Sem from RB0 int
count++;
}

OSSignalMsg(car_val, (OStypeMsgP) &count); //MessageBox with car count in it
OS_Yield(car_count2); //Yield needed so count value is not altered.
}


void My_Delay(void)
{
OStypeMsgP msgP;
static char time;

OS_WaitMsg(time_delay, &msgP, OSNO_TIMEOUT, delay1);
time = *(char *)msgP;

OSDelay((100*time), delay2);
OSSignalBinSem(delay);
}

void main(void)
{
OSInit();
OSCreateTask(car_count, TASK_CARS_P, 1);
OSCreateTask(lights, TASK_LIGHTS_P, 1);
OSCreateTask(delay, TASK_DELAY_P, 1);

OSCreateMsg(car_val, (OStypeMsgP)0);
OSCreateMsg(time_delay, (OStypeMsgP)0);
OSCreateMsg(cnt_msg, (OStypeMsgP)0);

OSCreateBinSem(cnt_sem, 0);
OSCreateBinSem(car_sig_sem, 0);
OSCreateBinSem(delay, 0);

ADCON1 = 0x07;
TRISB = 0xFF;
TRISC = 0x00;
RBPU = 0;

while(1)
{
OSSched();
}
}

void ISR(void)
{
static char t = 98;

if((TMROIE == 1) && (TMR0IF == 1))
{
TMROIF = 0;
--t;

if(t == 0)
{
t = 98;
OSTimer();
}
}
if((INT0IE == 1)&&(INT0IF == 1)) //If RB0 ints enabled and flag is set
{
INT0IF = 0; //Clear RB0 flag
OSSignalBinSem(car_sig_sem); //Set flag variable
}
}

#pragma code IntVectorHigh = 0x08

void IntVectorHigh(void)
{
_asm
goto ISR
_endasm
}



Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 3:09 am
by aek
Many C compiler do not allow you to declare variables after where real code starts in a function.

That's what you've done in Lights().

What happens if you move the declaration up, to be before the TMR0IF = 0 line?

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


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 3:16 am
by Code_Nerd
OK so that cleared that up..

Now I have all these errors that I will need to fix up.. I can see of few problems already!

code:
Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:Program FilesMCC18inmcc18.exe" -p=18F458 /i"C:Program FilesMCC18h" /i"C:Program FilesSalvoinc" "Main.c" -fo="Main.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.02 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 27
F:PIC C ProgramsSem2Main.c:41:Error [1105] symbol 'TO_8BIT' has not been defined
F:PIC C ProgramsSem2Main.c:41:Error [1105] symbol 'TO_SOURCE_INT' has not been defined
F:PIC C ProgramsSem2Main.c:41:Error [1105] symbol 'TO_PS_1_1' has not been defined
F:PIC C ProgramsSem2Main.c:46:Error [1105] symbol 'lights1' has not been defined
F:PIC C ProgramsSem2Main.c:50:Error [1105] symbol 'lights6' has not been defined
F:PIC C ProgramsSem2Main.c:55:Error [1146] type mismatch in argument 2
F:PIC C ProgramsSem2Main.c:58:Error [1105] symbol 'car_val' has not been defined
F:PIC C ProgramsSem2Main.c:58:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:64:Error [1146] type mismatch in argument 2
F:PIC C ProgramsSem2Main.c:66:Error [1105] symbol 'car_val' has not been defined
F:PIC C ProgramsSem2Main.c:66:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:70:Error [1105] symbol 'lights7' has not been defined
F:PIC C ProgramsSem2Main.c:99:Error [1105] symbol 'car_val' has not been defined
F:PIC C ProgramsSem2Main.c:99:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:114:Error [1105] symbol 'delay2' has not been defined
F:PIC C ProgramsSem2Main.c:121:Error [1105] symbol 'car_count' has not been defined
F:PIC C ProgramsSem2Main.c:121:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:122:Error [1105] symbol 'lights' has not been defined
F:PIC C ProgramsSem2Main.c:122:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:123:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:125:Error [1105] symbol 'car_val' has not been defined
F:PIC C ProgramsSem2Main.c:125:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:129:Error [1105] symbol 'cnt_sem' has not been defined
F:PIC C ProgramsSem2Main.c:129:Warning [2054] suspicious pointer conversion
F:PIC C ProgramsSem2Main.c:148:Error [1105] symbol 'TMROIE' has not been defined
F:PIC C ProgramsSem2Main.c:150:Error [1105] symbol 'TMROIF' has not been defined
F:PIC C ProgramsSem2Main.c:150:Error [1101] lvalue required
F:PIC C ProgramsSem2Main.c:159:Error [1105] symbol 'INT0IE' has not been defined
F:PIC C ProgramsSem2Main.c:159:Error [1105] symbol 'INT0IF' has not been defined
F:PIC C ProgramsSem2Main.c:161:Error [1105] symbol 'INT0IF' has not been defined
F:PIC C ProgramsSem2Main.c:161:Error [1101] lvalue required
Halting build on first failure as requested.
BUILD FAILED: Wed Apr 26 09:14:42 2006

Thanks for your help, ill keep you posted


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 4:53 am
by Code_Nerd
Fixed you can delete this post.. Found the error while posting..

Thanks

[This message has been edited by Code_Nerd (edited April 25, 2006).]


Re: OStypeMsgP problem..

PostPosted: Tue Apr 25, 2006 8:33 am
by aek
Post your salvocfg.h ...

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