Page 1 of 1

PIC18F6527 & PICC-18 PL1 & Salvo 3.2.3

PostPosted: Thu Oct 26, 2006 2:33 am
by sucovsky
Hi, i have the following problem, hope you can help.

I have the next code (simplified):

code:
#include "salvo.h"

#define TASK_CHECK OSTCBP(1)
#define PRIO_CHECK 5
#define SEMAPHORE_CHECK OSECBP(1)

#define TASK_2UART OSTCBP(2)
#define PRIO_2UART 4
#define SEMAPHORE_2UART OSECBP(2)

_OSLabel(Labelx)
_OSLabel(Labely)

void TaskCheck(void){
for (; ;){ OS_WaitBinSem(SEMAPHORE_CHECK,OSNO_TIMEOUT,Labelx);
//code
}
}

void Task2Uart(void){
for(; ;){ OS_WaitBinSem(SEMAPHORE_2UART,OSNO_TIMEOUT,Labely);
//code
}
}

void main(void){

Init_Hardware();

OSInit();

OSCreateTask(TaskCheck,TASK_CHECK,PRIO_CHECK);
OSCreateTask(Task2Uart,TASK_2UART,PRIO_2UART);

OSCreateBinSem(SEMAPHORE_CHECK,0);
OSCreateBinSem(SEMAPHORE_2UART,0);

interrupt_enable();
OSEi();

for (; ;)
OSSched();
}


salvocfg.h looks like the following

code:
#define OSUSE_LIBRARY        TRUE
#define OSLIBRARY_TYPE OSL
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSF

#define OSEVENT_FLAGS 0
#define OSEVENTS 2
#define OSMESSAGE_QUEUES 0
#define OSTASKS 2


im using library: slp87laf.lib

---------
the problem is, im using ICD2 and the code never pass from OSCreateBinSem(SEMAPHORE_2UART,0);

using mplab 7.43, i saw the program memory and the reason it never pass from there is that there are no code there..., but the instruction before that: OSCreateBinSem(SEMAPHORE_CHECK,0); has code and fuctions properly, so basically the instructions are the same, but for the second CreateBinSem doesnt generate code. i dont know if its the compiler problem or something with salvo. if I add a third Createsem, then the second functions properly but the last is the same thing it generates no code for it.

i had salvo 2.1 and didnt delete it, i just changed the folder name and thats it, i dont know if thats related to the problem, what can i do?

thank you

[This message has been edited by aek (edited October 26, 2006).]


Re: PIC18F6527 & PICC-18 PL1 & Salvo 3.2.3

PostPosted: Thu Oct 26, 2006 3:40 am
by aek
Your code looks OK.

Did you enable the "Build for ICD" checkmark in MPLAB?

What happens if you just build and run (not for ICD) in MPLAB SIM?

It's not clear whther you are running Salvo v2.1 (very old and no longer supported) or you are running something newer.

Regardless, there should be code past the first call to OSCreateBinSem().

I suspect what you are seeing is that once interrupt become enabled (just after OSCreateBinSem()) an interrupt is generated but the code gest lost because you haven't defined code at the interrupt vector.

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


Re: PIC18F6527 & PICC-18 PL1 & Salvo 3.2.3

PostPosted: Fri Oct 27, 2006 7:04 am
by sucovsky
Hi, thats exactly what happened,
its OK now running fine!,
two things fixed the problem.
1) the code of the second semaphore wasnt been generated because i didnt check the "use 24- bit pointers to program space in build options"
i checked that and the code now generates ok.

2) after fixing that i was receiving garbage in the hyperterminal from the serial port. i checked then "compile for ICD" and the problem fixed, now everything looks fine.

thank you very much.