350
8-10 Q&A of C language
(1)second macro definition for the coil
Some users have further extended the software component type after defining it, as shown in
the following code:
#define SysRegAddr_HD_D_HM_M_X_Y
#define OUT Y[1]
OUT = 100;
The second macro definition of coils such as Y is not allowed because the reading and writing
of coil data is not simply a pointer, but through a function. In this case, the compiler cannot
handle it, resulting in an error.
(2)Use the value of the coil as the judgment condition
The user uses the value of the coil as the judgment condition of the if statement, as shown in
the following code:
if(X[0])D[0] =10;
This writing method will report an error during compilation because our compiler has made
an error during internal processing. It is recommended that you change the line, as follows:
if(X[0])
D[0] =10;
(3)Use DM
DM[0] is not supported at present. Only DW and FW double word operations are supported.
(4)An error is reported during compilation, and macro defintion color changes to black
This phenomenon is caused by full angle characters in the code. Full angle characters can be
cleared by using formatting.
(5)The C language function in the header file has no compilation function.
tudonghoatoancau.com