how to pass argument values to one task to another task

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to pass argument values to one task to another task

703 Views
sudhakarp
Contributor V

hi..

     I want to pass value's from one task to another task. how to do this things..?

example: in one variable char variable=10;  i want to print this value to another task. and also my tasks are "MQX_AUTO_START_TASK". give some simple example code. i want to pass string value also.


regards,

sudhakar

0 Kudos
Reply
4 Replies

474 Views
matthewkendall
Contributor V

Intertask messages. In the MQX RTOS Reference Manual (MQXRM) see the _msgq_* functions. There is a example code in the description of the _msgq_send() function. There is also a full example program in Freescale_MQX_4_1\mqx\examples\msg\

0 Kudos
Reply

474 Views
sudhakarp
Contributor V

thank you matthew...

         

0 Kudos
Reply

474 Views
seandema
Contributor IV

A quick way is to just make those global variables. But probably a safer way is to use something like messages. Light weight messages (LWMSG) are part of MQX and can be found in MQX_User_Guide.pdf and MQX_Reference_Manual.pdf in your MQX install directory. Basically if task B needs data from task A, task B will hit a blocking call in your code and sit there waiting till task A sends a message containing the data to be passed from task A to task B.

Sorry but I don't have any lwmsg example code handy or I'd post it. I think there are examples in the documentation and in the example projects that come with MQX.

MQX also has other things like semaphores and events that might work. It just depends on your situation.

Hope that helps,

Sean

0 Kudos
Reply

474 Views
sudhakarp
Contributor V

is possible to use global array in different task..?

0 Kudos
Reply