The following functions provide symbolic read access to logic variables.
The table shows the PLC data types within the IEC61131 environment 'IndraLogic' and the corresponding data types within the C/C++ environment (e.g. 'Workbench OEM') of the MLPI. On reading variables by symbols, on default, you use the functions below named after the MLPI data type like mlpiLogicReadVariableBySymbolUlong. If you include the header mlpiLogicHelper.h, you can also use the equivalent functions named after the IEC61131 data types like mlpiLogicReadVariableBySymbolDword or like mlpiLogicReadVariableBySymbolUdint.
Number of Bits | Data types of PLC | Data types of MLPI |
---|---|---|
8 | BOOL | BOOL8 |
8 | SINT | CHAR |
16 | INT | SHORT |
32 | DINT | LONG |
64 | LINT | LLONG |
8 | USINT | UCHAR |
16 | UINT | USHORT |
32 | UDINT | ULONG |
64 | ULINT | ULLONG |
8 | BYTE | UCHAR |
16 | WORD | USHORT |
32 | DWORD | ULONG |
64 | LWORD | ULLONG |
32 | REAL | FLOAT |
64 | LREAL | DOUBLE |
8n | STRING | WCHAR16 |
16n | WSTRING | WCHAR16 |
MLPIRESULT mlpiLogicReadVariableBySymbolBool8 | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
BOOL8 * | data | ||
) |
This function reads a boolean value (BOOL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolChar | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
CHAR * | data | ||
) |
This function reads an 8 bit signed value (SINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolUchar | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
UCHAR * | data | ||
) |
This function reads an 8-bit unsigned value (BYTE, USINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolShort | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
SHORT * | data | ||
) |
This function reads a 16-bit signed value (INT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolUshort | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
USHORT * | data | ||
) |
This function reads a 16-bit unsigned value (WORD, UINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolLong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
LONG * | data | ||
) |
This function reads a 32-bit signed value (DINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolUlong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
ULONG * | data | ||
) |
This function reads a 32-bit unsigned value (DWORD, UDINT, TIME, DATE, DATE_AND_TIME, ..., MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolLlong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
LLONG * | data | ||
) |
This function reads a 64-bit signed value (LINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolUllong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
ULLONG * | data | ||
) |
This function reads a 64-bit unsigned value (LWORD, ULINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolFloat | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
FLOAT * | data | ||
) |
This function reads a 32-bit floating point value (single precision, REAL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolDouble | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
DOUBLE * | data | ||
) |
This function reads a 64-bit floating point value (double precision, LREAL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value will be stored. |
MLPIRESULT mlpiLogicReadVariableBySymbolString | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
WCHAR16 * | data, | ||
const ULONG | numElements | ||
) |
This function reads a character string value (STRING, MlpiLogicType) from a variable by symbolic access. You can use this function not only for string variables, but also for other simple types and arrays of simple types. In this case, the function returns a string representation of the given value. The values of a string represented array will be separated by spaces. The reading of values as a string can be useful if you only want to display the variable as a string and you don't need to know the type of the variable.
Data types of PLC | Valid prefixes for argument 'symbol' | Example of argument 'symbol' | Example of result 'data' |
---|---|---|---|
BOOL | none | L"Application.PlcProg.locVarBool" | L"TRUE" |
MLPI_READ_VAR_DISPLAY_TYPE_BOOLEAN | L"BLN:Application.PlcProg.locVarBool" | L"TRUE" | |
MLPI_READ_VAR_DISPLAY_TYPE_DEC | L"DEC:Application.PlcProg.locVarBool" | L"1" | |
MLPI_READ_VAR_DISPLAY_TYPE_HEX | L"HEX:Application.PlcProg.locVarBool" | L"0x01" | |
MLPI_READ_VAR_DISPLAY_TYPE_BIN | L"BIN:Application.PlcProg.locVarBool" | L"0b0000.0001" | |
BYTE, WORD, DWORD, LWORD | none | L"Application.PlcProg.locVarByte" | L"222" |
MLPI_READ_VAR_DISPLAY_TYPE_DEC | L"DEC:Application.PlcProg.locVarByte" | L"222" | |
MLPI_READ_VAR_DISPLAY_TYPE_HEX | L"HEX:Application.PlcProg.locVarByte" | L"0xDE" | |
MLPI_READ_VAR_DISPLAY_TYPE_BIN | L"BIN:Application.PlcProg.locVarByte" | L"0b1101.1110" | |
USINT, UINT, UDINT, ULINT | none | L"Application.PlcProg.locVarUint" | L"42" |
MLPI_READ_VAR_DISPLAY_TYPE_DEC | L"DEC:Application.PlcProg.locVarUint" | L"42" | |
MLPI_READ_VAR_DISPLAY_TYPE_HEX | L"HEX:Application.PlcProg.locVarUint" | L"0x2A" | |
MLPI_READ_VAR_DISPLAY_TYPE_BIN | L"BIN:Application.PlcProg.locVarUint" | L"0b0010.1010" | |
SINT, INT, DINT, LINT | none | L"Application.PlcProg.locVarInt" | L"-16982" |
MLPI_READ_VAR_DISPLAY_TYPE_DEC | L"DEC:Application.PlcProg.locVarInt" | L"-16982" | |
MLPI_READ_VAR_DISPLAY_TYPE_HEX | L"HEX:Application.PlcProg.locVarInt" | L"0xBDAA" | |
MLPI_READ_VAR_DISPLAY_TYPE_BIN | L"BIN:Application.PlcProg.locVarInt" | L"0b1011.1101.1010.1010" | |
REAL, LREAL | none | L"Application.PlcProg.locVarReal" | L"3.141592" |
STRING, WSTRING | none | L"Application.PlcProg.locVarString" | L"Don't panic!" |
TIME | none | L"Application.PlcProg.locVarTime " | L"5d12h34m15s12ms" |
DATE | none | L"Application.PlcProg.locVarTime " | L"2010-03-29" |
DATE_AND_TIME | none | L"Application.PlcProg.locVarTime " | L"2010-03-29-15:36:30" |
TIME_OF_DAY | none | L"Application.PlcProg.locVarTime " | L"15:36:30.123" |
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the value(s) will be stored. |
[in] | numElements | Number of WCHAR16 elements in 'data' available to read. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayBool8 | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
BOOL8 * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of Boolean values (BOOL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of BOOL8 elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayChar | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
CHAR * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 8-bit signed values (SINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of CHAR elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayUchar | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
UCHAR * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 8-bit unsigned values (BYTE, USINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of UCHAR elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayShort | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
SHORT * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 16-bit signed values (INT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of SHORT elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayUshort | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
USHORT * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 16-bit unsigned values (WORD, UINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of USHORT elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayLong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
LONG * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 32-bit signed values (DINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of LONG elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayUlong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
ULONG * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 32-bit unsigned values (DWORD, UDINT, TIME, DATE, DATE_AND_TIME, ..., MlpiLogicType) from a variable. by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of ULONG elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayLlong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
LLONG * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 64-bit signed values (LINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of LLONG elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayUllong | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
ULLONG * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 64-bit unsigned values (LWORD, ULINT, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of ULLONG elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayFloat | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
FLOAT * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 32-bit floating point values (single precision, REAL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of FLOAT elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayDouble | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
DOUBLE * | data, | ||
const ULONG | numElements, | ||
ULONG * | numElementsRet | ||
) |
This function reads an array of 64-bit floating point values (double precision, LREAL, MlpiLogicType) from a variable by symbolic access.
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | numElements | Number of DOUBLE elements in 'data' available to read. |
[out] | numElementsRet | Number of elements used. |
MLPIRESULT mlpiLogicReadVariableBySymbolArrayVoid | ( | const MLPIHANDLE | connection, |
const WCHAR16 * | symbol, | ||
void * | data, | ||
const ULONG | dataSize, | ||
ULONG * | dataSizeRet | ||
) |
This function reads user-defined data type values from a variable by symbolic access (raw reading).
[in] | connection | Handle for multiple connections. |
[in] | symbol | Symbol variable of PLC application. |
[out] | data | Pointer to variable where the values will be stored. |
[in] | dataSize | Number of bytes in 'data' available to read. |
[out] | dataSizeRet | Number of bytes used. |