TYPE SMC_VARLIST : STRUCT
The standard IEC 61131-3 provides no possibility to determine the value of a variable by its symbolic name represented as a string. This however is necessary, if the variable functionality, which is available for the user by SMC_CNC_REF, also should be available for reading in the CNC program from a file. This can be managed by using the structure SMC_VARLIST.
Example
Assume a CNC program in a file, containing the two variables g_rTestX (REAL) and g_byCommand (BYTE): |
N0 G$g_byCommand$ X$g_rTestX$ |
In order to link this syntax to IEC variables and to make the g-code understandable for SMC_ReadNCFile, one would use SMC_VARLIST and declare e.g. the following:
g_byCommand : BYTE;
g_rTest : REAL;
asv : ARRAY[0..1] OF SMC_SingleVar := [
(strVarName := 'G_BYCOMMAND', eVarType := SMC_TYPE_BYTE, pAdr := ADR(g_byCommand)),
(strVarName := 'G_RTESTX', eVarType := SMC_TYPE_REAL, pAdr := ADR(g_rTest))];
vl : SMC_VarList := (wNumberVars := 2, psvVarList := ADR(asv[0]));
If a variable cannot be replaced, SMC_ReadNCFile will return an error.
InOut: |
|