nsatyish
Newbie level 4
i have problem with multitasking operation.my program is compiled successfully.but only one task is continuously running(task 3 only).my program is this
#include "p18f26j50.h"
#include ".\Source\include\FreeRTOS.h"
#include ".\Source\include\task.h"
#include "delays.h"
#pragma config WDTEN = OFF //WDT disabled (enabled by SWDTEN bit)#elif defined(PIC18F26J50_PIM) || defined(PIC18F_STARTER_KIT_1) || defined(PIC18F47J53_PIM)
// defined(PIC18F26J50_PIM) || defined(PIC18F_STARTER_KIT_1) || defined(PIC18F47J53_PIM)
#pragma config PLLDIV = 1 //Divide by 3 (12 MHz oscillator input)
#pragma config STVREN = ON //stack overflow/underflow reset enabled
#pragma config XINST = OFF //Extended instruction set disabled
#pragma config CPUDIV = OSC1 //No CPU system clock divide
#pragma config CP0 = ON //Program memory is not code-protected
#pragma config OSC = HSPLL //HS oscillator, PLL enabled, HSPLL used by USB
#pragma config T1DIG = OFF //Sec Osc clock source may not be selected, unless T1OSCEN = 1
#pragma config LPT1OSC = OFF //high power Timer1 mode
#pragma config FCMEN = OFF //Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF //Two-Speed Start-up disabled
#pragma config WDTPS = 32768 //1:32768
#pragma config DSWDTOSC = INTOSCREF //DSWDT uses INTOSC/INTRC as clock
#pragma config RTCOSC = T1OSCREF //RTCC uses T1OSC/T1CKI as clock
#pragma config DSBOREN = OFF //Zero-Power BOR disabled in Deep Sleep
#pragma config DSWDTEN = OFF //Disabled
#pragma config DSWDTPS = 8192 //1:8,192 (8.5 seconds)
#pragma config IOL1WAY = OFF //IOLOCK bit can be set and cleared
#pragma config MSSP7B_EN = MSK7 //7 Bit address masking
#pragma config WPFP = PAGE_1 //Write Protect Program Flash Page 0
#pragma config WPEND = PAGE_0 //Start protection at page 0
#pragma config WPCFG = OFF //Write/Erase last page protect Disabled
#pragma config WPDIS = OFF //WPFP[5:0], WPEND, and WPCFG bits ignored
void vLed1( void *pvParameters );
void vLed2( void *pvParameters );
void vLed3( void *pvParameters );
void main(void)
{
TRISA=0;
xTaskCreate(vLed1,"Led 1", 250, NULL, 1, NULL );
xTaskCreate(vLed2,"Led 2", 250, NULL, 1, NULL );
xTaskCreate(vLed3,"Led 3", 250, NULL, 1, NULL );
vTaskStartScheduler();
for(;;
}
void vLed1( void *pvParameters )
{
for(;
{
PORTAbits.RA0=1;
Delay10KTCYx(250);
PORTAbits.RA0=0;
Delay10KTCYx(250);
}
}
void vLed2( void *pvParameters )
{
for(;
{
PORTAbits.RA1=1;
Delay10KTCYx(500);
PORTAbits.RA1=0;
Delay10KTCYx(500);
}
}
void vLed3( void *pvParameters )
{
for(;
{
PORTAbits.RA2=1;
Delay10KTCYx(100);
PORTAbits.RA2=0;
Delay10KTCYx(100);
}
}
anyone help me to find out the problem and please tell me how to rectify it.this is the first time i am using freeRTOS.thanks in advance
sathish.N
#include "p18f26j50.h"
#include ".\Source\include\FreeRTOS.h"
#include ".\Source\include\task.h"
#include "delays.h"
#pragma config WDTEN = OFF //WDT disabled (enabled by SWDTEN bit)#elif defined(PIC18F26J50_PIM) || defined(PIC18F_STARTER_KIT_1) || defined(PIC18F47J53_PIM)
// defined(PIC18F26J50_PIM) || defined(PIC18F_STARTER_KIT_1) || defined(PIC18F47J53_PIM)
#pragma config PLLDIV = 1 //Divide by 3 (12 MHz oscillator input)
#pragma config STVREN = ON //stack overflow/underflow reset enabled
#pragma config XINST = OFF //Extended instruction set disabled
#pragma config CPUDIV = OSC1 //No CPU system clock divide
#pragma config CP0 = ON //Program memory is not code-protected
#pragma config OSC = HSPLL //HS oscillator, PLL enabled, HSPLL used by USB
#pragma config T1DIG = OFF //Sec Osc clock source may not be selected, unless T1OSCEN = 1
#pragma config LPT1OSC = OFF //high power Timer1 mode
#pragma config FCMEN = OFF //Fail-Safe Clock Monitor disabled
#pragma config IESO = OFF //Two-Speed Start-up disabled
#pragma config WDTPS = 32768 //1:32768
#pragma config DSWDTOSC = INTOSCREF //DSWDT uses INTOSC/INTRC as clock
#pragma config RTCOSC = T1OSCREF //RTCC uses T1OSC/T1CKI as clock
#pragma config DSBOREN = OFF //Zero-Power BOR disabled in Deep Sleep
#pragma config DSWDTEN = OFF //Disabled
#pragma config DSWDTPS = 8192 //1:8,192 (8.5 seconds)
#pragma config IOL1WAY = OFF //IOLOCK bit can be set and cleared
#pragma config MSSP7B_EN = MSK7 //7 Bit address masking
#pragma config WPFP = PAGE_1 //Write Protect Program Flash Page 0
#pragma config WPEND = PAGE_0 //Start protection at page 0
#pragma config WPCFG = OFF //Write/Erase last page protect Disabled
#pragma config WPDIS = OFF //WPFP[5:0], WPEND, and WPCFG bits ignored
void vLed1( void *pvParameters );
void vLed2( void *pvParameters );
void vLed3( void *pvParameters );
void main(void)
{
TRISA=0;
xTaskCreate(vLed1,"Led 1", 250, NULL, 1, NULL );
xTaskCreate(vLed2,"Led 2", 250, NULL, 1, NULL );
xTaskCreate(vLed3,"Led 3", 250, NULL, 1, NULL );
vTaskStartScheduler();
for(;;
}
void vLed1( void *pvParameters )
{
for(;
{
PORTAbits.RA0=1;
Delay10KTCYx(250);
PORTAbits.RA0=0;
Delay10KTCYx(250);
}
}
void vLed2( void *pvParameters )
{
for(;
{
PORTAbits.RA1=1;
Delay10KTCYx(500);
PORTAbits.RA1=0;
Delay10KTCYx(500);
}
}
void vLed3( void *pvParameters )
{
for(;
{
PORTAbits.RA2=1;
Delay10KTCYx(100);
PORTAbits.RA2=0;
Delay10KTCYx(100);
}
}
anyone help me to find out the problem and please tell me how to rectify it.this is the first time i am using freeRTOS.thanks in advance
sathish.N