I have a task that I need to run on two serial ports.
The same operations on both ports.
I tried using the Task Parameter from the Task Template but it didn't seem to work.
TASK_TEMPLATE_STRUCT MQX_template_list[] ={/* Task number, Entry point, Stack, Pri, String, Auto? */ {MAIN_TASK, Main_task, 3000, 9, "main", MQX_AUTO_START_TASK, 0, 50}, {TTYA, serial_app, 3000, 9, "TTYA", MQX_TIME_SLICE_TASK, 0, 50}, {TTYB, serial_app, 3000, 9, "TTYB", MQX_TIME_SLICE_TASK, 1, 50}, {0, 0, 0, 0, 0, 0, 0, 0}};
I have the task argument for TTYA set to 0 and TTYB set to 1
Each time serial_app starts the argument is 0
What am I missing?
tom
ps. I am using MQX 3.6
The argument in the Task Template List is only used if the MQX_AUTO_START_TASK attribute is set for that task.
Since your two serial tasks (TTYA and TTYB) do not have the auto start attribute set, it means at some point in your main code you have to call task_create.
The 3rd argument in that task_create() function call over-rides the initial data argument in the Task Template List. So you should be calling it like so:
_task_create(0,TTYA,0);
_task_create(0,TTYB,1);
See page 358 of the MQX Reference Manual for more details than you'd ever want to know on the task_create function.
-Anthony
One thing you might want to double check is that your TTYA and TTYB task id's are unique. That could have also caused your problem in the code.
You're correct. I was just refering to the MQX_template_list in the sample code in your original post.
-Anthony