Hi,
I am working with Codewarrior v10.6 and of MQX v4.0 and created a project in which I need to set event.
To set Event I have taken an array of 16bit vector and set it.
for example,
///////////////////////////////////////////////////////////////////////////////
Task 1 :
uint_16 EventVector;
//say EventVector at a moment is 0x0080. EventVector is changing continuously.
//Bits of EventVector will set according to condition,,,,,,,,,
while(1)
{
////my stuff........
if(condition)
_event_set(event_ptr,EventVector); //event is conditionally set
}
///////////////////////////////////////////////////////////////////////////////
Task 2
while(1)
{
_event_wait_all_ticks(event_ptr, EventVector, 0);
//my stuff..........
printf("1 \n");
_event_clear(event_ptr,EventVector);
}
///////////////////////////////////////////////////////////////////////////////
That is what I have written with event create and all the other stuff in my project.
The problem is, Task 2 is not waiting for the event. It is printing "1" all the time whether event is set or not.
But when I am writing like
///////////////////////////////////////////////////////////////////////////////
Task 1 :
uint_16 EventVector;
//say EventVector at a moment is 0x0080. EventVector is changing continuously.
//Bits of EventVector will set according to condition,,,,,,,,,
while(1)
{
////my stuff........
if(condition)
_event_set(event_ptr,0x01); //event is conditionally set
}
///////////////////////////////////////////////////////////////////////////////
Task 2
while(1)
{
_event_wait_all_ticks(event_ptr, 0x01, 0);
//my stuff..........
printf("1 \n");
_event_clear(event_ptr,0x01);
}
///////////////////////////////////////////////////////////////////////////////
then "1" will be printed only when the even is set.
why its is so??Can anybosy tell me how to pass the dynamically data into event...???
Please don't suggest me to see the demo of Event in MQX which is , I have already seen and made the project.
Plz help...:smileysad::smileyconfused:
Hello,
Please check the below link, you can find some labs that explain step to step how to create projects using a Kinetis Device and some OS services.
MQX Basics Training - 6 Tutorials (Labs) for MQX Begginers
Please check the lab "Using Events and Mutex"
Let me know if this helps,
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------