322
parameters in the ladder are HD0, HM0, then W[0]=HD0,B[0]=HM0; if the
parameters in the ladder are D100, HM100, then W[0]=D100, B[0]=HM100. So,
word and bit components start address are defined in PLC program by the user.
Note: The local variable defined inside the C function cannot be more than 100 words.
Parameter W: represent Word soft component, use it in the form of data group. E.g
W[0]=1; W[1]=W[2]+W[3]; in the program, use soft components according to
standard C language rules.
Parameter B: represent Bit soft component, use it in the form of data group. Support
SET and RESET. E.g: B[0]=1; B[1]=0; And assignment, for example, B[0]=B[1].
Double word operation: add D in front of W. E.g. DW[10]=100000, it means
assignment to double-word W[10]W[11]. Double-word operation: Support the
definition of floating variable in the function, and execute floating operation;(E.g:
float register D0(double word) means FW[0], FW[0]=123.456)
Other soft elements definition in C language:
When a function block is created, #define SysRegAddr_HD_D_HM_Mis default defined in
the main function. If you need to use input (X) and output (Y), you need to add X, Y in the
default Macro definition “#define SysRegAddrHD_D_HM_M”, which will be “#define
SysRegAddrHD_D_HM_M_X_Y”. For example, set X0 state to coil M0, B[0]=X[0]; set Y0
state to coil M10, B[10]= Y[0]. (Note: The corresponding X and Y are expressed in decimal
rather than octal in C language).
Similarly, the applications in C are same for non-power off memory process S, counter C,
timer T, counter register CD, timer register TD, register D (HD) and coil M (HM), etc. Macro
definition “#define SysRegAddr_S_C_T_CD_TD_D_M”. If they are power off memory
process HS, counter HC, timer HT, counter register HCD, timer register HTD, etc, Macro
definition “#defineSysRegAddr_HS_HC_HT_HCD_HTD”.
Examples: W[0]=CD[0];W[1]=TD[0];B[1]=C[0];B[2]=T[0];
Note: Software component types are supported except SEM.
When the function block is created, default define #define SysRegAddr_HD_D_HM_M
in the main function.
It is recommended to use it as a local macro definition, that is, inside the function body.
Function Library: The user function block can directly use the functions and constants
defined in the function library. See chapter 8-10 for the functions and constants
contained in the function library.
The other data type supported:
tudonghoatoancau.com