I don't understand why freertos do not allow to change extern variables (myData) here is my poject
file main.c
uint16_t Mydata = 0;
main()
{
System_Init();
xTaskCreate(Task1, (const char*)"Task1", 100, NULL, 4, NULL);
xTaskCreate(Task2, (const char*)"Task2", 100, NULL, 3, NULL);
vTaskStartScheduler();
}
file Task1.c
extern uint16_t Mydata;
void Task1(void *p)
{
while(1)
{
vTaskDelay(10);
printf("Result: %d", Mydata);
}
}
file Task2.c
extern uint16_t Mydata;
void Task2(void *p)
{
while(1)
{
Mydata++;
vTaskDelay(10);
}
}
but the result is never correct
most of result is like "13842930", "-18234952", or something like that !
can anyone tell me why? (I'm sorry because of my bad English) thank for your help !