Generic question for an RTOS application:
Using FreeRToS (or MQX), what happens when the While(1) loop is let out of the task?
Here is the task create code:
/* Run GPIO State Algorithm */
xTaskCreate(chkGPIOState, "GPIOStateAlgorithm",
configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY + 1UL),
(TaskHandle_t *) NULL);
Here is the task:
static void chkGPIOState(void)
{
//while (1) { // WHAT HAPPENS TO THE RTOS IF THE while (1) is omitted?
Board_UARTPutSTR("\x1B[2J"); // clear screen
Board_UARTPutSTR("\x1B[1;1H"); // set position to 1,1
pinvalue8=Chip_GPIO_GetPinState(LPC_GPIO_PORT, 0, 13);
pinvalue7=Chip_GPIO_GetPinState(LPC_GPIO_PORT, 0, 14);
pinvalue6=Chip_GPIO_GetPinState(LPC_GPIO_PORT, 0, 15);
pinvalue5=Chip_GPIO_GetPinState(LPC_GPIO_PORT, 0, 12);
Print_Val("GPIO_P0_13 = ", pinvalue8);
Print_Val("GPIO_P0_14 = ", pinvalue7);
Print_Val("GPIO_P0_15 = ", pinvalue6);
Print_Val("GPIO_P0_12 = ", pinvalue5);
vTaskDelay(configTICK_RATE_HZ/2);
//}
}
Michael Steffen
Senior Field Applications Engineer
Member of the Technical Staff
NXP Semiconductors
Hi Michael:
With while (1) loop, GPIO state will print on the screen, and will refresh every ( configTICK_RATE_HZ/2) time.
Without while (1) loop , GPIO state will print only once, not refresh.
Regards
Daniel