12.07.2015 Views

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

PLCHandler Programming Guide - Esco Drives & Automation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PLCHandler</strong> <strong>Programming</strong> <strong>Guide</strong>RESULT_PLCHANDLER_INACTIVE: <strong>PLCHandler</strong> instance isn’t set active (see IniFile).RESULT_RECONNECTTHREAD_STILL_ACTIVE: reconnect thread is still active.RESULT_ITF_NOT_SUPPORTED: the interface isn’t supported.RESULT_ITF_FAILED: the interface can’t start successfully (missing interface dependentDll’s).RESULT_PLC_NOT_CONNECTED: cannot open connection to the PLC.RESULT_PLC_NOT_CONNECTED_SYMBOLS_LOADED: cannot open connection to the PLC butcould load the symbol file offline.2.4 DisconnectionMethod: long ::Disconnect(void)At a call of this method the connection to the PLC will be terminated.Return value: If no error occurs, the function returns RESULT_OK. Otherwise, it returns …RESULT_FAILED: no corresponding interface which can be closed .2.5 Browsing all variables in the PLCMethod: long ::GetAllItems(PlcSymbolDesc **ppSymbolList, unsigned long *pulNumOfSymbols)This method can be used to read the list of all variables which are specified in the PLC.In ppSymbolList a list of all symbols will be returned. For each symbol the list provides name, datatype, address within PLC, variables size in bytes etc.In pulNumOfSymbols the number of variables will be returned.Return value: If no error occurs, the function returns RESULT_OK. Otherwise, it returns …RESULT_FAILED: common error in the underlying interfaces. A specific error code can beretrieved by GetStatus() resp. GetLastError().RESULT_PLC_NOT_CONNECTED: lost connection to the PLC.RESULT_INVALID_PARAMETER: invalid function parameters (for e.g. NULL).The PlcSymbolDesc structure contains the symbolic description of a variable:struct PlcSymbolDesc{char* pszName; symbol name of the variableunsigned long ulTypeId; reference into the symbol type tablechar* pszType; type name of the variableunsigned short usRefId; variable's type (input, output, global, …)unsigned long ulOffset; offset in the memory imageunsigned long ulSize; size of the variablechar szAccess[2]; access type of the variable (no, read, write access, both)unsigned char bySwapSize; basic swap size of the variable};Speciality: The size of a bit symbol is per definition 0 in the CoDeSys runtime system. So you haveto check the symbol's size for 0 and do a special bit coding (for e.g. memset() or memcpy()with parameter size=1 instead with the original symbol's size) 3S - Smart Software Solutions GmbH<strong>PLCHandler</strong> Programmming <strong>Guide</strong>.doc Page 6 of 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!