RobotStudio event

Writing to a file at the same time by two tasks.

I have a multitasking system with a foreground task main and a background task back. Both the tasks opens the same file and write 5 statements in each task by using Write or Append file instruction. The problem is when we execute the tasks by using normal flexpendent write operation TPWrite, first the statementAlso s in foreground task printed first in the flex pendent console and then the statements in background tasks get printed in the flex pendent console. But when we write or append the same instructions on to a file, the file looks like it prints the statements in foreground and background task in no order. What we can do to get an output as in the flexpendent to our file. Is there any way to print the output in the order of priority of tasks to a common file? Also when we use Waittime in foreground task before executing the Write Or append statements, then also that waiting is not reflected in the output file. Means before waiting ,the instructions already executes first. 

Comments


  • I have a multitasking system with a foreground task main and a background task back. Both the tasks opens the same file and write 5 statements in each task by using Write or Append file instruction. The problem is when we execute the tasks by using normal flexpendent write operation TPWrite, first the statementAlso s in foreground task printed first in the flex pendent console and then the statements in background tasks get printed in the flex pendent console. But when we write or append the same instructions on to a file, the file looks like it prints the statements in foreground and background task in no order. What we can do to get an output as in the flexpendent to our file. Is there any way to print the output in the order of priority of tasks to a common file? Also when we use Waittime in foreground task before executing the Write Or append statements, then also that waiting is not reflected in the output file. Means before waiting ,the instructions already executes first
  • It sounds to me like you could make good use of the instruction WaitTestAndSet or the function TestAndSet, they do pretty much the same thing.
    Lee Justice
  • OK Thank you.