Skip to main content

Compiler Error C0165

Message: Variable '<variable name>‘, which is mapped on address '<address>‘ is written in different tasks.

Possible error cause: The device setting codegenerator\check-multiple-task-output-write is set and multiple tasks access the same output.

Error correction: Write an output in one fixed task only. If multiple tasks need to calculate data for one output, then you should try to transfer this information by means of global variables to one fixed task, which then writes the data to one output.

Example 407. Example of the error:
_cds_img_error_c0165.png
PROGRAM PLC_PRG_1
VAR
    Output AT %QB7 : BYTE;
END_VAR
Output := 0;

PROGRAM PLC_PRG_2
VAR
    Output AT %QB7 : BYTE;
END_VAR
Output := 1;

Message:

C0165: Variable Output, which is mapped on address QB7 is written in different tasks.