how to pass argument values to one task to another task

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to pass argument values to one task to another task

819件の閲覧回数
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 件の賞賛
返信
4 返答(返信)

590件の閲覧回数
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 件の賞賛
返信

590件の閲覧回数
sudhakarp
Contributor V

thank you matthew...

         

0 件の賞賛
返信

590件の閲覧回数
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 件の賞賛
返信

590件の閲覧回数
sudhakarp
Contributor V

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

0 件の賞賛
返信