Вы находитесь на странице: 1из 6

Library Description:

CoDeSys V 3.x
SysComAsync.library

Document Version 1.0


libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 1 of 6


SysComAsync_V3x_E.doc
Library SysComAsync.library

CONTENT

1 OVERVIEW 3

2 LIBRARY MODULES 4

CHANGE HISTORY 6
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 2 of 6


SysComAsync_V3x_E.doc
Library SysComAsync.library

1 Overview

Note: It depends on the target system, which system libraries can be used in the application program.

This library supports the asynchronous serial communication with a target device. It
automatically includes the library SysCom.library for synchronous communication, whose
modules are used as a basis for the corresponding asynchronous functionality. The modules
of SysCom.library make available their parameters to the SysComAsync.library in appropriate
structures. Thus these parameters can be used by the methods and wrapper-methods of
SysComAsync.library.

Note: For the asynchronous processing of the tasks the library also uses the base library CmpAsyncMgr.library.
For this purpose the component CmpAsyncMgr must be available!
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 3 of 6


SysComAsync_V3x_E.doc
Library SysComAsync.library

2 Library Modules

Due to the fact that the async-functionality for file accesses is basing on the modules of
SysCom.library, using wrapper-methods and shared structures (DUTs), the async-modules
always need the following input parameters:
Input-Variable Datentyp Beschreibung

pParam POINTER TO Pointer on the structure containing the parameters


t<Function of of the corresponding SysCom.library function.
SysCom.library>
e.g. structure tSysComOpen

pudState POINTER TO Pointer on current status:


UDINT
ASYNCSTATE_INVALID
: UDINT := 16#FFFFFFFF;
ASYNCSTATE_PENDING
: UDINT := 0;
ASYNCSTATE_ACTIVE
: UDINT := 1;
ASYNCSTATE_READY
: UDINT := 2;
ASYNCSTATE_ERROR
: UDINT := 3;
ASYNCSTATE_TIMEOUT
: UDINT := 4;

pResult POINTER TO Pointer on error code; see document Runtime Error


UDINT Codes.

The functions:

SysComOpen
SysComOpen2
SysComPurge
SysComRead
SysComSetSettings
SysComSetTimeout
SysComGetSettings
SysComClose
SysComWrite

The functions use the following structures and enumerations:

ComSettings
ComSettingsEx
COM_Baudrate
libdoc_e.dot / V1.0

COM_Parity
COM_Ports
COM_StopBits
COM_Timeout

3S - Smart Software Solutions GmbH Page 4 of 6


SysComAsync_V3x_E.doc
Library SysComAsync.library

For each of the methods a corresponding wrapper-method is called: <method name>wrapper

The structures (DUTs, Data Unit Types) are named according to the following syntax:
t<function of SysCom.library>. Example: tSysComOpen.

The return value of each function is given in the structure element pulOut resp. pOut or
pszOut.

The status at starting the asynchronous job always is ASYNCSTATE_INVALID.

Example:
DECLARATION:
udStateOpen: UDINT := ASYNCSTATE_INVALID;
ParamOpen : tSysComOpen;
TestFB : SysComAsyncFB;
Result: UDINT;

IMPLEMENTATION:
ParamOpen.pResult := adr(Result);
ParamOpen.pulOut := adr(hCom);
ParamOpen.wPort := 1;
hJob := TestFB.SysComOpenAsync(adr(ParamOpen), adr(udStateOpen),
adr(Result));

When calling the method SysComOpenAsync, the asynchronous job gets started. The job will
be finished as soon as the status has got one of the following three values:

ASYNCSTATE_READY: Job successfully finished

ASYNCSTATE_ERROR: Job terminated with error

ASYNCSTATE_TIMEOUT: Job timeout reached before job could be finished


successfully

For a description of the particular parameters please see the chapters on the corresponding
functions in the documentation on SysCom.library.
libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 5 of 6


SysComAsync_V3x_E.doc
SysComAsync.library

Change History
Version Description Date

1.0 Translation and Release acc. to German V1.0 09.08.2007


libdoc_e.dot / V1.0

3S - Smart Software Solutions GmbH Page 6 of 6


SysComAsync_V3x_E.doc

Вам также может понравиться