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>2.6 Getting a variables' descriptionMethod: long ::GetItem(char *pszSymbol, PlcSymbolDesc *pSymbol)pszSymbol specifies the variable, for which the description should be retrieved.In pSymbol the description (data type, size in bytes, address etc.) of the variable 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).2.7 Cyclic Update of Variables2.7.1 Creating a cyclic listMethod: HCYCLIST ::CycDefineVarList(char **ppszSymbols, unsigned long ulNumOfSymbols,unsigned long ulUpdateRate, unsigned long hUpdateReadyEvent = 0,unsigned long hDataChangeEvent = 0, unsigned long hUpdateEvent = 0)This method can be used to create a list of variables, whose values should be updated cyclically bythe <strong>PLCHandler</strong> and can be read at any time. The method returns a handle for the list. This handlemust be passed with all further method calls.ppszSymbols: Here a list of variable names will be passed.ulNumOfSymbols: This parameter specifies the number of variables in the list.ulUpdateRate: Specifies the update rate for the cyclic update of the variable values.hDataChangeEvent: Here optionally a handle on a event can be specified, referring to which aninformation should be sent at any value change.hUpdateEvent: Here the handle of an event can be passed, which then will be used to control thecyclic update.Return value: If no error occurs, the function returns a handle for the cyclic list. Otherwise, it returns …NULL: function failed. A specific error code can be retrieved by GetStatus() resp.GetLastError().2.7.2 Deleting a cyclic listMethod: long ::CycDeleteVarList(HCYCLIST hCycVarList, int bKeepalive = 1)This method is used to delete a list of variables which had been set up for cyclic update (see above).hCycVarList: Specifies the handle which has been passed by CycDefineVarList().BKeepalive: Here you define, whether the <strong>PLCHandler</strong> should start a so-called "Keepalive" if thecurrent list is the last cyclic list which gets deleted. In this case typically a thread will be started in the<strong>PLCHandler</strong>, sending a Keepalive service to the PLC every 2 seconds, in order that the PLC will notlog out if no further services are sent.Return value: If no error occurs, the function returns a handle for the cyclic list. Otherwise, it returns …RESULT_PLC_NO_CYCLIC_LIST_DEFINED: no list to delete. 3S - Smart Software Solutions GmbH<strong>PLCHandler</strong> Programmming <strong>Guide</strong>.doc Page 7 of 17

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

Saved successfully!

Ooh no, something went wrong!