Pumpkin, Inc.

Pumpkin User Forums

Setup

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

Re: Setup

Postby aek » Thu Nov 18, 2004 2:43 am

Hi Simon.

I'm sure you;re as frustrated as I am as to why your application doesn;t appear to be working ... but first, please clarify a few things:

1) Have you downloaded and installed the latest Salvo Lite for PICmicro(R) MCUs (v3.2.3)?

2) Have you been able to successfully build and run an example or tutorial project in the MPLAB simulator?

You should be able to build, say, tu5lite and set breakpoints on the PORT lines to verify that each task is in fact running.

Assuming you've done 1) and 2) above, I'd suggest putting a call to DelayFor18TCY() after OS_Yield() and setting your breakpoint on it.

Also, it's wise to put {}'s around the stuff you're running from the infinite for() loop in main() -- if you uncomment the call to TaskDisplay(), OSSched() will never be called.

If your app still doesn't work, we'll build it here and report back.

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

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

Re: Setup

Postby aek » Thu Nov 18, 2004 4:50 am

Since this is really a PIC-specific problem, I'm moving this thread to the PICmicro Forum.

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

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

Re: Setup

Postby simon11 » Thu Nov 18, 2004 10:10 am

I have gotten rid of the warning however it still doesn't appear that it is jumping to my task... the library i linked is sfc18lfa.lib. I set a break point at the the if statement. Here is my complete code.
code:
#include "salvo.h"
#include <portb.h>
#include <p18f4620.h>
#include <xlcd.h>
#include <delays.h>

_OSLabel(TaskDisplay1)
void button2_isr (void);
/* VARIABLES */
unsigned int ButtonPress;
unsigned char Disp;


/* ISRS */
#pragma code low_vector=0x18 //Location of Low ISRS
void interrupt_at_low_vector (void){
_asm GOTO button2_isr _endasm
}

#pragma code // Return to the default code section
#pragma interruptlow button2_isr save=PROD

void button2_isr (void){
Disp = 1; //Signals to Display
ButtonPress = PORTB / 32; //Stores Button Press
INTCON3 &= 0xFD; //Reset the Pin 2 Interrupt Flag
}

/* FUNCTIONS */
void DelayFor18TCY (void){
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
}
void DelayPORXLCD (void){
Delay1KTCYx(60); //Delay of 15ms
return;
}
void DelayXLCD (void){
Delay1KTCYx(20); //Delay of 5ms
return;
}


/* TASKS */
void TaskDisplay (void) {
for(;;){
if (Disp == 1){
WriteDataXLCD(ButtonPress); //write to LCD
Disp = 0;
}
OS_Yield(TaskDisplay1); //Yield to Scheduler
}
}
/* MAIN */
void main (void) {

//Setup Port B for Inputs
TRISB = 0xFF;

//Initialize INT2 & Set Priority of INT2 to low
INTCON3 = 0x10;
INTCON |= 0xC0;
ADCON0 &= 0xFE; //Turn A/D Converter off
ADCON1 |= 0x0F; //Set Inputs to digital inputs

//Initialize OS
OSInit();

//Creating Tasks ID Priority
OSCreateTask(TaskDisplay, OSTCBP(1), 1);


for (;;)
//TaskDisplay();
OSSched();

}


PS. Thank You for your Help so far it is greatly Appreciated

[This message has been edited by aek (edited November 18, 2004).]

simon11
 
Posts: 20
Joined: Mon Nov 08, 2004 12:00 am
Location: Worcester,MA,usa

Re: Setup

Postby aek » Thu Nov 18, 2004 11:53 am

Looks fine.

Need to see your salvocfg.h ...

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

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

Re: Setup

Postby simon11 » Thu Nov 18, 2004 12:12 pm

Here's my salvocfg.h I just went with what was in the app note.

#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSF
#define OSLIBRARY_GLOBALS OSF
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSNONE

simon11
 
Posts: 20
Joined: Mon Nov 08, 2004 12:00 am
Location: Worcester,MA,usa

Re: Setup

Postby aek » Thu Nov 18, 2004 12:29 pm

Hi Simon.

That's fine, but you should also set OSTASKS and OSEVENTS ... (they default to 3 and 5, respectively, in v3.2.x, so that's not the problem).

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

[This message has been edited by aek (edited November 18, 2004).]

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

Previous

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron