Inherits IDispatch.
Classes | |
struct | ApplicationInfo |
struct | ApplicationOpState |
struct | ApplicationTaskInfo |
struct | LogicArrayRange |
struct | LogicSymbolInformation |
struct | LogicUserTypeInformation |
Public Types |
Public Member Functions | |
HRESULT | WriteVariableBySymbol ([in] BSTR symbol, [in] VARIANT data) |
HRESULT | ReadVariableBySymbol ([in] BSTR symbol, [out, retval] VARIANT *data) |
HRESULT | GetInformationOfSymbol ([in] BSTR symbol, [out, retval] struct LogicSymbolInformation *info) |
HRESULT | GetInformationOfUserType ([in] BSTR symbol, [out, retval] SAFEARRAY(struct LogicUserTypeInformation)*logicInfo) |
HRESULT | ReadVariableBySymbolAsString ([in] BSTR symbol, [out, retval] BSTR *data) |
HRESULT | WriteVariableBySymbolAsString ([in] BSTR symbol, [in] BSTR data) |
HRESULT | LoadBootApplication ([in] BSTR file, [in] BSTR path, [out, retval] BSTR *applicationName) |
HRESULT | GetNumberOfApplications ([out, retval] LONG *number) |
HRESULT | GetNameOfApplication ([in] LONG index, [out, retval] BSTR *application) |
HRESULT | StartApplication (void) |
HRESULT | StopApplication (void) |
HRESULT | ResetApplication ([in] ApplicationResetMode mode) |
HRESULT | SetCapabilityOfOperation ([in] LogicCapabilityOperation operation, [in] LogicCapabilityOperationValue value) |
HRESULT | GetCapabilityOfOperation ([in] LogicCapabilityOperation operation, [out, retval] LogicCapabilityOperationValue *value) |
Public Attributes | |
const LONG | LOGIC_MAX_DIMENSION_OF_ARRAY = 3 |
Properties | |
IApplications | Applications [get] |
Definition of the ILogic interface which allows access to the PLC and logic component on the MLPI device.
The ILogic interface contains various methods of accessing different methods of the PLC and Logic subsystems. It makes it possible to read and write symbolic variables as well as input and output memory areas of your PLC application. It is even possible to change, load, start, stop or reset your PLC applications on the device.
Definition at line 73 of file ILogic.idl.
This enumeration defines the state of an application using IApplication::GetStateOfApplication.
Enumerator | |
---|---|
STATE_NONE |
Invalid state of application. |
STATE_RUN |
The application is in state RUN. |
STATE_STOP |
The application is in state STOP. |
STATE_BP |
The application is halted on breakpoint. |
Definition at line 79 of file ILogic.idl.
This enumeration defines the different reset possibilities of an application using ResetApplication.
Definition at line 89 of file ILogic.idl.
This enumeration defines the access rights to a variable.
Definition at line 98 of file ILogic.idl.
enum ILogic::LogicType |
This enumeration defines the different symbol types of the logic using GetInformationOfSymbol.
Definition at line 108 of file ILogic.idl.
This enumeration defines the possible capability to execute an operation.
Enumerator | |
---|---|
LOGIC_CAP_OPERATION_ENABLE |
Enable capability to execute an operation (default). |
LOGIC_CAP_OPERATION_DISABLE |
Disable capability to execute an operation. |
Definition at line 218 of file ILogic.idl.
This enumeration defines an operation which can be enabled/disabled by using SetCapabilityOfOperation. The current capability can be read by GetCapabilityOfOperation. The capability will be set global for all applications.
Definition at line 228 of file ILogic.idl.
This enumeration defines the memory areas 'Ix' (Input), 'Qx' (Output) and 'Mx' (Marker) of an application.
Definition at line 241 of file ILogic.idl.
HRESULT ILogic::WriteVariableBySymbol | ( | [in] BSTR | symbol, |
[in] VARIANT | data | ||
) |
The following function writes I/O data. The function is only able to write a single value at a time. Use this function for sporadic writing of different PLC data.
After you set up the 'Symbol Configuration', you should be able to write a symbolic variable by its name. Please keep in mind that you have to use all name spaces for this variable. For example, if you have a variable "x1" in your task called "Prog", then you have to ask for the variable "Application.Prog.x1" It is not possible to write a floating point value into an integer variable and vice-versa. You can also only write smaller data types into data types of the same size or greater. Writing a USHORT(2 Byte) into a WORD (2 Byte) or a DWORD (4 Byte) is okay. Trying to write a USHORT into a BYTE will fail and produce an error code.
[in] | symbol | Zero terminating string containing the symbolic name to be accessed. |
[in] | data | The value to which the IO is to be written. |
mlpiLogicWriteVariableBySymbol
, where you can find further documentation. HRESULT ILogic::ReadVariableBySymbol | ( | [in] BSTR | symbol, |
[out, retval] VARIANT * | data | ||
) |
The following function reads I/O data. The function is only able to read a single value at a time. Use this function for sporadic reading of different PLC data.
After you set up the 'Symbol Configuration' you should be able to read a symbolic variable by its name. Please keep in mind that you have to use all name spaces for this variable. For example, if you have a variable "x1" in your task called "Prog", then you have to ask for the variable "Application.Prog.x1" It is not possible to write a floating point value into an integer variable and vice-versa. You can also only write smaller data types into data types of the same size or greater. Writing a USHORT(2 Byte) into a WORD (2 Byte) or a DWORD (4 Byte) is okay. Trying to write a USHORT into a BYTE will fail and produce an error code.
As has been said already, this method returns the variable as a typed return value. This means that a DINT
variable will be returned as a Integer
variant, a REAL
variable as a FLOAT
variant and so on. If you don't need or care about a typed object, then you may also want to try the method ReadVariableBySymbolAsString which attempts to return a string representation of the variable. This might come in handy if you only want to read the variable for display reasons.
[in] | symbol | Zero terminating string containing the symbolic name to be accessed. |
[out] | data | The value to which the IO is to be read. |
mlpiLogicReadVariableBySymbol
, where you can find further documentation. HRESULT ILogic::GetInformationOfSymbol | ( | [in] BSTR | symbol, |
[out, retval] struct LogicSymbolInformation * | info | ||
) |
This function reads the type, size and access rights to a symbol of application.
[in] | symbol | Zero terminating string containing the symbolic name which should be accessed. |
[out] | info | Returns a struct with information about the size, type and access rights of the symbol. |
mlpiLogicInformationOfSymbol
, where you can find further documentation. HRESULT ILogic::GetInformationOfUserType | ( | [in] BSTR | symbol, |
[out, retval] SAFEARRAY(struct LogicUserTypeInformation)* | logicInfo | ||
) |
This function reads names and information LogicUserTypeInformation of variables of a symbol if type of symbol equal MLPI_LOGIC_TYPE_USERDEF.
[in] | symbol | Zero terminating string containing the symbolic name to be accessed. |
[out] | logicInfo | Returns a struct array with the names and information about the variables of the symbol. |
mlpiLogicGetInformationOfUserType
, where you can find further documentation. HRESULT ILogic::ReadVariableBySymbolAsString | ( | [in] BSTR | symbol, |
[out, retval] BSTR * | data | ||
) |
This method does the same as ReadVariableBySymbol, but ALWAYS returns the data to be read in string representation. You can use this function not only for string variables, but also for other types. In this case, the function returns a string representation of the given value. This can be useful if you only want to display the variable as string and you don't need to know the variable type. If you want to read the variable with its original type, then you can use the method ReadVariableBySymbol.
[in] | symbol | Zero terminating string containing the symbolic name to be accessed. |
[out] | data | Returns a string with the data to be read. |
mlpiLogicReadVariableBySymbol
, where you can find further documentation. HRESULT ILogic::WriteVariableBySymbolAsString | ( | [in] BSTR | symbol, |
[in] BSTR | data | ||
) |
This method does the same as WriteVariableBySymbol but ALWAYS takes the data to be written in string representation, regardless of the symbol type. The method tries to convert the string to the format of the symbol variable. If you want to write the variable with type checks, then you can use the method WriteVariableBySymbol.
[in] | symbol | Zero terminating string containing the symbolic name to be accessed. |
[in] | data | String representation of the data to be written and the symbol variable. |
mlpiLogicWriteVariableBySymbol
, where you can find further documentation. HRESULT ILogic::LoadBootApplication | ( | [in] BSTR | file, |
[in] BSTR | path, | ||
[out, retval] BSTR * | applicationName | ||
) |
This function loads an application from the file system of the control. The application files can be created from within IndraWorks by creating a boot project when not logged into the control. This file *.app together with a corresponding *.crc checksum file can be copied to the flash card of the control (i.e. using FTP transfer). Use this function to load it.
ResetApplication
with RESET_ORIGIN
of IApplication, or ResetApplication
of IApplications to unload all applications.After loading the application, it is in the state STOP. You have to start the application by using the function StartApplication.
[in] | file | Filename of the new application file without file extension, i.e. "Application". |
[in] | path | Path to the file of the new application. The default root paths can be determined by using the function ISystem::GetSpecialPath in ISystem interface. |
[out] | applicationName | Returns the name of the new application. The name of the application is stored inside the application project file (.app) and is returned here. Use the application name as a handle for other function calls which require the application name in order to identify which application you want to access on the control. |
0xF0360011
(E_LIMIT_MAX
) if there are already too many applications loaded on the target. Remove an application by calling ResetApplication with RESET_ORIGIN
and try again.mlpiLogicInformationOfSymbol
, where you can find further documentation. HRESULT ILogic::GetNumberOfApplications | ( | [out, retval] LONG * | number | ) |
This function returns the number of loaded applications on the device. This also includes stopped applications.
[out] | number | Returns the number of loaded applications. |
mlpiLogicGetNumberOfApplications
, where you can find further documentation. HRESULT ILogic::GetNameOfApplication | ( | [in] LONG | index, |
[out, retval] BSTR * | application | ||
) |
This function returns the name of an application selected by index 0 until (number-1).
[in] | index | Index of application. |
[out] | application | Returns the name of the application with the given index. |
mlpiLogicGetNameOfApplication
, where you can find further documentation. HRESULT ILogic::StartApplication | ( | void | ) |
This function starts all applications on the target.
StartApplication
in the interface IApplication. mlpiLogicStartApplication
, where you can find further documentation. HRESULT ILogic::StopApplication | ( | void | ) |
This function stops all applications on the target.
StartApplication
in the interface IApplication. mlpiLogicStopApplication
, where you can find further documentation. HRESULT ILogic::ResetApplication | ( | [in] ApplicationResetMode | mode | ) |
This function resets all applications on the target.
StartApplication
in the interface IApplication. [in] | mode | Reset mode (0==RESET_WARM, 1==RESET_COLD, 2==RESET_ORIGIN) |
mlpiLogicResetApplication
, where you can find further documentation. HRESULT ILogic::SetCapabilityOfOperation | ( | [in] LogicCapabilityOperation | operation, |
[in] LogicCapabilityOperationValue | value | ||
) |
This function enables or disables the capability of execution of operations LogicCapabilityOperation . The capability will set global for all applications. After reboot, the capability will set to default.
[in] | operation | Operation which can be enabled or disabled. |
[in] | value | Target capability of execution of operation. |
mlpiLogicSetCapabilityOfOperation
, where you can find further documentation. HRESULT ILogic::GetCapabilityOfOperation | ( | [in] LogicCapabilityOperation | operation, |
[out, retval] LogicCapabilityOperationValue * | value | ||
) |
This function reads the current capability of execution of operations LogicCapabilityOperation.
[in] | operation | Operation which can be enabled or disabled. |
[out] | value | Pointer to variable which the current capability of execution of operation should be read to. |
mlpiLogicGetCapabilityOfOperation
, where you can find further documentation. const LONG ILogic::LOGIC_MAX_DIMENSION_OF_ARRAY = 3 |
Maximum dimension of an array.
Definition at line 75 of file ILogic.idl.
|
get |
This property returns a IApplications object which allows access to different IApplication objects, as well as access to methods controlling all PLC applications on the device. The IApplications interface is a collection interface.
[out] | applications | Returns an object of the type IApplications. |