how to resolve this function block cannot be used in a PLC task error 1000.2.10005 ?
csanchez411 already described what to do. I merely want to add some additional information for clarity.
The "Default task TASK" is a PLC type task. It means, that immediately after it finishes one execution it starts the nex round. This behavior always leads to 100% CPU load but gives you the fastest execution time. This type of task should be used if you need to execute logic (binary programs) as-fast-as-possible.
The default task does not have a task cycle. It runs as fast as possible. The different executions of this task can have a different duration, because you can program IF statements (in IL and ST programs) and the execution of the TRUE and FALSE branches might take different times.
The "Task TASK" is a cyclic task with a constant cycle time. Here the task cycle should be configurede much bigger ( > 5 times, better >10 times) than the duration of a single execution.
In the picture the blue execution duration is bigger than the grey execution duration.
(In reality the differences are much bigger, because an execution is normally interrupted by communication and other system interrupts.)
Function blocks (like PID) as opposed to functions (like AND) depend on a constant task cycle for their algorithm. The control quality of a PID function block will get worse if the task cycle is not constant. Because the Default Task does not have a task cycle at all, function blocks are not allowed to be used inside it. Functions are.