jmartinosky wrote on Tuesday, April 29, 2008:
I am starting to experiment with FreeRTOS on the PIC18f87J11, and have the latest version of it as well as the Microchip tools. I am running into a strange problem where data sent to vTaskDelay doesn’t work. I thought I’d write a little LED flasher, but I can’t get the delay to work. I have tried passing a variable, defined in the task, as well as directly passing a value. When I debug into the vTaskDelay function, the passed parameter is always 0.
Ideas?
void vLED_task(void *pvParameters);
void main(void)
{
port_init();
PORTCbits.RC2 = 1;
xTaskCreate(vLED_task, "LED", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL);
vTaskStartScheduler();
}
void vLED_task()
{
portTickType xDelayTime = 500;
while(1)
{
PORTCbits.RC2 = ~PORTCbits.RC2;
vTaskDelay(10/*xDelayTime*/);
PORTCbits.RC2 = ~PORTCbits.RC2;
}
}
I first thought it might be a problem with bank addressing, so I spent a lot of time single-stepping through the assembly code. I understand what the processor is doing, now, but that didn’t help me with the problem. I’ve looked at the post from John Franklin, and implemented it, as well, but to no avail.
Thanks