CDSIF - Kuhnke
CDSIF - Kuhnke CDSIF - Kuhnke
Kuhnke Electronics Instruction Booklet CoDeSys System Interface (CDSIF) DLL for Data Exchange E 674-4 GB 2 Jan 2007 CoDeSys System Interface
- Page 2 and 3: KUHNKE Automation CDS System This i
- Page 4 and 5: KUHNKE Automation CoDeSys System In
- Page 6 and 7: KUHNKE Automation CoDeSys System In
- Page 8 and 9: KUHNKE Automation CoDeSys System In
- Page 10 and 11: KUHNKE Automation CoDeSys System In
- Page 12 and 13: KUHNKE Automation CoDeSys System In
- Page 14 and 15: KUHNKE Automation CoDeSys System In
- Page 16 and 17: KUHNKE Automation CoDeSys System In
- Page 18 and 19: KUHNKE Automation CoDeSys System In
- Page 20 and 21: KUHNKE Automation CoDeSys System In
- Page 22 and 23: KUHNKE Automation CoDeSys System In
- Page 24 and 25: KUHNKE Automation CoDeSys System In
- Page 26 and 27: KUHNKE Automation CoDeSys System In
- Page 28: KUHNKE Automation CoDeSys System In
<strong>Kuhnke</strong> Electronics<br />
Instruction Booklet<br />
CoDeSys System Interface (<strong>CDSIF</strong>)<br />
DLL for Data Exchange<br />
E 674-4 GB 2 Jan 2007<br />
CoDeSys<br />
System Interface
KUHNKE Automation CDS System<br />
This instruction booklet is primarily intended for use by design, project, and delvelopment engineers. It does not contain any delivery<br />
information. Data is only given to describe a task solution and must not be regarded as guaranteed properties in the legal sense. Any<br />
claims for damages - on whatever legal grounds - are excluded except for instances of deliberate intent or gross negligence on our part.<br />
We reserve the rights for errors, omissions and modifications.<br />
Reproduction even of extracts only with the editor's express and written prior consent.<br />
E 674-4 GB 2<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
Table of Contents<br />
1 Introduction......................................................................................................................................................5<br />
Communication Strategy Diagram..................................................................................................................5<br />
1.1 Functions..............................................................................................................................................6<br />
2 PLCHandler .....................................................................................................................................................7<br />
2.1 Source..................................................................................................................................................7<br />
2.2 Possibilities of Communication ............................................................................................................7<br />
3 <strong>CDSIF</strong>.INI ........................................................................................................................................................8<br />
3.1 Header .................................................................................................................................................8<br />
3.2 General Parameters for All Types of Connection ................................................................................8<br />
3.3 Specific Parameters by Type of Connection........................................................................................9<br />
3.3.1 Serial Connection...............................................................................................................................9<br />
3.3.2 CAN Connection.................................................................................................................................9<br />
3.3.3 DPRAM Interfacing with a Slot PLC.................................................................................................10<br />
3.3.4 Shared Memory with Soft PLC SP RTE...........................................................................................10<br />
4 Symbol Configuration ....................................................................................................................................11<br />
5 Installing the <strong>CDSIF</strong> System .........................................................................................................................13<br />
5.1 Installing Add-ons...............................................................................................................................14<br />
6 <strong>CDSIF</strong> System Functions ..............................................................................................................................15<br />
6.1 General ..............................................................................................................................................15<br />
6.1.1 Version Info ......................................................................................................................................15<br />
6.2 Connecting with/Disconnecting from PLCHandler and Status ..........................................................15<br />
6.2.1 Connect ............................................................................................................................................15<br />
6.2.2 Disconnect........................................................................................................................................15<br />
6.2.3 PLCHandler Status...........................................................................................................................16<br />
6.3 Synchronous Read.............................................................................................................................17<br />
6.3.1 Synchronous Read of Numerical Variables .....................................................................................17<br />
6.3.2 Reading a Byte.................................................................................................................................17<br />
6.3.3 Reading a Word ...............................................................................................................................17<br />
6.3.4 Reading a Long Word ......................................................................................................................18<br />
6.4 Synchronous Read of Arrays and Structures ....................................................................................19<br />
6.4.1 Synchronous Reading of an Array ...................................................................................................19<br />
6.4.2 Synchronous Reading of a String ....................................................................................................20<br />
6.5 Synchronous Write.............................................................................................................................21<br />
6.5.1 Synchronous Write of Numerical Variables .....................................................................................21<br />
6.5.2 Synchronous Writing of a Byte.........................................................................................................21<br />
6.5.3 Synchronous Writing of a Word .......................................................................................................22<br />
6.5.4 Synchronous Writing of a Long Word ..............................................................................................22<br />
6.5.5 Synchronous Write of Arrays and Structures...................................................................................23<br />
6.6 Browsing Variables ............................................................................................................................24<br />
6.6.1 Getting the Number of Variables......................................................................................................24<br />
6.6.2 Reading the Names of Variables .....................................................................................................24<br />
7 Error Codes ...................................................................................................................................................25<br />
7.1 <strong>CDSIF</strong>.DLL Error Codes ....................................................................................................................25<br />
7.2 PLCHandlers.DLL Error Codes..........................................................................................................26<br />
8 Appendix........................................................................................................................................................27<br />
8.1 References.........................................................................................................................................27<br />
8.2 Sales & Service..................................................................................................................................28<br />
8.2.1 Main Factory in Malente...................................................................................................................28<br />
E 674-4 GB 3<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
8.2.2 Sales Germany.................................................................................................................................28<br />
8.2.3 Customer Service.............................................................................................................................28<br />
E 674-4 GB 4<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
1 Introduction<br />
Communication Strategy Diagram<br />
CoDeSys<br />
programming<br />
system<br />
The CoDeSys system interface (<strong>CDSIF</strong> = CoDeSys System Interface) consists<br />
of several DLLs enhancing simple data exchange between a modern<br />
programming language (Delphi, Visual Basic, VC++), MS Office (Excel),<br />
SCADA systems, LabVIEW, etc. at one end of the line and unit of the Co-<br />
DeSys Automation Alliance at the other.<br />
This document will mainly focus on products supplied by <strong>Kuhnke</strong> GmbH /<br />
Malente, Germany.<br />
<strong>CDSIF</strong>.DLL encapsulates the C++ classes of the PLCHandler.DLL in simpler<br />
functions.<br />
Symbol file<br />
for PLC 1<br />
and/or PLC 2<br />
projects<br />
VB application Delphi<br />
visualisation<br />
<strong>CDSIF</strong>.DLL<br />
PLCHandler<br />
TCP/IP or local<br />
Gateway<br />
TCP/IP, serial, DPRAM, etc.<br />
PLC 1 PLC 2<br />
<strong>CDSIF</strong>.INI,<br />
communication<br />
method<br />
descriptions<br />
simultaneous<br />
connections with<br />
several controllers<br />
possible<br />
E 674-4 GB 5<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
1.1 Functions<br />
The following set of services is currently supported:<br />
• Connecting / disconnecting.<br />
• Reading (browsing) of all variables available in the controller.<br />
• Synchronous read.<br />
• Synchronous write.<br />
• Synchronous read of structures.<br />
• Synchronous write of non-numerical variables.<br />
The following services still need to be implemented:<br />
• Cyclic read.<br />
• Generation of list of variables for cyclic read.<br />
The following communication methods are currently supported:<br />
• WIN-XP, ARTI, serial with a 690PLC+ via com1 and com2.<br />
• WIN-XP, GATEWAY, serial with a 690PLC+ via com1 and com2.<br />
• WIN-XP, GATEWAY, shared memory with a 645-PCI.<br />
• WIN-XP, GATEWAY, Ventura-CAN.<br />
• WIN-XP, GATEWAY, shared memory with Ventura+.<br />
• WIN-XP, TCPIP.<br />
• WIN-XP, SP RTE soft PLC<br />
E 674-4 GB 6<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
2 PLCHandler<br />
2.1 Source<br />
2.2 Possibilities of Communication<br />
PLCHandler programmer's manual, 3S GmbH V1.2 8 Feb 2005<br />
PLCHandler and controller can communicate via the following channels (interfaces):<br />
Simulation:<br />
Symbol definitions of the controller are retrieved directly from the SDB file.<br />
Afterwards, read and write operations are supported on all variables as if the<br />
controller was directly connected.<br />
ARTI<br />
The ARTI interface is available for various platforms: Windows XP/NT/CE,<br />
VxWorks, Linux. However, TCP/IP and serial are the only communication<br />
methods supported.<br />
GATEWAY:<br />
The Gateway is constrained to the Windows platforms, Windows<br />
95/98/NT/2000/XP. It supports a broader range of communication methods,<br />
though (TCP/IP, serial, shared memory, CANopen, ...).<br />
E 674-4 GB 7<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
3 <strong>CDSIF</strong>.INI<br />
3.1 Header<br />
<strong>CDSIF</strong>.INI defines and sets up all communication methods.<br />
It contains the general and specific parameter settings for a communication<br />
method.<br />
[Server] Section containing optional OPC server preferences.<br />
PLCs= Number of possible connections<br />
PLC0=PLC_ID0 Name of first connection<br />
PLC0=PLC_ID1 Name of second connection, etc.<br />
3.2 General Parameters for All Types of Connection<br />
[PLC0:PLC_ID0] or<br />
[PLC1:PLC_ID1]<br />
Section setting up the specified connection.<br />
active= 0: connection dead; 1: connection alive<br />
interfacetype= SIMULATION, ARTI or GATEWAY<br />
gateway=local<br />
gateway=TCP/IP<br />
gatewayaddress=xxx.xxx.xxx.xxx<br />
gatewayaddress=localhost<br />
Local connection on a PC.<br />
Remote connection with a PC.<br />
IP address of remote PC.<br />
TCP/IP link to local PC.<br />
gatewayport=1210 One of the communication parameters retrieved from the<br />
CoDeSys setup.<br />
project=name.pro Name of project that the connection belongs to. => symbol<br />
file<br />
timeout=500 Longest time (in ms) it may take to respond to a data packet<br />
from the controller until an error will be assumed.<br />
tries=10 Number of transfer attempts if a data packet fails to be received.<br />
waittime=20 Longest time (in s) the PLCHandler will try to connect. When<br />
the time is out the routine will return and provoke an error<br />
message.<br />
reconnecttime=2 Interval (in s) at which the Reconnect-Thread() retries to connect.<br />
E 674-4 GB 8<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
3.3 Specific Parameters by Type of Connection<br />
3.3.1 Serial Connection<br />
device=Serial (RS232)<br />
instance=Serial comX com1, com2, etc.<br />
parameters=5<br />
parameter0=Port<br />
value0=COMX<br />
parameter1=Baud rate<br />
value1=19200<br />
parameter2=Parity<br />
value2=No<br />
parameter3=Stop bits<br />
value3=1<br />
parameter4=Motorola byteorder<br />
value4=No<br />
3.3.2 CAN Connection<br />
device=CANopen DSP302<br />
instance=SJA1000<br />
parameters=5<br />
parameter0=NodeID<br />
value0=1<br />
parameter1=Node Send Offset<br />
value1=1536<br />
parameter2=Node Recv Offset<br />
value2=1408<br />
parameter3=CAN bus baud rate<br />
value3=125<br />
parameter4=CAN card driver<br />
value4=SJAdirect<br />
Connection details<br />
com1, com2, etc.<br />
38400 etc.<br />
Connection details<br />
E 674-4 GB 9<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
3.3.3 DPRAM Interfacing with a Slot PLC<br />
device=<strong>Kuhnke</strong> DPRam 645-ISA<br />
instance=DPRAM<br />
parameters=0 No connection details<br />
3.3.4 Shared Memory with Soft PLC SP RTE<br />
device=Shared memory (Kernel)<br />
instance=SHMEM<br />
parameters=0 No connection details<br />
E 674-4 GB 10<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
4 Symbol Configuration<br />
Before the symbols of a project can be accessed via <strong>CDSIF</strong>, the CoDeSys<br />
programming system must first generate a symbol file ("project".SDB).<br />
The symbol file is a container for so-called items. An item (data object)<br />
stands for exactly one variable of the control program. Use the items to access<br />
the variable values stored by the controller.<br />
All symbol files are stored in folder %Windows%\Gateway Files where the<br />
gateway will look for them when it starts connecting.<br />
The load generated by reading and writing the variable value does of course<br />
depend on how many items are 'active', i.e. how many items need to be updated<br />
when values are refreshed.<br />
To optimise the time required for cyclic read operations, separate items<br />
should be bundled into structures or arrays which are read in a single cycle.<br />
To make CoDeSys generate a list of variables:<br />
• Run CoDeSys and choose 'Project', ’Options', ’Symbol Configuration’<br />
from the menu and tick option 'Generate symbol entries'.<br />
• Click on ’Configure symbol file’.<br />
All options of the next dialog 'Set object attributes' are selected.<br />
• Remove the tick next to 'Output object variables'.<br />
• Select any variables as appropriate, i.e. module variables, entire modules,<br />
or global variables.<br />
• Tick the box next to 'Output object variables'.<br />
• Click on 'OK' to quit the dialog.<br />
E 674-4 GB 11<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
Enabling option 'Output object variables' is a prerequisite for having the following<br />
options available:<br />
• Output collective entries:<br />
Generates entries allowing structures and arrays of the object to accessing<br />
the whole set of variables.<br />
• Output structure components:<br />
Generates a separate entry for every variable component of the structures<br />
of the object.<br />
• Output field components:<br />
Generates a separate entry for every variable component of the arrays<br />
of the object.<br />
• Write access:<br />
Allows variables of the object to be modified.<br />
E 674-4 GB 12<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
5 Installing the <strong>CDSIF</strong> System<br />
All files of the CoDeSys System Interface, including the Registry entries and<br />
this documentation, are installed by the installer:<br />
Setup_<strong>CDSIF</strong>_Ventura.exe<br />
Following installation and after rebooting the computer, the data exchange<br />
functions are available.<br />
Open <strong>CDSIF</strong>.INI into a text editor to adapt the communication parameters as<br />
appropriate.<br />
E 674-4 GB 13<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
5.1 Installing Add-ons<br />
Before the DPRAM can be used for communication with a slot PLC you must<br />
first install the correct driver.<br />
The installer to use depends on the version of the hardware you have (2k =<br />
old hardware or 8k = up-to-date hardware):<br />
or<br />
SetupDPRamISA2k.exe<br />
SetupDPRamISA8k.exe<br />
E 674-4 GB 14<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6 <strong>CDSIF</strong> System Functions<br />
6.1 General<br />
6.1.1 Version Info<br />
The convention to call the parameters of any function is set to stdcall, i.e.<br />
parameters are transferred from left to right, and the called function disposes<br />
of the stack.<br />
function <strong>CDSIF</strong>_GetVersion(void)<br />
: Unsigned Long;<br />
Returns the version number of <strong>CDSIF</strong>.DLL as a 3-group value packed into a<br />
32-bit value.<br />
e.g. 010402.<br />
6.2 Connecting with/Disconnecting from PLCHandler and Status<br />
6.2.1 Connect<br />
6.2.2 Disconnect<br />
function <strong>CDSIF</strong>_Connect(pDir : PChar; iID : Integer)<br />
: Integer;<br />
Runs the PLCHandler using the settings found in <strong>CDSIF</strong>.INI.<br />
Input parameters:<br />
Parameter Function<br />
pDIR Optional entry specifying the drive and path where<br />
the PLCHandler is to look for <strong>CDSIF</strong>.INI. Example:<br />
'C:\CDS', '' or ‘’ or nil.<br />
If nothing is entered the default WINDOWS folder will<br />
be searched.<br />
iID Identifies the communication channel. The figure<br />
specifies a section of <strong>CDSIF</strong>.INI where the system<br />
will go to get the communication parameters.<br />
Output parameters: -<br />
Values returned:<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
-2 PLCHandler.DLL loaded already.<br />
-3 <strong>CDSIF</strong>.INI not found.<br />
-6 Wrong settings in CDSF.INI.<br />
PLCHandler function: "PLCHandlerInitByFile".<br />
-8 Wrong value (> 16) in iID.<br />
-10 to<br />
-50<br />
Error running a function from PLCHandler.DLL.<br />
DLL stopped and removed from RAM.<br />
function <strong>CDSIF</strong>_Disconnect(iID : Integer)<br />
E 674-4 GB 15<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.2.3 PLCHandler Status<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
Output parameters: -<br />
Values returned:<br />
Value Function<br />
0 O.K. Disconnected successfully, communication channel closed.<br />
-1 Disconnected already.<br />
The status of the PLCHandler can be checked at any time. It indicates the<br />
status of the connection to the PLC.<br />
function <strong>CDSIF</strong>_GetState(iID : Integer)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
Output parameters: -<br />
Values returned:<br />
Va- Define / Description<br />
lue<br />
-2 STATE_PLCHANDLER<br />
PLCHandler not started<br />
-1 STATE_TERMINATE<br />
PLCHandler unloading (destructor)<br />
0 STATE_PLC_NOT_CONNECTED<br />
Controller not connected (initial state)<br />
1 STATE_PLC_CONNECTED<br />
Controller properly connected<br />
2 STATE_NO_SYMBOLS<br />
Controller connected but symbol file not loaded yet<br />
3 STATE_SYMBOLS_LOADED<br />
Controller connected and symbol file loaded<br />
4 STATE_RUNNING<br />
Controller connected, symbol file loaded, all symbols verified. The<br />
PLCHandler object can now be worked with correctly.<br />
5 STATE_DISCONNECT<br />
Disconnecting<br />
6 STATE_NO_CONFIGURATION<br />
Valid configuration not available<br />
7 STATE_PLC_NOT_CONNECTED_SYMBOLS_LOADED<br />
Symbols available for offline use<br />
E 674-4 GB 16<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.3 Synchronous Read<br />
6.3.1 Synchronous Read of Numerical Variables<br />
6.3.2 Reading a Byte<br />
6.3.3 Reading a Word<br />
Several functions are provided for the synchronous reading of numerical variables.<br />
The type of variable to be read (byte, word or long) decides which<br />
function is actually run.<br />
function <strong>CDSIF</strong>_ReadSyncVarByte(iID : Integer;<br />
pVarName : PChar;<br />
var bVal : Byte)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
Output parameters:<br />
Parameter Function<br />
var bVal Variable value (byte)<br />
Values returned:<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
function <strong>CDSIF</strong>_ReadSyncVarWord(iID : Integer;<br />
pVarName : PChar;<br />
var wVal : Word)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
Output parameters:<br />
Parameter Function<br />
var wVal Variable value (word)<br />
Values returned:<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 17<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.3.4 Reading a Long Word<br />
function <strong>CDSIF</strong>_ReadSyncVarLong(iID : Integer;<br />
pVarName : PChar;<br />
var lVal : LongWord)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
Output parameters:<br />
Parameter Function<br />
var lVal Variable value (long word)<br />
Values returned:<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 18<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.4 Synchronous Read of Arrays and Structures<br />
6.4.1 Synchronous Reading of an Array<br />
Use this function to read arrays of byte, word or long variables.<br />
The max. number of elements in an array is 1024 (byte, word or long)!<br />
To be able to read the entire array, enter the name of the array as the name<br />
of the variable, leaving out the index i.e. exactly as it was declared in CoDe-<br />
Sys.<br />
To read a single element, enter the name of the array together with its index.<br />
You cannot read subsets of elements within an array.<br />
function <strong>CDSIF</strong>_ReadSyncArray(iID : Integer;<br />
pVarName : PChar;<br />
pVal : PChar;<br />
ulLen : LongWord)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
pVal Identifies the array to contain the read data.<br />
ulLen Identifies the size of the array in byte, not the number<br />
of elements.<br />
This parameter should be specified as sizeof(Array).<br />
Output parameters:<br />
Values returned:<br />
-<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 19<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.4.2 Synchronous Reading of a String<br />
function <strong>CDSIF</strong>_ReadSyncString(iID : Integer;<br />
pVarName : PChar;<br />
pVal : PChar)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Identifies the name of the string to be read.<br />
Output parameters:<br />
Parameter Function<br />
pVal Identifies the string to contain the read data.<br />
Values returned:<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 20<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.5 Synchronous Write<br />
6.5.1 Synchronous Write of Numerical Variables<br />
6.5.2 Synchronous Writing of a Byte<br />
Several functions are provided for the synchronous writing of numerical variables.<br />
The type of variable (byte, word or long) decides which function is actually<br />
run.<br />
function <strong>CDSIF</strong>_WriteSyncVarByte(iID : Integer;<br />
pVarName : PChar;<br />
bVal : Byte)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
bVal Variable value (byte)<br />
Output parameters:<br />
Values returned:<br />
-<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 21<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.5.3 Synchronous Writing of a Word<br />
function <strong>CDSIF</strong>_WriteSyncVarWord(iID : Integer;<br />
pVarName : PChar;<br />
wVal : Word)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
wVal Variable value (word)<br />
Output parameters:<br />
Values returned:<br />
-<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
6.5.4 Synchronous Writing of a Long Word<br />
function <strong>CDSIF</strong>_WriteSyncVarLong(iID : Integer;<br />
pVarName : PChar;<br />
lVal : LongWord)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
lVal Variable value (long word)<br />
Output parameters:<br />
Values returned:<br />
-<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 22<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.5.5 Synchronous Write of Arrays and Structures<br />
Use this function to write arrays of byte, word or long variables.<br />
The max. number of elements in an array is 1024 (byte, word or long)!<br />
To be able to write the entire array, enter the name of the array as the name<br />
of the variable, leaving out the index, i.e. exactly as it was declared in Co-<br />
DeSys.<br />
To write a single element, enter the name of the array together with its index.<br />
You cannot write subsets of elements within an array.<br />
function <strong>CDSIF</strong>_WriteSyncArray(iID : Integer;<br />
pVarName : PChar;<br />
pVal : PChar;<br />
ulLen : LongWord)<br />
: Integer;<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
pVarName Specifies the name of the variable.<br />
pVal Identifies the array that is to deliver the data.<br />
ulLen Identifies the size of the array in byte, not the number<br />
of elements.<br />
This parameter should be specified as sizeof(Array).<br />
Output parameters:<br />
Values returned:<br />
-<br />
Value Function<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 23<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
6.6 Browsing Variables<br />
6.6.1 Getting the Number of Variables<br />
function <strong>CDSIF</strong>_GetNumberOfSymbols(iID : Integer; var ul-<br />
Symbols : LongWord)<br />
: Integer;<br />
Returns the number of variables that are available.<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
Output parameters:<br />
Parameter Function<br />
ulSymbols Contains the number of variables.<br />
Values returned:<br />
Value Function<br />
-1 Wrong index.<br />
0-16 � Error code, see list of errors<br />
6.6.2 Reading the Names of Variables<br />
function <strong>CDSIF</strong>_GetSymbol(iID : Integer; ulIndex : Long-<br />
Word; pSymbol : PChar)<br />
: Integer;<br />
Returns the name of the variable specified by the index.<br />
Input parameters:<br />
Parameter Function<br />
iID Identifies the communication channel.<br />
ulIndex Index of the variable.<br />
Output parameters:<br />
Parameter Function<br />
pSymbols Contains the number of variables.<br />
Values returned:<br />
Value Function<br />
-1 Wrong index.<br />
0-16 � Error code, see list of errors<br />
E 674-4 GB 24<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
7 Error Codes<br />
7.1 <strong>CDSIF</strong>.DLL Error Codes<br />
There are two different types of error codes, i.e. those generated by the<br />
PLCHandler and those generated by <strong>CDSIF</strong>.<br />
Value Define / Description<br />
0 RESULT_<strong>CDSIF</strong>_OK<br />
Job successfully done<br />
-1 RESULT_FAILED<br />
Action not successful.<br />
Use GetLastError or GetState() to obtain more details about the<br />
error.<br />
-2 RESULT_<strong>CDSIF</strong>_PLCHANDLER<br />
PLCHandler not started<br />
-3 Result of 'Connect' see<br />
Connecting<br />
-5 RESULT_<strong>CDSIF</strong>_TIMEOUT5<br />
Timeout via PLCHandlerGetState<br />
-6 Result of 'Connect' see Connecting<br />
-7 RESULT_<strong>CDSIF</strong>_TIMEOUT7<br />
Timeout via PLCHandlerSyncRead/Write<br />
E 674-4 GB 25<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
7.2 PLCHandlers.DLL Error Codes<br />
Value Define / Description<br />
-1 RESULT_FAILED<br />
Action not successful.<br />
Use GetLastError() or GetState() to obtain more details about<br />
the error.<br />
0 RESULT_OK<br />
Job successfully done<br />
1 RESULT_PLC_NOT_CONNECTED<br />
Controller not connected<br />
2 RESULT_PLC_LOGIN_FAILED<br />
Failure logging into the controller<br />
3 RESULT_PLC_NO_CYCLIC_LIST_DEFINED<br />
No list registered for cyclic operations<br />
4 RESULT_PLCHANDLER_INACTIVE<br />
PLCHandler disabled<br />
5 RESULT_LOADING_SYMBOLS_FAILED<br />
Failure loading the symbols<br />
6 RESULT_ITF_NOT_SUPPORTED<br />
Invalid interface or interface not supported<br />
7 RESULT_COMM_FATAL<br />
Communication error encountered while taking the action<br />
8 RESULT_NO_CONFIGURATION<br />
Wrong PLCHandler configuration or configuration not ok<br />
9 RESULT_INVALID_PARAMETER<br />
Invalid parameters<br />
10 RESULT_ITF_FAILED<br />
Communication interface not or not correctly installed (e.g.<br />
gateway DLLs not available)<br />
11 RESULT_NOT_SUPPORTED<br />
Method not supported or implemented yet<br />
12 RESULT_EXCEPTION<br />
Exception encountered while taking the action<br />
13 RESULT_TIMEOUT<br />
Time-out time exceeded<br />
14 RESULT_STILL_CONNECTED<br />
Controller already connected (and Connect() function is run<br />
again)<br />
15 RESULT_RECONNECTTHREAD_STILL_ACTIVE<br />
Reconnect Thread already enabled<br />
16 RESULT_PLC_NOT_CONNECTED_SYMBOLS_LOADED<br />
Symbols available for offline use<br />
E 674-4 GB 26<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
8 Appendix<br />
8.1 References<br />
Title / Subject Number Source<br />
Ventura IPC 300 / 700<br />
PC-based Controller<br />
E 674<br />
GB<br />
<strong>Kuhnke</strong> GmbH<br />
E 674-4 GB 27<br />
2 Jan 2007
KUHNKE Automation CoDeSys System Interface<br />
8.2 Sales & Service<br />
8.2.1 Main Factory in Malente<br />
8.2.2 Sales Germany<br />
8.2.3 Customer Service<br />
Please visit our Internet site to find a comprehensive overview of our sales<br />
and service network including all the relevant addresses. You are, of course,<br />
always welcome to contact our staff at the main factory in Malente or at<br />
sales headquarters in Neuhausen:<br />
<strong>Kuhnke</strong> Automation GmbH & Co. KG<br />
Lütjenburger Straße 101<br />
D-23714 Malente<br />
Phone +49 (0)4523 402-0<br />
Fax +49 (0)4523 402-247<br />
Email sales@kuhnke.de<br />
Internet www.kuhnke.de<br />
<strong>Kuhnke</strong> Automation GmbH & Co. KG<br />
Stuttgart Branch Office<br />
Strohgäustraße 3<br />
D-73765 Neuhausen<br />
Phone +49 (0)7158 9074-0<br />
Fax +49 (0)7158 9074-80<br />
Email sales@kuhnke.de<br />
Internet www.kuhnke.de<br />
<strong>Kuhnke</strong> Automation GmbH & Co. KG<br />
Lütjenburger Str. 101<br />
D-23714 Malente<br />
Phone +49 (0)4523 402-200<br />
Fax +49 (0)4523 402-201<br />
Email service@kuhnke.de<br />
Internet www.kuhnke.com<br />
E 674-4 GB 28<br />
2 Jan 2007