Accon-Aglink HB en
Accon-Aglink HB en
Accon-Aglink HB en
S7-PB/NetLinkDrv ACCON-AGLink S7-PB/Softing ACCON-AGLink S7-TCP/IP ACCON-AGLink S7-TCP/NetLinkIP ACCON-AGLink S7-PPI serial ACCON-AGLink RK512/3964R ACCON-AGLink S5 serial
Version 10.03.2003 1994 2003 DELTALOGIC Automatisierungstechnik GmbH Post Office Box 70 D-73555 Mutlangen Tel.: (+49)-7171-916-120 Fax: (+49)-7171-62676 Internet: http://www.deltalogic.de Hotline: support@deltalogic.de
Page 2
S7-200, S7-300, S7-400, HMI, STEP and SIMATIC are registered trademarks of Siemens AG, ACCON is a registered trademark of Rainer Hnle, DELTALOGIC is a registered trademark of DELTALOGIC Automatisierungstechnik GmbH.
Seite 3
Preface
The quality of an automation solution depends strongly how far the different levels production control, production planning and quality assurance are integrated. One of the main problems is that production data are recorded by a PLC, but a long-term storage and a meaningful evaluation of these data isn't practicable on the PLC. PCs are excellently suitable for an economical solution of such tasks. You can save very much more data and are able to process these data due to the higher programming languages much more efficiently. Till now, unfortunately, PLC and PC couldn't be coupled program technically so that automation solutions frequently weren't realized optimally. The industrial PLC communication suite helps you. This consists of one single library that extends all common Windows programming languages by the ability to contact SIMATIC controls directly out of the PC and exchange data between PLC and PC in a simple way. You can build up the process data communication traffic from any programming language which can call functions in a 32 bit Windows DLL by handling calling simply manageable, efficient and tested functions. The developer needs no knowledge about the different used communication protocols, he can fully concentrate on the further processing of the data (e.g. by means of a data base). The industrial PLC communication suite offers the following highlights: Up to eight ports can be controlled by one PC at the same time. Via every port several PLCs can be addressed at the same time depending on the protocol and the used hardware. The industrial PLC communication suite is written in high optimized C/C++. For this reason there is very little time needed for the communication. From the industrial PLC communication suite you purchase only one developer version per developer place, no further runtime charges have to be paid. The industrial PLC communication suite is available as 32 bit DLL for Windows. For this the industrial PLC communication suite supports a variety of programming languages enables to you to concentrate on your application and not have to learn additional programming languages . Because of the uniform programming interface you can access the different controls without change of the PLC program. With the enclosed configuration tool all communication parameters can be adjusted without having to program the corresponding dialogues.
With the industrial PLC communication suite you can develop applications that collect a large quantity of process data. You can convert and store it into an arbitrary format. You can carry out meaningful evaluations and configure and steer your process therefore optimally. You can also influence the process in a simple way. For this you overwrite certain data ranges in the PLC memory and change the process parameters. With that e.g. a recipe administration is very simply feasible.
Page 4
Seite 5
1
1 2
Table of contents
Table of contents............................................................................................................. 5 The industrial PLC communication suite.................................................................... 14 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 General 14 The idea behind the industrial PLC communication suite ...................................... 15 License contract ..................................................................................................... 15 Support for ACCON-AGLink .................................................................................. 16 Project support ....................................................................................................... 16 Scope of delivery.................................................................................................... 16 Installation instruction ............................................................................................ 19 Limitations of the demo version ............................................................................. 19 Communication processing in general ................................................................... 19
2.10 Error codes............................................................................................................. 20 2.11 Call convention and structure orientation (alignment)............................................ 20 3 Enclosed programs....................................................................................................... 22 3.1 The configuration program (AGLink_Config.EXE) ................................................. 22 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 General ..................................................................................................... 22 The parameters for ACCON-AGLink S7-MPI serial.................................. 24 The parameters for ACCON-AGLink S7-MPI serial/TS ............................ 26 The parameters for ACCON-AGLink S7-PB/CIF ...................................... 32 The parameters for ACCON-AGLink S7 PB/NetLinkDrv .......................... 34 The parameters for ACCON-AGLink S7 PB/Softing................................. 36 The parameters for ACCON-AGLink S7 TCP/IP ...................................... 38 The parameters for ACCON-AGLink S7 TCP/NetLinkIP .......................... 40 The parameters for ACCON-AGLink S7 PPI serial .................................. 42
3.1.10 The parameters for ACCON-AGLink RK512/3964R................................. 43 3.1.11 The parameters for ACCON-AGLink S5 serial ......................................... 45 3.2 3.3 4 DLL info program (AGLink_Info.EXE) .................................................................... 46 Performance test program (AGLink_Performance.EXE) ....................................... 47
Page 6 4.1
Industrial PLC-Communication Suite First example in Microsoft Visual C/C++ ................................................................ 49 4.1.1 Reading of the diagnosis buffer ................................................................ 52
4.2
Additional hints for VBA ......................................................................................... 53 4.2.1 4.2.2 4.2.3 Remarks to data processing in Excel ....................................................... 54 Hints to the examples in Word and Excel ................................................. 54 The sample programs............................................................................... 55
4.3 5
Programming reference administration ...................................................................... 61 5.1 5.2 Releasing or activating AGLink (AGLActivate)....................................................... 61 Opening and closing of the device ......................................................................... 62 5.2.1 5.2.2 5.3 Opening device (AGLOpenDevice) .......................................................... 62 Closing device (AGLCloseDevice)............................................................ 63
Administration of jobs............................................................................................. 64 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 Setting window message handler (AGLSetWndMsgHandler) .................. 64 Setting thread message handler (AGLSetThrdMsgHandler) .................... 65 Setting event handle (AGLSetEventHandle) ............................................ 66 Installing callback function (AGLSetCallback) .......................................... 67 Waiting for job (AGLWaitForJob).............................................................. 68 Deleting job (AGLDeleteJob) .................................................................... 69 Querying the communication result of a job (AGLGetJobResult) ............. 70
Programming reference communication functions ................................................... 71 6.1 Function reference adapter .................................................................................... 72 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.2 Setting up connection to remote station (AGLDialUp) .............................. 72 Terminating connection to distant terminal (AGLHangUp) ....................... 73 Initializing communication adapter (AGLInitAdapter)................................ 74 Deinitializing communication adapter (AGLExitAdapter) .......................... 75 Querying active bus users (AGLGetLifeList) ............................................ 76 Querying directly attached PLC (AGLGetDirectPLC) ............................... 77
Function reference PLC ......................................................................................... 78 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 Setting up connection to a PLC (AGLPLCConnect) ................................. 78 Setting up connection to a PLC (AGLPLCConnectEx) ............................. 79 Disconnecting connection to a PLC (AGLPLCDisconnect) ...................... 81 Reading MLFB number of the PLC (AGLReadMLFBNr) .......................... 82 Reading extended MLFB number of the PLC (AGLReadMLFBNrEx) ...... 83 Reading AG-Info (AGLReadPLCInfo)...................................................... 85
Seite 7
Reading diagnostic buffer of the PLC (AGLReadDiagBuffer)................... 87 Converting content of diagnostic buffer to text (AGLReadDiagBufferEntry) ...................................................................... 89 Querying operating state of the PLC (AGLReadOpState) ........................ 90
6.2.10 Stopping PLC (AGLPLCStop)................................................................... 91 6.2.11 Executing restart of the PLC (AGLPLCStart)............................................ 92 6.2.12 Executing resume of the PLC (AGLPLCResume) .................................... 93 6.3 Function reference reading data ............................................................................ 94 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.3.8 6.3.9 Reading input bytes (AGLReadInBytes)................................................... 94 Reading peripheral input bytes (AGLReadPInBytes) ............................... 95 Reading output bytes (AGLReadOutBytes).............................................. 96 Reading flag bytes (AGLReadFlagBytes)................................................. 97 Reading special flag bytes (AGLReadSFlagBytes) .................................. 98 Reading variables bytes (AGLReadVarBytes)........................................ 100 Reading data bytes (AGLReadDataBytes) ............................................. 102 Reading timer words (AGLReadTimerWords) ........................................ 103 Reading counter words (AGLReadCounterWords) ................................ 104
6.3.10 Mixed reading job (AGLReadMix)........................................................... 105 6.4 Function reference writing data............................................................................ 107 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 6.4.7 6.4.8 6.4.9 Writing input bytes (AGLWriteInBytes) ................................................... 107 Writing output bytes (AGLWriteOutBytes) .............................................. 108 Writing peripheral output bytes (AGLWritePOutBytes)........................... 109 Writing flag bytes (AGLWriteFlagBytes) ................................................. 110 Writing Special flag bytes (AGLWriteSFlagBytes) .................................. 111 Writing variables bytes (AGLWriteVarBytes) .......................................... 113 Writing data bytes (AGLWriteDataBytes) ............................................... 115 Writing Timer words (AGLWriteTimerWords) ......................................... 116 Writing Counter words (AGLWriteCounterWords) .................................. 117
6.4.10 Mixed writing job (AGLWriteMix) ............................................................ 118 6.5 Functions reference data block information ......................................................... 120 6.5.1 6.5.2 6.5.3 7 Determine number of data blocks (AGLReadDBCount) ......................... 120 Reading data block directory (AGLReadDBList) .................................... 121 Reading length of a data block (AGLReadDBLen) ................................. 122
Programming reference supplementary functions .................................................. 123 7.1 Function reference reading functions................................................................... 123 7.1.1 7.1.2 Reading 16 bit integer from byte buffer (AGLReadInt16) ....................... 123 Reading word from byte buffer (AGLReadWord).................................... 124
Industrial PLC-Communication Suite Reading double word from byte buffer (AGLReadDWord) ..................... 125 Reading floating point number (real) from byte buffer (AGLReadReal) ...................................................................................... 126 Reading S5 time from byte buffer (AGLReadS5Time) ........................... 127
Function reference writing functions ................................................................... 128 7.2.1 7.2.2 7.2.3 7.2.4 Writing word into byte buffer (AGLWriteWord) ....................................... 128 Writing double word into byte buffer (AGLWriteDWord) ......................... 129 Writing floating point number (real) into byte buffer (AGLWriteReal) ..... 130 Writing S5 time into byte buffer (AGLWriteS5Time) ............................... 131
7.3
Function reference buffer convert functions......................................................... 132 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8 Converting byte buffer into word buffer (AGLByte2Word) ...................... 132 Converting byte buffer into double word buffer (AGLByte2DWord)........ 133 Converting byte buffer into floating point number (real) buffer (AGLByte2Real)...................................................................................... 134 Converting word buffer into byte buffer (AGLWord2Byte) ...................... 135 Converting double word buffer into byte buffer (AGLDWord2Byte)........ 136 Converting floating point number (real) buffer into byte buffer (AGLReal2Byte)...................................................................................... 137 Converting string into byte buffer (AGLString2Buff) ............................... 138 Converting byte buffer into string(AGLBuff2String) ................................ 139
7.4
Function reference bit functions ........................................................................... 140 7.4.1 7.4.2 7.4.3 7.4.4 Requesting bit status (AGLGetBit).......................................................... 140 Setting bit on the value one (AGLSetBit) ................................................ 141 Setting bit on the value zero (AGLResetBit) ........................................... 142 Setting bit on value (AGLSetBitVal)........................................................ 143
7.5
Function reference miscellaneous ....................................................................... 144 7.5.1 7.5.2 Finding error text to the corresponding error code (AGLGetErrorMsg).................................................................................. 144 Adjusting time function for result (AGLUseSystemTime)........................ 145
7.6
Function reference DLL info functions ................................................................. 146 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 Determine version number of the DLL (AGLGetDLLVersion)................. 146 Determine extended version number of the DLL (AGLGetDLLVersionEx) ......................................................................... 147 Determine available options of the DLL (AGLGetOptions) ..................... 148 Determine serial number of the DLL (AGLGetSerialNumber) ................ 149 Determine the licensee of the DLL (AGLGetClientName) ...................... 150
Seite 9
Returning an error message (AGLErrMsg) .......................................................... 151 Returning entry from the diagnostic buffer (AGLDiagBufferEntry) ....................... 152
Programming reference configuration functions..................................................... 153 9.1 Functions for reading the parameters from the registry ....................................... 153 9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 9.1.6 9.1.7 9.1.8 9.1.9 Reading the complete device settings (AGLReadDevice)...................... 153 Reading device type (AGLReadDevType).............................................. 154 Reading port parameters S7-MPI serial (AGLReadIFPMPI) .................. 155 Reading port parameters S7-MPI serial/TS (AGLReadIFPTS) .............. 156 Reading location parameters S7-MPI serial/TS (AGLReadLPTS) ......... 157 Reading dial number parameters S7-MPI serial/TS (AGLReadDPTS) .. 158 Reading port parameters S7-PB/CIF (AGLReadIFPCIF) ....................... 159 Reading port parameters S7-PB/NetLinkDrv (AGLReadIFPNLDRV) ..... 160 Reading port parameters S7-PB/Softing (AGLReadIFPSOFTING)........ 161
9.1.10 Reading port parameters S7-TCP/IP (AGLReadIFPTCPIP) .................. 162 9.1.11 Reading port parameters S7-TCP/NetLinkIP (AGLReadIFPNLIP)......... 163 9.1.12 Reading port parameters S7-PPI serial (AGLReadIFPPPI) ................... 164 9.1.13 Reading port parameters RK512/3964R (AGLReadIFPRK)................... 165 9.1.14 Reading port parameters S5 serial (AGLReadIFPS5)............................ 166 9.2 Functions for writing the parameters into the registry .......................................... 167 9.2.1 9.2.2 9.2.3 9.2.4 9.2.5 9.2.6 9.2.7 9.2.8 9.2.9 Writing the complete device settings (AGLWriteDevice) ........................ 167 Writing device type (AGLWriteDevType) ................................................ 168 Writing port parameters S7-MPI serial (AGLWriteIFPMPI)..................... 169 Writing port parameters S7-MPI serial/TS (AGLWriteIFPTS)................. 170 Writing location parameters S7-MPI serial/TS (AGLWriteLPTS)............ 171 Writing dial number parameters S7-MPI serial/TS (AGLWriteDPTS)..... 172 Writing port parameters S7-PB/CIF (AGLWriteIFPCIF).......................... 173 Writing port parameters S7-PB/NetLinkDrv (AGLWriteIFPNLDRV) ....... 174 Writing port parameters S7-PB/Softing (AGLWriteIFPSOFTING) .......... 175
9.2.10 Writing port parameters S7-TCP/IP (AGLWriteIFPTCPIP)..................... 176 9.2.11 Writing port parameters S7-TCP/NetLinkIP (AGLWriteIFPNLIP) ........... 177 9.2.12 Writing port parameters S7-PPI serial (AGLWriteIFPPPI)...................... 178 9.2.13 Writing port parameters RK512/3964R (AGLWriteIFPRK) ..................... 179 9.2.14 Writing port parameters S5 serial (AGLWriteIFPS5) .............................. 180 9.3 Functions for querying the parameters ................................................................ 181 9.3.1 9.3.2 Querying the device type (AGLGetDevType) ......................................... 181 Querying the port parameters for S7-MPI serial (AGLGetIFPMPI)......... 182
Industrial PLC-Communication Suite Querying the port parameters for S7-MPI serial/TS (AGLGetIFPTS)..... 183 Querying the location parameters for S7-MPI serial/TS (AGLGetLPTS) ....................................................................................... 184 Querying the dial number parameters for S7-MPI serial/TS (AGLGetDPTS)....................................................................................... 185 Querying the port parameters for S7-PB/CIF (AGLGetIFPCIF).............. 186 Querying the port parameters for S7-PB/NetLinkDrv (AGLGetIFPNLDRV)............................................................................... 187 Querying the port parameters for S7-PB/Softing (AGLGetIFPSOFTING)........................................................................... 188 Querying the port parameters for S7-TCP/IP (AGLGetIFPTCPIP) ......... 189
9.3.10 Querying the port parameters for S7-TCP/NetLinkIP (AGLGetIFPNLIP)................................................................................... 190 9.3.11 Querying the port parameters for S7-PPI serial (AGLGetIFPPPI).......... 191 9.3.12 Querying the port parameters for RK512/3964R (AGLGetIFPRK) ......... 192 9.3.13 Querying the port parameters for S5 serial (AGLGetIFPS5) .................. 193 9.4 Functions for setting the parameters.................................................................... 194 9.4.1 9.4.2 9.4.3 9.4.4 9.4.5 9.4.6 9.4.7 9.4.8 9.4.9 Setting device type (AGLSetDevType) ................................................... 194 Setting port parameters S7-MPI serial (AGLSetIFPMPI)........................ 195 Setting port parameters S7-MPI serial/TS (AGLSetIFPTS).................... 196 Setting location parameters S7-MPI serial/TS (AGLSetLPTS)............... 197 Setting dial number parameters S7-MPI serial/TS (AGLSetDPTS)........ 198 Setting port parameters S7-PB/CIF (AGLSetIFPCIF)............................. 199 Setting port parameters S7-PB/NetLinkDrv (AGLSetIFPNLDRV) .......... 200 Setting port parameters S7-PB/Softing (AGLSetIFPSOFTING) ............. 201 Setting port parameters S7-TCP/IP (AGLSetIFPTCPIP)........................ 202
9.4.10 Setting port parameters S7-TCP/NetLinkIP (AGLSetIFPNLIP) .............. 203 9.4.11 Setting port parameters S7-PPI serial (AGLSetIFPPPI)......................... 204 9.4.12 Setting port parameters RK512/3964R (AGLSetIFPRK) ........................ 205 9.4.13 Setting port parameters S5 serial (AGLSetIFPS5) ................................. 206 9.5 Additional functions .............................................................................................. 207 9.5.1 Calling external configuration program (AGLConfig) .............................. 207
10 Appendix A 209 10.1 Q&A list for ACCON-AGLink ................................................................................ 209 10.1.1 Whats about the transmission speed of ACCON-AGLink ?................... 209 10.1.2 Do I have to change my program, when I need an additional module? .................................................................................................. 210 10.1.3 When I need e.g. MPI serial and TCP/IP, do I obtain two different DLL versions?......................................................................................... 210
Seite 11
10.1.4 Which advantages offer ACCON-AGLink to me? ................................... 210 10.1.5 What happens when there appear new hardware components, which were not yet supported from my ACCON-AGLink release? ......... 210 10.1.6 Whats about a demo version of ACCON-AGLink? ................................ 210 10.1.7 What is the scope of the demo version of ACCON-AGLink?.................. 211 10.1.8 Do I have to pay runtime charges for programs that are developed with ACCON-AGLink? ............................................................................ 211 10.1.9 Do I need for ACCON-AGLink S7-MPI serial/TS the TS software from Siemens?........................................................................................ 211 10.1.10 What happens when the cable is removed using ACCON-AGLink S7- MPI serial? ....................................................................................... 211 10.1.11 How large can the requested data packets be? ..................................... 211 10.1.12 Can I also read double words with ACCON-AGLink?............................. 211 10.1.13 For accessing the PLC do I have to change the S7 program? ............... 212 10.1.14 Can I access with ACCON-AGLink S7-MPI the PLC also via Profibus? ................................................................................................ 212 10.1.15 What can I do, when the communication via PC adapter is too slow? ... 212 10.1.16 Does every arbitrary Profibus card works with ACCON-AGLink S7PB? ......................................................................................................... 212 10.1.17 How can I access to the S7 with a PC adapter, when the MPI port is occupied from a OP? .............................................................................. 212 10.1.18 How can I access with ACCON-AGLink multiple PLCs simultaneous? ........................................................................................ 212 10.1.19 Can I connect the PPI cable only to one series 200 PLC? ..................... 213 10.1.20 The function AGLPLCConnect of ACCON AGLink S7 TCP/IP is successful, however the reading of the data provides an error code. What's wrong? ........................................................................................ 213 10.1.21 Why appears under Windows 95 an error message during processing a with ACCON-AGLink developed program ? ...................... 213 10.1.22 Why are the device settings not permanently stored under Windows 2000/XP ? ............................................................................................... 213 10.2 Documentation of updates release 2.x................................................................. 215 10.2.1 Release 2.1 ............................................................................................ 215 10.2.2 Release 2.2 ............................................................................................ 215 10.2.3 Release 2.3 ............................................................................................ 216 10.2.4 Release 2.3.1 ......................................................................................... 216 10.2.5 Release 2.4 ............................................................................................ 217 10.3 Documentation of updates release 3.x................................................................. 218 10.3.1 Release 3.0 ............................................................................................ 218 10.3.2 Version 3.1 ............................................................................................. 219 11 Appendix C 222
Page 12
Seite 13
Page 14
2
2.1
The industrial PLC communication suite consists of one single library where all functions of your license are included. The possible communication modules are: 1. 2. 3. 4. 5. 6. 7. 8. 9. ACCON-AGLink S7-MPI serial for the access to the SIMATIC S7 300 and S7 400 via PC adapter ACCON-AGLink S7-MPI serial/TS for the access to the SIMATIC S7 300 and S7 400 via a modem and the TS adapter ACCON-AGLink S7-PB/CIF for the access to the SIMATIC S7 300 and S7 400 via the ACCON-PB/MPI card ACCON-AGLink S7-PB/NetLinkDrv for the access to the SIMATIC S7 300 and S7 400 via the equipment driver of the ACCON-NetLink adapter ACCON-AGLink S7-PB/Softing for the access to the SIMATIC S7 300 and S7 400 via the Profibus boards of the company Softing ACCON-AGLink S7-TCP/IP for the access to the SIMATIC S7 300 and S7 400 via Ethernet ACCON-AGLink S7-TCP/NetLinkIP for the access to the SIMATIC S7 300 and S7 400 via the TCP/IP interface of the ACCON-NetLink adapter ACCON-AGLink S7-PPI serial for the access to the SIMATIC S7 200 ACCON-AGLink RK512/3964R for the RK512/3964 R communication
10. ACCON-AGLink S5 serial for the access to the SIMATIC S5 family The function library has been developed and tested in detail for Windows 98, Windows NT, Windows 2000 and Windows XP. As test programming languages MS Visual C/C++ 6, MS Visual BASIC 6, Borland C++ Builder 5, Delphi 5, NI LabView, MS Excel, MS C# and MS VB.net were used. Examples that clarify the application and make the start easier are provided to the function library. Please contact us if you need the support of the library for further platforms, e.g. MS DOS, Win 3.1 x, Windows CE, RTKernel, RTOS 32 or Linux.
Seite 15
2.2
In the industrial automation surroundings exists different control and therefore also communication standards. If access to different products is required, this means often 1. Search for a communication toolbox supplier 2. Acquisition of a new communication toolbox 3. Training into the contained functions 4. Hoping that the tools of the different manufacturers can be selected from one single program without problems. (Since a serial interface for the communication is often needed, this leads easily to complications.) 5. Adaptation of own programs 6. Administration of different releases This procedure is not only cost, but also time intensive. With the industrial PLC communication suite is now possible to access the different communication drivers with a uniform software interface. For sure, this can also be handled with OPC but not with such a low overhead and the compactness of industrial PLC communication suite. The mode of communication and the communication parameters can be set comfortably with a separate program and also by program code. The currently used communication driver can be used to investigate the run time. Furthermore every communication module still offers additional functions, to address the controls quite specifically. For portable programming it must be checked that for the other modules there must be possible that an error code can be delivered as a function result. With this technique it is possible to modify the interface for the S7 access without program changes or to modify the local access into an access via telephone and modem.
2.3
License contract
With the purchase of the library you have purchased the single, non-exclusive right to develop programs with use of the industrial PLC communication suite and distribute these programs arbitrarily often and without paying further license fees. Every developer who works with the industrial PLC communication suite completely or in parts, need his own license and thats it, further fees don't arise. Excluded from the license fee free disclosure are of course products, which are comparable in any kind with the industrial PLC communication suite (software interface for the access to PLC data, e.g. OPC servers based on the industrial PLC communication suite) or if the products are libraries or development tools. Provided that you have purchased the source code of the industrial PLC communication suite, you only may use this for the integration into your own products. Every disclosure or publication of the source code, the contained protocol documentation or components is forbidden. Also it is not allowed to develop and distribute products that are comparable with the industrial PLC communication suite in the way described above. This is also valid for the adaptation to another platform or another operating system.
Page 16
The complete and detailed license agreement is included in the appendix in chapter 12.1 "software license agreement" on page 221.
2.4
If questions or problems arise when using the industrial PLC communication suite, please consult our technical support. You can contact us either by phone either under (+49)-7171916-112 or preferably by e-mail: support@deltalogic.de. Send us your questions or the problem description with detail of the compiler release, the operating system release and the minimal source text part or even better with the minimal project with which the behavior can be reproduced. You get very quickly support from the developer team of the industrial PLC communication suite. Please check first, if your problem is already solved in the appendix in chapter documentation of updates on page 183 and if a solution is already offered or a new release is available.
2.5
Project support
Contact us if you have a personnel bottleneck or have simply need for competent project support. We offer you to realize economically partial or also complete projects for you with the industrial PLC communication suite according to your wishes and your requests. Contact us, we like to make you an offer without obligation.
2.6
Scope of delivery
The industrial PLC communication suite is delivered on a CD and a diskette. On the CD all base programs, examples and the demo version of the DLL is included. These are in particular: \AGLink_Demo\BCB AGLink.H AGLink.LIB AGLink_Test.BPF AGLink_Test.BPR AGLink_Test.EXE Unit1.CPP include file for C/C++ the ACCON-AGLink import library for Borland C++-Builder Borland C++-Builder module file Borland C++-Builder project file compiled example program ACCON-AGLink demo program as console application
\AGLink_Demo\Delphi AGLink.PAS AGLink_Test.CFG AGLink_Test.DOF module file for Delphi Delphi configuration file Delphi option file
Seite 17
\AGLink_Demo\DotNET \C# \VB.NET Dateien.TXT directory with all examples for C-Sharp directory with all examples for VB.NET additional description of files in the corresponding sub-directories
\AGLink_Demo\VB AGLink.BAS AGParameter.FRM AGParameter.FRX Konfiguration.FRM Konfiguration.FRX MiniDemo.EXE MiniDemo.FRM MiniDemo.VBP MiniDemo.VBW S7CPU.FRM S7CPU.FRX VBDemo.EXE VBDemo.VBP VBDemo.VBW Win32.BAS \Paket module definition file for Visual Basic Visual Basic example file, for setting the PLC parameters (address, operands, etc.) Visual Basic FRX file main format of the example Visual Basic FRX file compiled example program Visual Basic file minimal example Visual Basic project file Visual Basic file format with picture of a S7-300-CPU Visual Basic FRX file compiled example program Visual Basic project file Visual Basic file module definition file with requested Win32API functions directory with installation program for VBDemo (if VB is not installed on the destination computer and you want to execute the example)
\AGLink_Demo\VBA
Industrial PLC-Communication Suite examples for Microsoft Word examples for Microsoft Excel additional explanations formats and modules used for VBA examples
\AGLink_Demo\VC AGLink.H AGLink.LIB AGLink_Test.CPP AGLink_Test.DSP AGLink_Test.DSW AGLink_Test.EXE AGLink_Test.OPT \FirstSteps include file for C/C++ ACCON-AGLink import library for Visual C/C++ ACCON-AGLink demo program as console application VC project file VC workspace compiled example program VC option file examples from the chapter first steps
\AGLink_Redist AGLink.DLL the ACCON-AGLink library (demo version). Replace this file with licensed version of your original floppy disk. configuration program for parameterization of the communication path, similar adapting the PG/PC-interface file with german error message texts file with english error message texts
AGLink_Config.EXE
AGLink_Error.TXT AGLink_Error.ENG
\AGLink_Tools AGLink.H AGLink.LIB AGLink_Info.CPP AGLink_Info.DSP AGLink_Info.EXE include file for C/C++ the ACCON-AGLink import library for Visual C/C++ source code for info program VC project file program to determine the DLL version, the serial number, the license scope and the licensee.
Seite 19
AGLink_Performance.Exe program to determine the communication speed or the data throughput Tools.DSW Tools.NCB Tools.OPT VC workspace VC program data base VC option file
On the floppy disk your find your licensed version of the industrial PLC communication suite in form of your version of the file "AGLink.DLL" . The additional files that you can forward to your customers in the context of the license conditions are on the CD in the directory \AGLink_Redist.
2.7
Installation instruction
You simply copy the CD contents into a directory of your choice, e.g. in C: \AGLink. Copy the files from the directory AGLink_Redist in the selected demo directories. Or you can copy these files in the system directory of Windows (e.g. C:\WINNT\SYSTEM32 for Windows NT or Windows 2000) This path can be located from all demo programs. If necessary reset the ReadOnly file attribute. In the demo DLL of the CD all currently available modules of ACCON-AGLink are contained. The DLL on your floppy disk contains only the modules purchased by you. If you like to test the further modules, then you simply keep the demo DLL. If only you like to work with the modules purchased by you, then you simply copy the file AGLink.DLL of your floppy disk and overwrite every DLL version of the CD. Since Version 3.1 you have the possibility to invoke the Setup program on the CD. You can enter interactively the selected settings and select the corresponding examples for the different programming languages. For the program development you copy the file AGLink.DLL of your floppy disk into your project directory, into the system directory of Windows or into another list in the search path. As a starting point for your application development you can simply use the example programs of your programming language and complete these correspondingly.
2.8
All functions of the complete version are at your disposal in the demo version. Every 5 minutes appears a small indication that you use the demo version of ACCON-AGLink. Further reduction, e.g. amount of handled data, is no longer contained since version 2.3. You can therefore check ACCON-AGLink for all conditions and get a view of the efficiency of this toolbox.
2.9
In this chapter the fundamental processing of a communication sequence is briefly explained. Please find the detailed description of the individual functions as well as the parameters and return values in the reference part of this manual.
Page 20
Select the requested communication path with the program AGLink_Config.EXE. If you like to access a S7 control via a PC or TS adapter, then attach it to the parameterized port and adjust the baud rate at the adapter to 38400 bauds preferably. If you work with an ACCONMPI adapter (with an automatic baud rate recognition), then this is always controlled by ACCON-AGLink with its maximum communication speed. First call the function AGLActivate with your personal account. Then select next the function AGLOpenDevice. It checks whether the requested port exists and is available in the system. For compatibility reasons towards the TS version, please select as next function AGLDialUp. When you do not communicate via modem, the return value of this function is always success. In case of a modem connection, the function tries to dial the remote terminal. Now initialize the communication adapter with the function AGLInitAdapter. In case of a S7 communication, you can query the participants attached at the bus with the function AGLGetLifeList . Or when you communicate via a PC-/ TS adapter query the directly attached PLC with the function AGLGetDirectPLC. You can now build up a connection to the PLC with the function AGLPLCConnect or AGLPLCConnectEx. All functions can now be used to access to the PLC. Disconnect the connection with the function AGLPLCDisconnect. Sign off from the communication hardware with the function AGLExitAdapter. Terminate the modem connection with the function AGLHangUp. Unlock the resources with the function AGLCloseDevice. It is important that after every function Open, DialUp, Init, Connect must be called a function Close, HangUp, Exit, Disconnect.
In Visual Basic standardcall is anyway the default setting for DLL functions. In Delphi the call convention stdcall is listed explicit behind every function declaration. For the data types a byte orientation is adjusted by pragmas in the header file. If possible the structures were arranged that in minimum one word alignment of the individual elements is
Seite 21
possible (among other things because of VB). Where not doable, explicit filler bytes were implemented.
Page 22
3
3.1
Enclosed programs
The configuration program (AGLink_Config.EXE)
3.1.1
General
You can handle the complete parameter and interface setting with the function AGLink_Config.EXE. When you execute this externally and not program-dependent, you can change in case of communication hardware change e.g. from PC adapter to Profibus card, only the setting and your application immediately runs without program changes. The function AGLink_Config.EXE requires only functions of the ACCON-AGLink.DLL, this means that the complete parameter setting is also feasible with your application. Call the program AGLink_Config.EXE.
Seite 23
On the left side you can now select the requested device and adjust the type of the device in the accompanying combo box. In the Tab-Control on the right side there are always shown the configuration selections that match to the type. When you change the settings, the Change-button gets active and you can assign the changes of the chosen device, that means storing in the registry of the PC. If you exit the program with OK, all data sets that don't correspond to the standard setting are stored in the registry. For every device all communication paths are completely adjustable independently of each other. You can switch over the communication channel in the program with the function AGLSetDevType (of course only when the device is not opened) .You also can parameterize e.g. DEVICE 0 for the direct access and DEVICE 1 for the modem access. Depending which device you now used by program control, the access is via the local or the remote adapter. Or you use only DEVICE 0 and let it to your customer's decision, which way he chooses for the current access. Tip: You can also call the configuration program in the program with the function AGLConfig. For this the function must be in the current path. With this you don't have to program all dialogues completely. And you may forward the configuration program of course with your application in the context of the license conditions to your customers.
Page 24
3.1.2
long MPIBaud;
Seite 25
type of parameter (MPI, DP, standard, universal (DP/FMS)) type of connection (PG, OP or others) for possible extensions
} IFPARA_MPI, *LPIFPARA_MPI;
Page 26
3.1.3
Seite 27
The parameters of the pages `Schnittstelle and `Modem correspond to the following structure in C/C++:
typedef struct tagIFPARA_TS { int int int int int PortNr; DataBits; Parity; StopBits; Handshake; // // // // // // // // COM port for modem max. baud rate for modem data bits: 7, 8 parity: AGL_PARITY_NONE, AGL_PARITY_EVEN, AGL_PARITY_ODD stop bits: 1, 2 type of handshake: AGL_HANDSHAKE_HW, AGL_HANDSHAKE_SW, AGL_HANDSHAKE_NONE initialization string 1 for modem, will be checked for error return code initialization string 2 for modem, will be checked for error return code long MaxBaud;
Page 28
char InitModem3[INIT_LEN]; char InitModem4[INIT_LEN]; // //
char DialType;
//
char AutoAnswer;
//
char WaitForDialtone;
//
// // // //
} IFPARA_TS, *LPIFPARA_TS;
Seite 29
The parameters of the pages `Standort correspond to the following structure in C/C++:
typedef struct tagLOCPARA_TS { char OwnNoCountry[PHONENO_LEN]; // own country code without international prefix, e.g. 49 for Germany, 41 for Switzerland ... own city code, e.g. 0711 for Stuttgart, 07171 for Mutlangen ... own calling number, e.g. 916100 for DELTALOGIC GmbH exchange connection for international connections
// //
// exchange connection for national connections // exchange connection for local connections
Page 30
} LOCPARA_TS, *LPLOCPARA_TS;
The parameters of the pages ` Rufnummer correspond to the following structure in C/C++:
typedef struct tagDPARA_TS { char CallNoCountry[PHONENO_LEN];// char CallNoCity[PHONENO_LEN]; char CallNoLocal[PHONENO_LEN]; char User[PHONENO_LEN]; char Password[PHONENO_LEN]; } DPARA_TS, *LPDPARA_TS; // // // // country code of the destination number without international prefix city code of the destination number calling number of the destination number user code for calling to an adapter (8 byte data information!) password for calling to an adapter (8 byte data information!)
Seite 31
Page 32
3.1.4
long MPIBaud;
Seite 33
} IFPARA_CIF, *LPIFPARA_CIF;
Page 34
3.1.5
long MPIBaud;
Seite 35
} IFPARA_NL_DRV, *LPIFPARA_NL_DRV;
Page 36
3.1.6
long MPIBaud;
Seite 37
} IFPARA_SOFTING, *LPIFPARA_SOFTING;
Page 38
3.1.7
} PLCDEF, *LPPLCDEF;
Seite 39
for lifelist etc. for accessing with "regular" PLC number for future extensions
} IFPARA_TCPIP, *LPIFPARA_TCPIP;
Page 40
3.1.8
long MPIBaud;
Seite 41
} IFPARA_NL_IP, *LPIFPARA_NL_IP;
Page 42
3.1.9
} IFPARA_PPI, *LPIFPARA_PPI;
Seite 43
3.1.10
Page 44
int KMBit; //
} IFPARA_RK, *LPIFPARA_RK;
Seite 45
3.1.11
} IFPARA_S5, *LPIFPARA_S5;
Page 46
3.2
You simply call AGLink_Info to get information about the present ACCON-AGLink DLL. The version, the license number, the licensee and the scope of the license are returned. AGLink_Info loads the ACCON-AGLink DLL dynamically to be able to handle all versions of the DLL. The DLL is searched in the current directory or in the current path. With the demo version of the DLL you receive the following output:
AGLink_Info is delivered completely as C/C++ source code for Microsoft C/C++ and serves as a further example.
Seite 47
3.3
Simply call AGLink_Performance to check the data throughput of the selected connection. Therefore the attached PLCs are determined with the function AGLGetLifeList, then per PLC the number of data blocks and then the largest data block in the PLC. This is used for the tests. It is purpose of this program to be able to compare the individual communication channels objectively. In addition, you can check with the response, whether the selected type of connection meets your requirements or whether you should use another hardware. For the tests package sizes of 2, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000 and 50000 bytes were used per transmission, when the selected DB has the corresponding length.
You can indicate the following command line parameters: -An -Dn -Pn Indicating number of runs per packet size. -A100 uses 100 runs per packet size. If this option isn't indicated, 10 runs are used. Indicating the number of the device to be used. D2 used device 2 instead of device 0 (standard). Indicating the number of the PLC to be used. Per default AGLGetLifeList tries to determine all attached PLC and test the performance of all one after each other. You use this parameter if you want to measure only a certain PLC. Carrying out not only reading test but also writing test. NOTICE: the data of the used DBs are overwritten! Use this parameter with caution.
-W+
AGLink_Performance is delivered completely as C/C++ source code for Microsoft C/C++ and serves as a further example.
Seite 49
4 First steps
In this chapter the fundamental procedure is introduced for creating an example program with ACCON-AGLink briefly. Start the enclosed program "AGLink_Config.EXE" and adjust the DEVICE 0 according to the hardware used by you. Copy the needed files according to your used compiler into the selected project directory. In the case of Microsoft C/C++ these are the files AGLink.H and AGLink.Lib from the directory AGLink_Demo/VC. The files AGLink.DLL, AGLink_Error.TXT, AGLink_Error.ENG and AGLink_Config.EXE from the directory AGLink_Redist can be stored in the project directory or in the Windows system directory.
4.1
On account of the simplicity we create a small console application. You start Microsoft Visual C/C++. You select with file/new in the Tab-Control in the folder projects the entry Win32console application. Enter the project name Test1 and the path/directory. Confirm with OK. Now you select an empty project. Insert with file/new a C++ source code file with the name Test1. Insert with the menu project/settings in the Tab-Control Linker the library AGLink.Lib in the entry field object-/ library modules. Then enter the program as follows:
// // attachment of header files // #define WIN32_LEAN_AND_MEAN #define STRICT #include <windows.h> #include <stdio.h> #include <conio.h> #include "AGLink.H" // // definition of constants // #define DEV_NR 0 #define WAIT_FLAG true #define PLC_NR 2 // // returning of an error code // void ShowError( int ErrNr, char *Func ) { char Fehler[128]; AGLGetErrorMsg( ErrNr, Fehler, sizeof( Fehler ) ); printf( "Fehler %d (%s) bei %s\n", ErrNr, Fehler, Func );
// // definition of the main function // int __cdecl main() { int RetVal; // // step 1: Activating of ACCON-AGLink with your personal activate key
Page 50
// AGLActivate( "123456-1234-123456" );
// // step 2: Opening the device // if( (RetVal = AGLOpenDevice( DEV_NR )) == AGL_SUCCESS ) { printf( "device successfully opened\n" ); // // step 3: dialing up the connection if necessary // if( (RetVal = AGLDialUp( DEV_NR, WAIT_FLAG )) == AGL_SUCCESS ) { printf( "DialUp successfully processed\n" ); // // step 4: initialize the used communication adapter // if( (RetVal = AGLInitAdapter( DEV_NR, WAIT_FLAG )) == AGL_SUCCESS ) { printf( "adapter successfully initialized\n" ); // // step 5: Connecting to the selected plc // if( (RetVal = AGLPLCConnect( DEV_NR, PLC_NR, WAIT_FLAG )) == AGL_SUCCESS ) { printf( "connection to the plc\n", PLC_NR ); // // step 6: from now on all reading, writing and information functions. // can be used //
} else { ShowError( RetVal, "AGLDialUp" ); } // // step 10: closing the device // AGLCloseDevice( DEV_NR );
} else { ShowError( RetVal, "AGLInitAdapter" ); } // // step 9: hanging up the dial connection if necessary // AGLHangUp( DEV_NR, WAIT_FLAG );
} else { ShowError( RetVal, "AGLPLCConnect" ); } // // step 8: de-initializing the used communication adapter // AGLExitAdapter( DEV_NR, WAIT_FLAG );
// // step 7: disconnecting from the selected plc // AGLPLCDisconnect( DEV_NR, PLC_NR, WAIT_FLAG );
Seite 51
} // // Still waiting for the keystroke so that the soft copy on the screen remains unchanged // printf( "please push an arbitrary button..." ); getch(); return( 0 ); }
Now you compile and start the program. You get the following information at the screen:
Page 52
4.1.1
);
AGLReadDiagBufferEntry( i, &DiagBuff, Buff1, sizeof( Buff1 ) ); #if defined( _CONSOLE ) CharToOem( Buff1, Buff1 ); // is necessary for console // applications because of umlauts #endif printf( "%3d: %s\n", i+1, Buff2 ); } } else { ShowError( RetVal, "AGLReadDiagBuffer" ); }
Now you compile and start the program. You get the following information at the screen:
Seite 53
4.2
By preference all modules and UserForms should be provided with the following entries.
Option Explicit ' variables must be declared
With this entry you get while you enter the program code the information which variables are not yet declared. To switch off the demo-information window, you must replace the demo AGLink.DLL with your licensed AGLink.DLL. To enable the activation of your activation key you must call the function AGLActivate("12345-1234-12345") as first AGLink function and enter your activation code. For dialing up a connection it is recommended to follow the following steps: Run the following functions to determine the participants on the bus:
AGLOpenDevice(DevNr) AGLDialUp(DevNr, boWait) AGLInitAdapter(DevNr, boWait) AGLGetLifeList(DevNr, List(0), boWait) AGLExitAdapter(DevNr, boWait) AGLHangUp(DevNr, boWait) AGLCloseDevice(DevNr)
Use one of the plc numbers from the determined participants "List()". Run the following functions to process the data of the S7:
AGLOpenDevice(DevNr) AGLDialUp(DevNr, boWait) AGLInitAdapter(DevNr, boWait) AGLPLCConnect(DevNr, PLCNr, boWait)
. At his point you can insert the functions to read and write the data of the S7 .
AGLPLCDisconnect(DevNr, PLCNr, boWait) AGLExitAdapter(DevNr, boWait)
Page 54
AGLHangUp(DevNr, boWait) AGLCloseDevice(DevNr)
4.2.1
Writing data from a variable into a cell: "Daten" is a variable that is returned from AGLink.
Range("B1").Value = Daten
or
Cells(1,2).Value = Daten
When you dont want to write into the currently active table, the selected table object is proceeded.
Sheets("Tabelle1").Range("B1").Value = Daten
or
Worksheets(1).Cells(1,2).Value = Daten
4.2.2
The files AGLink.DLL, AGL_Error.TXT and AGLink_Config.exe should be copied in the directory "System32" (Windows 98 -> directory:"System"). All examples are modular designed. It is always used a similar form: UserForm1 a dialog field to connect to the PLC. The communication parameters can be changed with the button "settings".
The following 3 modules are always used: AGLink Error handling: AGData declaration of all AGLink functions. the sub which returns the error message in a MsgBox. in this module are all functions that read or write data of the S7 after a successful dial up of a connection.
Seite 55
The modules and forms are in the directory "Module+Forms" and can be used by importing in new applications. To be able to read data of VBA cyclically, a timer was used from the Windows "user32" directory.
4.2.3
Examples in Excel syntax Bits lesen.xls The sample shows how the status of single bits of a flag byte appear in an Excel sheet.
Byte Word Real lesen.xls The sample shows how words, double words and reals (floating point numbers) are converted from a flag byte buffer. Byte Word Real schreiben.xls The sample shows how a word value, double word value and real value (floating point numerical value) are written into a 10 bytes flag byte buffer. Bytes schreiben.xls Datenbausteine.xls The sample shows how data of a S7 plc can be changed by entering byte values into an Excel table. The sample shows how the existing data blocks are determined. It also determines the length of these data blocks and how the data can be inserted into an Excel table and presented in a diagram. The sample shows how the values of flag bytes can be read cyclically. At the same time the values are represented in a diagram and are permanently updated.
MerkerTimer.xls
MerkerTimerZyklen.xls This sample shoes how you write 10 values of a flag byte in an interval of 250 ms into an excel table and present as diagram. The course of time of data can be presented. Operanden gemischt lesen.xls This sample shows how you can use the function "AGLReadMix". With this function you can read different operand types (e.g. flags, input bytes, timer..) from one array (data buffer). This function enables also to select the size of the operands. For this you can read together in one reading job e.g. flag bits, timer words and data bytes from selected data blocks. You have a very efficient possibility to read different S7 data. S7CPU.xls This sample shows how Excel can be used to design with VBA operating devices and display elements. After successful connection set-up a S7 plc is shown on a form. At this virtual plc you can handle buttons, which write and show single bits of selected bytes. Also you can start and stop your plc by touch on the button. You have the possibility of using this sample to be able to renounce the programming of the connection set-up and connection hang-up. You can save time at the development of your application. You merely still must insert your selected function in the module "AGDaten" and achieve easily your target.
Vorlage.xls
You have the possibility of using this sample to be able to renounce the programming of the connection set-up and connection hang-up. You can save time at the development of your application. You merely still
Page 56
Industrial PLC-Communication Suite must insert your selected function in the module "AGDaten" and achieve easily your target.
AGLinkWord.doc
The example shows how you can insert with the help of an input menu selected details or data of the S7 in your Word document. The communication parameters will be adjusted and checked by pressing the button "Settings" .
Seite 57
4.3
In the directory \AGLink_Demo\DotNET are stored several example projects for .NET. The demo examples contain some suggestions and examples how access to a S7 can be realized with the functions of ACCON-AGLink. All examples exist in the programming languages C# and VB.NET. The project files are created with Microsoft Visual studio .NET 2002. All examples require that all components of ACCON_AGLink are available and can be accessed. I.e. either the files AGLink.dll, AGLink_Config.exe and AGLink_Error.txt must be in the directory of the respective application or else better in a directory of the path. The easiest way is to copy the files in the Windows system directory, for NT/2000/XP this is in general C:\Windows\System32, for 9x/Me this is in general C:\Windows\System. Furthermore it is necessary that the customization layer AGLDotNet.dll is available in both, in the Global Assembly cache of the .NET framework (in general C:\ Windows\assembly), as also in the directory of the managed assemblies of the Microsoft Visual Studio .NET (in general C:\programs\Microsoft Visual studio .NET/Common7/IDE/PublicAssemblies). When developing own applications you must pay attention that a reference to the AGLDotNet.dll is included in the project. It functions as interface between your project and the AGLink.dll. The Namespace Accon is contained with the class AGL that contains most functions of ACCON-AGLink with a call interface for .NET. The activation of a licensed AGLink.dll is done with the function Accon.AGL.Activate that is included in all demos and works also with the demo version. As parameter the enclosed key must be entered, the value "123456-1234-123456" serves as specification value for the demo version. The function Accon.AGL.Activate only must be called once for the program start. Caution: Using a licensed AGLink.dll you must replace the key "123456-1234-123456" in all demos by the enclosed key. In addition you must replace the AGLink.dll by your licensed DLL. The directories C# and VB.NET include the following sub-directories:
ErsterSchritt ByteoperandenLesen ByteoperandenSchreiben connection dial-up and hang-up (incl. Error handling) Reading different byte operands Writing different byte operands
ByteoperandenLesenAsynchron Reading byte operands in asynchronous mode ByteblockLesen BitsLesen BitsSetzen ReadMix WriteMix ReadMixAsynchron Reading a byte block with multiple operands Shows the read access to single bits Shows the write access to single bits Multiple operands in one reading job Multiple operands in one writing job Multiple operands in one asynchronous reading job
Page 58
KonfigurationS7-MPI
All example projects are stored as executable program in the sub-directory "bin\Debug" (for C#) and "bin" (for VB.NET) and can be executed directly. ErsterSchritt A simple example about connection dial-up and connection hang-up incl. error handling. ByteoperandenLesen Reading single bytes (words for counters and timers) of the different operand types. ByteoperandenSchreiben Writing single bytes (words for counters and timers) of the different operand types. ByteoperandenLesenAsynchron Reading single bytes (words for counters and timers) of the different operand types in asynchronous modus (background mode) ByteblockLesen Reading a byte block (10 flag bytes) that contains different values. With the corresponding auxiliary functions will the single values of the byte block extracted, a word in fixed-point format, a double word in floating-point format and a double word in floating-point format. BitsLesen Shows the read access to single bits. For this the input byte is read and the single bit values are determined. BitsSetzen Shows the write access to single bits. For this the bits are inserted one by one into a byte value and written afterwards in an output byte. ReadMix Multiple different operands are read in one job. WriteMix Multiple different operands are written in one job. ReadMixAsynchron Multiple different operands are read in asynchronous modus (background mode).
Seite 59
It is shown how an own setting dialog for the configuration can be built up instead of the use of AGLConfig or AGLink_Config.exe.
Page 60
Seite 61
5
5.1
This function activates the functionality of your acquired ACCON-AGLink DLL. It only must be called once at the program start with the enclosed activate key. This ensures that the ACCON-AGLink DLL delivered from you with your applications can only be used by you. C/C++ syntax:
void AGLINK_API AGLActivate( char *Key );
Delphi syntax:
procedure AGLActivate( Key: PChar ); stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Key Return value: no return value activate key of your license
Page 62
5.2
5.2.1
This function opens the requested device for the later use. Thereby is the memory allocated, according to the selected settings, and the protocol thread is started. C/C++ syntax:
int AGLINK_API AGLOpenDevice( int DevNr );
Delphi syntax:
function AGLOpenDevice( DevNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device to be opened (0 ... 7)
Seite 63
5.2.2
This function closes the requested device. Thereby the protocol thread is finished and the allocated memory is set free. C/C++ syntax:
int AGLINK_API AGLCloseDevice( int DevNr );
Delphi syntax:
function AGLCloseDevice( DevNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device to be closed (0 ... 7)
Page 64
5.3
Administration of jobs
If the communication functions are called with boWait == false, then the function returns immediately. The complete communication is carried out asynchronously, that means in the background, to your application. When the return value is >= 0, it corresponds to the internal job number. With this job number you can check the status of the job, interrupt the job (provided that it isn't already in processing) or install a message handler. If the return value is < 0, then this is a error. For the functions AGLSetWndMsgHandler, AGLSetThrdMsgHandler, AGLSetEventHandle and AGLSetCallback you also can submit the constant DEVICE_MSG instead of a job number. You then receive automatically a message from every finished job of the device without having to install a handler for every job explicitly. If you use an event, it is to take into account that this should be defined as auto reset. Or you must call ResetEvent in your program with every processing.
5.3.1
With this function you give ACCON-AGLink the information which message your application shall be sent when the selected job is processed or interrupted. The message provides in the parameter wParam the job number. The parameter lParam is a pointer to the result structure RESULT which contains the communication status, if necessary the communication error and date/time information. C/C++ syntax:
int AGLINK_API AGLSetWndMsgHandler( int DevNr, int JobNr, HWND hWnd, UINT message );
Delphi syntax:
function AGLSetWndMsgHandler( DevNr, JobNr, hWnd, Msg: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr hwnd message Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call handle of the window where the message is to be sent message number to be sent
Seite 65
5.3.2
With this function you give ACCON-AGLink the information which message your application shall be sent when the selected job is processed or interrupted. The message provides in the parameter wParam the job number. The parameter lParam is a pointer to the result structure RESULT which contains the communication status, if necessary the communication error and date/time information. C/C++ syntax:
int AGLINK_API AGLSetThrdMsgHandler( int DevNr, int JobNr, DWORD ThreadID, UINT message );
Delphi syntax:
function AGLSetThrdMsgHandler( DevNr, JobNr, ThreadID, Msg: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr ThreadID message Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call ID of the thread where the message is to be sent Message number to be sent
Page 66
5.3.3
With this function you give ACCON-AGLink the information which event shall be indicated when the selected job order is processed or interrupted. The event is created by a call to CreateEvent. You can query with the job number the result of the communication (see AGLGetJobResult). This method is excellently suitable for the synchronization with the functions WaitForSingleObject or WaitForMultipleObjects. C/C++ syntax:
int AGLINK_API AGLSetEventHandle( int DevNr, int JobNr, HANDLE hEvent );
Delphi syntax:
function AGLSetEventHandle( DevNr, JobNr, hEvent: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr hEvent Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call handle of event to be set when the job ends
Seite 67
5.3.4
With this function you give ACCON-AGLink the information which callback function shall be started when the selected job is processed or interrupted. The function gets as parameter the job number and a pointer to the result structure. Therefore you should install for every opened device an own callback function. NOTICE: The callback function is called completely asynchronously out of the communication thread that runs with a higher priority. Keep the callback function as short as possible and return as fast as possible. This function is only for experts! C/C++ syntax:
int AGLINK_API AGLSetCallback( int DevNr, int JobNr, CALLBACK_FUNC Func );
Delphi syntax:
function AGLSetCallback( DevNr, JobNr, Func: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr Func Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call pointer to the callback function
Page 68
5.3.5
With this function you wait for the end of an asynchronously started job. The function returns automatically the error code of the communication. C/C++ syntax:
int AGLINK_API AGLWaitForJob( int DevNr, int JobNr );
Delphi syntax:
function AGLWaitForJob( DevNr, JobNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call
Seite 69
5.3.6
This function deletes the job with the requested number from the job-processing queue. C/C++ syntax:
int AGLINK_API AGLDeleteJob( int DevNr, int JobNr );
Delphi syntax:
function AGLDeleteJob( DevNr, JobNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call
Page 70
5.3.7
Delphi syntax:
function AGLGetJobResult( DevNr, JobNr: Long; var pR: Result ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr JobNr pR Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of the job from the asynchronous call pointer to result structure
Seite 71
Page 72
6.1
6.1.1
This function dials the remote station if the device type is AGL_DEVTYPE_TS. In all other cases the function returns with OK and for compatibility reasons can always be called after the function AGLOpenDevice and before the function AGLInitAdapter. C/C++ syntax:
int AGLINK_API AGLDialUp( int DevNr, int boWait );
Delphi syntax:
function AGLDialUp( DevNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) flag whether to wait
Seite 73
6.1.2
This function terminates the connection with the distant terminal if the device type is AGL_DEVTYPE_TS. In all other cases the function returns with OK and for compatibility reasons can always be called after the function AGLExitAdapter and before the function AGLCloseDevice. C/C++ syntax:
int AGLINK_API AGLHangUp( int DevNr, int boWait );
Delphi syntax:
function AGLHangUp( DevNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) flag whether to wait
Page 74
6.1.3
This function initializes the communication adapter with the selected values. C/C++ syntax:
int AGLINK_API AGLInitAdapter( int DevNr, int boWait );
Delphi syntax:
function AGLInitAdapter( DevNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) flag whether to wait
Seite 75
6.1.4
This function cancels the connection to the communication adapter. C/C++ syntax:
int AGLINK_API AGLExitAdapter( int DevNr, int boWait );
Delphi syntax:
function AGLExitAdapter( DevNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) flag whether to wait
Page 76
6.1.5
This function determines with an access to the S7 controls the active participants at the MPI. In list[0] is the number of active participants at the bus returned, starting with list[1] the addresses of the active participants are listed. C/C++ syntax:
int AGLINK_API AGLGetLifeList( int DevNr, PBYTE List, int boWait );
Delphi syntax:
function AGLGetLifeList( DevNr: Long; var List: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr List boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) array for participants, must have at least a size 128 bytes flag whether to wait
Seite 77
6.1.6
This function determines with an access to the S7 controls via PC or TS adapter the directly attached PLC. When you access via the ACCON-PB/MPI card, ACCON-NetLink, a Softing Profibus card, the ACCON-PPI cable or via TCP/IP to the S7 controls, the directly attached PLC cannot be determined. Despite an error-free job processing you get as PLC number the default return value 255. Notice: This function returns only for the modules ACCON-AGLink S7 MPI serial and ACCON-AGLink S7 MPI serial/TS valid values for the directly attached PLC. For all other modules the return value is 255. C/C++ syntax:
int AGLINK_API AGLGetDirectPLC( int DevNr, PBYTE pPlcNr, int boWait );
Delphi syntax:
function AGLGetDirectPLC( DevNr: Long; var pPlcNr: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr pPlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) variable for PLC number flag whether to wait
Page 78
6.2
6.2.1
With this function you set up a connection to a PLC. By multiple call of this function with different PLC numbers you can open several active connections at the same time. The maximum number of simultaneous connections per device is restricted to eight in the communication driver. It may be possible that the used communication hardware supports only less simultaneous connections. Every connection set up with AGLPLCConnect must be disconnected with the function AGLPLCDisconnect. C/C++ syntax:
int AGLINK_API AGLPLCConnect( int DevNr, int PlcNr, int boWait );
Delphi syntax:
function AGLPLCConnect( DevNr, PlcNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC flag whether to wait
Seite 79
6.2.2
With this function you set up a connection to a PLC. By multiple call of this function with different PLC numbers you can open several active connections at the same time. The maximum number of simultaneous connections per device is restricted to eight in the communication driver. It may be possible that the used communication hardware supports only less simultaneous connections. Every connection set up with AGLPLCConnectEx must be disconnected with the function AGLPLCDisconnect. This function differs from the function AGLPLCConnect that you can set the rack and the slot number of the selected CPU. This is for example necessary when you want to access with a CP 342-5 to a S7 control. Normally in this case the rack number is 0 and the slot number 2. Please select the exact values from your hardware configuration. You can easily check whether you built up the connection to the right CPU when you check directly after AGLPLCConnect or AGLPLCConnectEx the function AGLReadMLFBNr. Then compare the MLFB number with the selected control. C/C++-Syntax:
int AGLINK_API AGLPLCConnectEx( int DevNr, int PlcNr, int RackNr, int SlotNr, int boWait );
Visual Basic-Syntax:
Declare Function AGLPLCConnectEx Lib "AGLink.DLL" (ByVal DevNr As Long, ByVal PLCNr As Long, ByVal RackNr As Long, ByVal SlotNr as Long, ByVal boWait As Long) As Long
Delphi-Syntax:
function AGLPLCConnectEx( DevNr, PlcNr, RackNr, SlotNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr RackNr SlotNr boWait number of device (0 ... 7) number of selected PLC rack number of selected PLC slot number of selected PLC flag whether to wait
number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Seite 81
6.2.3
This function cancels the connection set up with the function AGLPLCConnect. C/C++ syntax:
int AGLINK_API AGLPLCDisconnect( int DevNr, int PlcNr, int boWait );
Delphi syntax:
function AGLPLCDisconnect( DevNr, PlcNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC flag whether to wait
Page 82
6.2.4
This function determines the MLFB number for the PLC with the selected device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadMLFBNr( int DevNr, int PlcNr, LPMLFB MLFBNr, int boWait );
Delphi syntax:
function AGLReadMLFBNr( DevNr, PlcNr: Long; var MLFBNr: MLFBT; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr MLFBNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to MLFB number (string of 21 bytes) flag whether to wait
Seite 83
6.2.5
This function determines the MLFB number and the version numbers for the PLC with the selected device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadMLFBNrEx( int DevNr, int PlcNr, LPMLFBEX MLFBNr, int boWait );
Delphi syntax:
function AGLReadMLFBNrEx( DevNr, PlcNr: Long; var MLFBNr: MLFBEX; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr MLFBNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to MLFB number + releases flag whether to wait
Page 84
BYTE MLFB[21]; //
} MLFBEX, *LPMLFBEX;
Seite 85
6.2.6
You can query with this function how many inputs, outputs, flags, timer and counter the attached CPU has. To this PLC must already be established a connection. Notice: This function is not implemented for ACCON-AGLink S7 PPI serial and returns the value FUNC_NOT_SUPPORTED. C/C++ syntax:
int AGLINK_API AGLReadPLCInfo( int DevNr, int PlcNr, LPPLCINFO PLCInfo, int boWait );
Delphi syntax:
function AGLReadPLCInfo( DevNr, PlcNr: Long; var PLCInfo: PLCINFO; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr PLCInfo boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC buffer for maximal values flag whether to wait
number of input bytes number of output bytes number of flag bytes number of timer words number of counter words size of logical address space size of localdata storage
Seite 87
6.2.7
This function reads the diagnostic buffer of the PLC with the selected number. To this PLC must already be established a connection. The number of read diagnostic buffer entries is listed after the reading in the structure variable EntrysRead. The transition of the read binary content in plain text is carried out from the function AGLReadDiagBufferEntry. Invoke this function with the index from 0 to EntryRead-1. Other values are not valid and return and error message. C/C++-Syntax:
int AGLINK_API AGLReadDiagBuffer( int DevNr, int PlcNr, LPDIAGBUFF pDiagBuff, int boWait );
Visual Basic-Syntax:
Declare Function AGLReadDiagBuffer Lib "AGLink.DLL" (ByVal DevNr As Long, ByVal PLCNr As Long, pDiagBuff As DIAGBUFF, ByVal boWait As Long) As Long
Delphi-Syntax:
function AGLReadDiagBuffer( DevNr, PlcNr: Long; var pDiagBuff: DIAGBUFF; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr pDiagBuff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (s. AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to DIAGBUFF structure flag whether to wait
Page 88
{ int EntrysRead; BYTE Buff[2400]; } DIAGBUFF, *LPDIAGBUFF; // //
Seite 89
6.2.8
This function converts the content of the diagnostic buffer line by line to plain text Invoke this function with the index from 0 to EntryRead-1. Other values are not valid and return and error message. C/C++-Syntax:
int AGLINK_API AGLReadDiagBufferEntry( int Index, LPDIAGBUFF pDiagBuff, LPSTR Text, int TextLen );
Visual Basic-Syntax:
Declare Function AGLReadDiagBufferEntry Lib "AGLink.DLL" (ByVal Index As Long, pDiagBuff As DIAGBUFF, ByVal Text As String, ByVal TextLen as Long) As Long
Delphi-Syntax:
function AGLReadDiagBufferEntry( Index: Long; var pDiagBuff: DIAGBUFF; Text: Pchar; TextLen: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Index pDiagBuff Text TextLen Return values: The length of the diagnostic buffer message. Index of the selected diagnostic buffer entry pointer to DIAGBUFF-structure pointer to text string maximal length of the string
Page 90
6.2.9
With this function you can query the current operating state of the PLC. To this PLC must already be established a connection. In OpState the current operating state is returned. This can be the following constants: OPSTATE_STOP, OPSTATE_START, OPSTATE_RUN and OPSTATE_UNKNOWN. C/C++ syntax:
int AGLINK_API AGLReadOpState( int DevNr, int PlcNr, int *OpState, int boWait );
Delphi syntax:
function AGLReadOpState( DevNr, PlcNr: Long; var OpState: Long; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr OpState boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to operating status flag whether to wait
Seite 91
Delphi syntax:
function AGLPLCStop( DevNr, PlcNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC flag whether to wait
Page 92
6.2.11
With this function you can move the PLC to the status Run. A restart is done. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLPLCStart( int DevNr, int PlcNr, int boWait );
Delphi syntax:
function AGLPLCStart( DevNr, PlcNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC flag whether to wait
Seite 93
6.2.12
With this function you can move the PLC to the status Run. A resume is done. This function can not be executed at all controls and in all PLC parameter settings and therefore can provide an error. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLPLCResume( int DevNr, int PlcNr, int boWait );
Delphi syntax:
function AGLPLCResume( DevNr, PlcNr, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC flag whether to wait
Page 94
6.3
6.3.1
With this function you read the input bytes from the process image for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadInBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadInBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Seite 95
6.3.2
With this function you read the peripheral input bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadPInBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadPInBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Page 96
6.3.3
With this function you read the output bytes from the process image for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadOutBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadOutBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Seite 97
6.3.4
With this function you read the flag bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadFlagBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadFlagBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Page 98
6.3.5
With this function you read the special flag bytes for the PLC of the 200 series with the requested device number. To this PLC must already be established a connection. As an alternative to this function you can access for these PLCs to the flags starting with 256. This is internally mapped to the special flags. You can keep your programs hardwareindependently. Notice: This function is only implemented in ACCON-AGLink S7-PPI serial and otherwise returns the value FUNC_NOT_SUPPORTED. C/C++ syntax:
int AGLINK_API AGLReadSFlagBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadSFlagBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Start Num Buff boWait number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Seite 99
number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Page 100
6.3.6
With this function you read the variables bytes for the PLC of the 200 series with the requested device number. To this PLC must already be established a connection. As an alternative to this function you can access for these PLCs to the DB 1. This is internally mapped to the variables. You can keep your programs hardware-independently. Notice: This function is only implemented in ACCON-AGLink S7-PPI serial and otherwise returns the value FUNC_NOT_SUPPORTED. C/C++ syntax:
int AGLINK_API AGLReadVarBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadVarBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Seite 101
number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Page 102
6.3.7
With this function you read the data bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadDataBytes( int DevNr, int PlcNr, int DBNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLReadDataBytes( DevNr, PlcNr, DBNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr DBNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC number of selected data block byte where start to be read number of bytes to be read pointer to buffer flag whether to wait
Seite 103
6.3.8
With this function you read the timer words for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadTimerWords( int DevNr, int PlcNr, int Start, int Num, PWORD Buff, int boWait );
Delphi syntax:
function AGLReadTimerWords( DevNr, PlcNr, Start, Num: Long; var Buff: WORD; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC timer word where start to be read number of timer words to be read pointer to buffer flag whether to wait
Page 104
6.3.9
With this function you read the counter words for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadCounterWords( int DevNr, int PlcNr, int Start, int Num, PWORD Buff, int boWait );
Delphi syntax:
function AGLReadCounterWords( DevNr, PlcNr, Start, Num: Long; var Buff: WORD; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC counter word where start to be read number of counter words to be read pointer to buffer flag whether to wait
Seite 105
Delphi syntax:
function AGLReadMix( DevNr, PlcNr: Long; var Buff: DATA_RW; Num, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Buff Num boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to array number of structures to be read flag whether to wait
type of operand which is accessed size of data number of data block offset for memory access bit number (if necessary) result (error code) of the read/write operation
value of the operand as float value of the operand as DWORD for more simple access for more simple access
The individual fields have following meaning: OpType The type of the operand is listed here. Permitted values for this are TYP_IN (inputs), TYP_OUT (outputs), TYP_FLAG (flags), TYP_DATA (data), TYP_TIMER (timer), TYP_COUNTER (counter), TYPE_SFLAG (special flag for series 200), TYPE_VAR (variable memory series 200), TYPE_TIMER_200 (time stamps series 200), TYPE_COUNTER_200 (counter series 200) and TYPE_PERIPHERIE (peripheral inputs). The size of the operand is listed here. Permitted values for this are SIZE_BIT, SIZE_BYTE, SIZE_WORD and SIZE_DWORD. Timer and counter must have the size SIZE_WORD. SIZE_BIT is not valid for TYPE_PERIPHERIE and leads to an error return code. The number of the DBs, in case of a data access. The offset for the memory access The number of the bit, if the access size is SIZE_BIT. The result of the operation. The read value, if no error appeared.
OpSize
Seite 107
6.4.1
With this function you write the input bytes in the process image for the PLC with the requested device number. To this PLC must already be established a connection. Depending on the PLC the written bytes are immediately (that means at the system point) overwritten by the values of the physically available inputs. C/C++ syntax:
int AGLINK_API AGLWriteInBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteInBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
Page 108
6.4.2
With this function you write the output bytes in the process image for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWriteOutBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteOutBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
Seite 109
6.4.3
With this function you write the peripherical output bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWritePOutBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWritePOutBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
Page 110
6.4.4
With this function you write the flag bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWriteFlagBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteFlagBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
Seite 111
6.4.5
With this function you write the special flag bytes for the PLC of the 200 series with the requested device number. To this PLC must already be established a connection. As an alternative to this function you can access for these PLCs to the flags starting with 256. This is internally mapped to the special flags. You can keep your programs hardwareindependently. Notice: This function is only implemented in ACCON-AGLink S7-PPI serial and otherwise returns the value FUNC_NOT_SUPPORTED. C/C++ syntax:
int AGLINK_API AGLWriteSFlagBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteSFlagBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Start Num Buff boWait number of device (0 ... 7) number of selected PLC byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Seite 113
6.4.6
With this function you write the variables bytes for the PLC of the 200 series with the requested device number. To this PLC must already be established a connection. As an alternative to this function you can access for these PLCs to the DB 1. This is internally mapped to the variables. You can keep your programs hardware-independently. Notice: This function is only implemented in ACCON-AGLink S7-PPI serial and otherwise returns the value FUNC_NOT_SUPPORTED. C/C++ syntax:
int AGLINK_API AGLWriteVarBytes( int DevNr, int PlcNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteVarBytes( DevNr, PlcNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) number of device (0 ... 7) number of selected PLC byte where start to be read number of bytes to be written pointer to buffer flag whether to wait
Seite 115
6.4.7
With this function you write the data bytes for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWriteDataBytes( int DevNr, int PlcNr, int DBNr, int Start, int Num, PBYTE Buff, int boWait );
Delphi syntax:
function AGLWriteDataBytes( DevNr, PlcNr, DBNr, Start, Num: Long; var Buff: Byte; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr DBNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC number of selected data block byte where start to be written number of bytes to be written pointer to buffer flag whether to wait
Page 116
6.4.8
With this function you write the timer words for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWriteTimerWords( int DevNr, int PlcNr, int Start, int Num, PWORD Buff, int boWait );
Delphi syntax:
function AGLWriteTimerWords( DevNr, PlcNr, Start, Num: Long; var Buff: WORD; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC timer word where start to be written number of timer words to be written pointer to buffer flag whether to wait
Seite 117
6.4.9
With this function you write the counter words for the PLC with the requested device number. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLWriteCounterWords( int DevNr, int PlcNr, int Start, int Num, PWORD Buff, int boWait );
Delphi syntax:
function AGLWriteCounterWords( DevNr, PlcNr, Start, Num: Long; var Buff: WORD; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr Start Num Buff boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC counter word where start to be written number of counter words to be written pointer to buffer flag whether to wait
Page 118
Delphi syntax:
function AGLWriteMix( DevNr, PlcNr: Long; var Buff: DATA_RW; Num, boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: DevNr PlcNr Buff Num boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to array number of structures flag whether to wait
Seite 119
type of operand which is accessed size of data number of data block offset for memory access (for T+Z number) bit number (if necessary) result (error code) of the read/write operation
The individual fields have following meaning: OpType The type of the operand is listed here. Permitted values for this are TYP_IN (inputs), TYP_OUT (outputs), TYP_FLAG (flags), TYP_DATA (data), TYP_TIMER (timer), TYP_COUNTER (counter), TYPE_SFLAG (special flag for series 200), TYPE_VAR (variable memory series 200), TYPE_TIMER_200 (time stamps series 200), TYPE_COUNTER_200 (counter series 200) and TYPE_PERIPHERIE (peripherical inputs). The size of the operand is listed here. Permitted values for this are SIZE_BIT, SIZE_BYTE, SIZE_WORD and SIZE_DWORD. Timer and counter must have the size SIZE_WORD. SIZE_BIT is not valid for TYPE_PERIPHERIE and leads to an error return code. The number of the DBs, if it is a data access. The offset for the memory access The number of the bit, if the access size is SIZE_BIT. The result of the operation. The read value, if no error appeared.
OpSize
Page 120
6.5
6.5.1
With this function you determine how many data blocks are in this PLC available. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadDBCount( int DevNr, int PlcNr, int *DBCount, int boWait );
Delphi syntax:
function AGLReadDBCount( DevNr, PlcNr: Long; var DBCount: Long; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr DBCount boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC pointer to number of data blocks flag whether to wait
Seite 121
6.5.2
With this function you read the directory of the data blocks. The memory for the data block numbers must be sufficiently allocated. For this you call the function AGLReadDBCount and then allocate the memory. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadDBList( int DevNr, int PlcNr, PWORD DBList, int boWait );
Delphi syntax:
function AGLReadDBList( DevNr, PlcNr: Long; var DBList: WORD; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr DBList boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC directory of data block flag whether to wait
Page 122
6.5.3
With this function you determine the length of a certain data block. To this PLC must already be established a connection. C/C++ syntax:
int AGLINK_API AGLReadDBLen( int DevNr, int PlcNr, int DBNr, int *DBLen, int boWait );
Delphi syntax:
function AGLReadDBLen( DevNr, PlcNr, DBNr: Long; var DBLen: Long; boWait: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr PlcNr DBNr DBLen boWait Return values: >= 0 <0 number of job (boWait == 0) or AGL_SUCCESS (boWait != 0) an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) number of selected PLC number of selected data block pointer to length of data blocks flag whether to wait
Seite 123
The functions in this chapter support the simplified access to the data of the S5 and S7 control which are in the Motorola format (big endian) where as the PC data are in the Intel format (little endian).
7.1
7.1.1
With this function you read a signed 16 bit integer value from a byte buffer. C/C++-Syntax:
short AGLINK_API AGLReadInt16( PBYTE Buff );
Visual Basic-Syntax:
Declare Function AGLReadInt16 Lib "AGLink.DLL" (ByRef Buff As Byte) As Integer
Delphi-Syntax:
function AGLReadInt16( var Buff: Byte ): Short; stdcall; external 'AGLink.DLL';
LabVIEW syntax: Not implemented Parameters: Buff Return value: The value of the 16 bit integer from Buff[0], Buff[1]. buffer with data bytes
Page 124
7.1.2
With this function you read a word from a byte buffer. C/C++ syntax:
WORD AGLINK_API AGLReadWord( PBYTE Buff );
Delphi syntax:
function AGLReadWord( var Buff: Byte ): WORD; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Return value: The value of the word from Buff[0], Buff[1]. buffer with data bytes
Seite 125
7.1.3
With this function you read a double word from a byte buffer. C/C++ syntax:
DWORD AGLINK_API AGLReadDWord( PBYTE Buff );
Delphi syntax:
function AGLReadDWord( var Buff: Byte ): DWORD; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Return value: The value of the double word at the address Buff[0], Buff[1]. buffer with data bytes
Page 126
7.1.4
With this function you read a floating point number (real) from a byte buffer. C/C++ syntax:
float AGLINK_API AGLReadReal( PBYTE Buff );
Delphi syntax:
function AGLReadReal( var Buff: Byte ): Single; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Return value: The value of the floating point number (real) from Buff[0], Buff[1], Buff[2], Buff[3]. buffer with data bytes
Seite 127
7.1.5
With this function you read a S5 time in BCD format from a byte buffer. C/C++ syntax:
int AGLINK_API AGLReadS5Time( PBYTE Buff );
Delphi syntax:
function AGLReadS5Time( var Buff: Byte ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Return value: The value of the S5 time stamp (in milliseconds) from Buff[0], Buff[1]. buffer with data bytes
Page 128
7.2
7.2.1
With this function you write a word into a byte buffer. C/C++ syntax:
void AGLINK_API AGLWriteWord( PBYTE Buff, WORD Val );
Delphi syntax:
procedure AGLWriteWord( var Buff: Byte; Val: WORD ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Val Return value: no return value buffer with data bytes word value to be written
Seite 129
7.2.2
With this function you write a double word into a byte buffer. Syntax:
void AGLINK_API AGLWriteDWord( PBYTE Buff, DWORD Val );
Delphi syntax:
procedure AGLWriteDWord( var Buff: Byte; Val: DWORD ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Val Return value: no return value buffer with data bytes double word value to be written
Page 130
7.2.3
With this function you write a floating point number (real) into a byte buffer. C/C++ syntax:
void AGLINK_API AGLWriteReal( PBYTE Buff, float Val );
Delphi syntax:
procedure AGLWriteReal( var Buff: Byte; Val: Single ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Val Return value: no return value buffer with data bytes floating point number (real) to be written
Seite 131
7.2.4
With this function you write a time in milliseconds as S5Time into a byte buffer. The time is represented with the most possible precision and must lie in the area of 10 ms till 9990000 ms. C/C++ syntax:
void AGLINK_API AGLWriteS5Time( PBYTE Buff, int Val );
Delphi syntax:
procedure AGLWriteS5Time( var Buff: Byte; Val: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Buff Val Return value: No return value buffer with data bytes value (time stamp) to be written
Page 132
7.3
7.3.1
With this function a byte buffer is converted into a word buffer. C/C++ syntax:
void AGLINK_API AGLByte2Word( PWORD OutBuff, PBYTE InBuff, int AnzWords );
Delphi syntax:
procedure AGLByte2Word( var OutBuff: WORD; var InBuff: Byte; AnzWords: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: OutBuff InBuff AnzWords Return value: no return value pointer to word buffer pointer to byte buffer number of words to be converted
Seite 133
7.3.2
With this function a byte buffer is converted into a double word buffer. C/C++ syntax:
void ); AGLINK_API AGLByte2DWord( PDWORD OutBuff, PBYTE InBuff, int AnzDWords
Delphi syntax:
procedure AGLByte2DWord( var OutBuff: DWORD; var InBuff: Byte; AnzDWords: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: OutBuff InBuff AnzWords Return value: no return value pointer to double word buffer pointer to byte buffer number of double words to be converted
Page 134
7.3.3
Converting byte buffer into floating point number (real) buffer (AGLByte2Real)
With this function a byte buffer is converted into a floating point number (real) buffer. C/C++ syntax:
void ); AGLINK_API AGLByte2Real( float *OutBuff, PBYTE InBuff, int AnzReals
Delphi syntax:
procedure AGLByte2Real( var OutBuff: Single; var InBuff: Byte; AnzReals: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: OutBuff InBuff AnzWords Return value: no return value pointer to real buffer pointer to byte buffer number of floating point numbers (real) to be converted
Seite 135
7.3.4
With this function a word buffer is converted into a byte buffer. C/C++ syntax:
void AGLINK_API AGLWord2Byte( PBYTE OutBuff, PWORD InBuff, int AnzWords );
Delphi syntax:
procedure AGLWord2Byte( var OutBuff: Byte; var InBuff: WORD; AnzWords: Long ); stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: OutBuff InBuff AnzWords Return value: no return value pointer to byte buffer pointer to word buffer number of words to be converted
Page 136
7.3.5
With this function a double word buffer is converted into a byte buffer. C/C++ syntax:
void ); AGLINK_API AGLDWord2Byte( PBYTE OutBuff, PDWORD InBuff, int AnzDWords
Delphi syntax:
procedure AGLDWord2Byte( var OutBuff: Byte; var InBuff: DWORD; AnzDWords: Long ); stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: OutBuff InBuff AnzDWords Return value: no return value pointer to byte buffer pointer to double word buffer number of double words to be converted
Seite 137
7.3.6
Converting floating point number (real) buffer into byte buffer (AGLReal2Byte)
With this function a floating point number (real) buffer is converted into a byte buffer. C/C++ syntax:
void AGLINK_API AGLReal2Byte( PBYTE OutBuff, float *InBuff, int AnzReals );
Delphi syntax:
procedure AGLReal2Byte( var OutBuff: Byte; var InBuff: Single; AnzReals: Long ); stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: OutBuff InBuff AnzReals Return value: no return value pointer to byte buffer pointer to real buffer number of floating point numbers (real) to be converted
Page 138
7.3.7
With this function a text string is converted into a byte buffer. This function was implemented for the easy access handling under VB and VBA. C/C++-Syntax:
int AGLINK_API AGLString2Buff( PBYTE Buff, LPSTR Text, int AnzBytes );
Visual Basic-Syntax:
Declare Function AGLString2Buff Lib "AGLink.DLL" (ByRef Buff As Byte, ByVal Text As String, ByVal AnzBytes As Long) As Long
Delphi-Syntax:
function AGLString2Buff( var Buff: Byte; Text: PChar; AnzBytess: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Not implemented
Parameters: Buff Text AnzReals Return value: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) pointer to byte buffer pointer to string number of words to be converted
Seite 139
7.3.8
With this function a byte buffer is converted into a string. This function was implemented for the easy access handling under VB and VBA. C/C++-Syntax:
int AGLINK_API AGLBuff2String( PBYTE Buff, LPSTR Text, int AnzBytes );
Visual Basic-Syntax:
Declare Function AGLBuff2String Lib "AGLink.DLL" (ByRef Buff As Byte, ByVal Text As String, ByVal AnzBytes As Long) As Long
Delphi-Syntax:
function AGLBuff2String( var Buff: Byte; Text: PChar; AnzBytess: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Not implemented
Parameters: Buff Text AnzReals Return value: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) pointer to byte buffer pointer to string number of words to be converted
Page 140
7.4
7.4.1
This function determines the status of the requested bit. C/C++ syntax:
int AGLINK_API AGLGetBit( BYTE Wert, int BitNr );
Delphi syntax:
function AGLGetBit ( Wert: Byte; BitNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Wert BitNr Return value: status of the bit byte to be checked bit number to be checked (0 ... 7)
Seite 141
7.4.2
This function sets the requested bit on the value one. C/C++ syntax:
BYTE AGLSetBit( PBYTE Buff, int BitNr );
Delphi syntax:
Function AGLSetBit ( var Buff: Byte; BitNr: Long ): Byte; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Buff BitNr Return value: the value of the byte pointer to byte where the bit should be set bit number to be set (0 ... 7)
Page 142
7.4.3
This function sets the requested bit on the value zero. C/C++ syntax:
BYTE AGLResetBit( PBYTE Buff, int BitNr );
Delphi syntax:
Function AGLResetBit ( var Buff: Byte; BitNr: Long ): Byte; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Buff BitNr Return value: the value of the byte pointer to byte where the bit should be reset bit number to be set (0 ... 7)
Seite 143
7.4.4
This function sets the requested bit on the selected value. C/C++ syntax:
BYTE AGLSetBitVal( PBYTE Buff, int BitNr, int Val );
Delphi syntax:
Function AGLSetBitVal ( var Buff: Byte; BitNr, Val: Long ): Byte; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Buff BitNr Val Return value: the value of the byte pointer to byte where the bit should be changed bit number to be set (0 ... 7) value of the bit
Page 144
7.5
7.5.1
This function determines the error text to the corresponding error code. Therefore the contents of the file "AGLink_Error.TXT" are evaluated. At the first call of the function this file is read once and stands with no delay for further processing at the disposal. This file must be stored in the application directory. C/C++ syntax:
int AGLINK_API AGLGetErrorMsg( int ErrNr, char *Msg, int MaxLen );
Delphi syntax:
function AGLGetErrorMsg( ErrNr: Long; Msg: PChar; MaxLen: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: ErrNr Msg MaxLen Return value: Number of in Msg copied string number of error code pointer to string with error text length of message string
Seite 145
7.5.2
With this function you can set whether the time in the result structure is determined with GetSystemTime (Flag != 0) or GetLocalTime (Flag == 0). C/C++ syntax:
void AGLINK_API AGLUseSystemTime( int Flag );
Delphi syntax:
procedure AGLUseSystemTime ( Flag: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: Flag Return value: no return value flag if GetSystemTime or GetLocalTime will be used
Page 146
7.6
7.6.1
This function returns the version number of the AGLink.DLL. Instead of the individual parameters also the value zero can be submitted, if this special information is not relevant. C/C++ syntax:
void AGLINK_API AGLGetDLLVersion( int *Major, int *Minor );
Delphi syntax:
procedure AGLGetDLLVersion( var Major, Minor: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Major Minor Return value: no return value pointer to variable for major version pointer to variable for minor version
Seite 147
7.6.2
This function returns the extended version number of the AGLink.DLL. Instead of the individual parameters also the value zero can be submitted, if this special information is not relevant. C/C++ syntax:
void AGLINK_API AGLGetDLLVersionEx( int *Major, int *Minor, int *Build, char *Date );
Delphi syntax:
procedure AGLGetDLLVersionEx( var Major, Minor, Build: Long, Date: PChar ): Long; stdcall; external 'AGLink.DLL';
LabVIEW-Syntax:
Parameters: Major Minor Build Date pointer to variable for major version pointer to variable for minor version pointer to variable for build version pointer to variable for build date, there must be space for in minimum 11 bytes, that means the date must be in the format 2002-07-08 (zero terminated string).
Page 148
7.6.3
Delphi syntax:
function AGLGetOptions: Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: no parameters Return value: The available options as bit flag. A set bit means that the option is available. Possible bit masks are: AGL_MASK_MPI, AGL_MASK_TS, AGL_MASK_CIF, AGL_MASK_TCPIP, AGL_MASK_PPI, AGL_MASK_RK, AGL_MASK_S5, AGL_MASK_NL_DRV, AGL_MASK_NL_IP and AGL_MASK_SOFTING.
Seite 149
7.6.4
Delphi syntax:
function AGLGetSerialNumber: Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Page 150
7.6.5
This function returns the licensee of the AGLink.DLL. The function requests a pointer on a string buffer with at least 256 bytes space. C/C++ syntax:
char *AGLINK_API AGLGetClientName( char *Name );
Delphi syntax:
function AGLGetClientName( Name: PChar ): PChar; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: Name Return value: pointer to the returned string for further processing. Pointer to string buffer
Seite 151
These functions enable you an easier access to the AGLink functions that process a string. These functions are includes in the source code in module AGLink.BAS.
8.1
This function returns you an error message from AGLink directly as string. Structure of the implementation:
Private Const Max = 256 Public Function AGLErrMsg(ByVal ErrNo As Long) As String Dim Tmp As String Dim MsgLen As Long Tmp = Space$(Max) MsgLen = AGLGetErrorMsg(ErrNo, Tmp, Max) If MsgLen = 0 Then AGLErrMsg = "unknown error number!" Else AGLErrMsg = Left$(Tmp, MsgLen) End If End Function
Page 152
8.2
This function returns you an entry from the diagnostic buffer from AGLink directly as string. Structure of the implementation:
Private Const Max = 256 Public Function AGLDiagBufferEntry(ByVal Index As Long, pDiagBuff As DIAGBUFF) As String Dim Tmp As String Dim MsgLen As Long Tmp = Space$(Max) MsgLen = AGLReadDiagBufferEntry(Index, pDiagBuff, Tmp, Max) If MsgLen = 0 Then AGLDiagBufferEntry = AGLErrMsg(PARA_ERR) Else AGLDiagBufferEntry = Left$(Tmp, MsgLen) End If End Function
Seite 153
9.1
9.1.1
With this function the complete device settings of the device will be read once from the registry and filed in an internal memory area. (S7-MPI serial, S7-MPI serial/TS, S7-PB/CIF, S7-PB/NetLinkDrv, S7-PB/Softing, S7-TCP/IP, S7-TCP/NetLinkIP, S7-PPI serial, RK512/3964R, S5 serial as well as the adapted device type) C/C++ syntax:
void AGLINK_API AGLReadDevice( int DevNr );
Delphi syntax:
procedure AGLReadDevice( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 154
9.1.2
This function reads the selected device type from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadDevType( int DevNr );
Delphi syntax:
procedure AGLReadDevType( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 155
9.1.3
This function reads the port settings for ACCON-AGLink S7-MPI serial of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPMPI( int DevNr );
Delphi syntax:
procedure AGLReadIFPMPI( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 156
9.1.4
This function reads the port settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPTS( int DevNr );
Delphi syntax:
procedure AGLReadIFPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 157
9.1.5
This function reads the location settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadLPTS( int DevNr );
Delphi syntax:
procedure AGLReadLPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 158
9.1.6
This function reads the dial number settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the registry and files it in an internal memory area.
C/C++ syntax:
void AGLINK_API AGLReadDPTS( int DevNr );
Delphi syntax:
procedure AGLReadDPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 159
9.1.7
This function reads the port settings for ACCON-AGLink S7-PB/CIF of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPCIF( int DevNr );
Delphi syntax:
procedure AGLReadIFPCIF( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 160
9.1.8
This function reads the port settings for ACCON-AGLink S7-PB/NetLinkDrv of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPNLDRV( int DevNr );
Delphi syntax:
procedure AGLReadIFPNLDRV( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 161
9.1.9
This function reads the port settings for ACCON-AGLink S7-PB/Softing of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPSOFTING( int DevNr );
Delphi syntax:
procedure AGLReadIFPSOFTING( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 162
9.1.10
This function reads the port settings for ACCON-AGLink S7-TCP/IP of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPTCPIP( int DevNr );
Delphi syntax:
procedure AGLReadIFPTCPIP( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 163
9.1.11
This function reads the port settings for ACCON-AGLink S7-TCP/NetLinkIP of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPNLIP( int DevNr );
Delphi syntax:
procedure AGLReadIFPNLIP( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 164
9.1.12
This function reads the port settings for ACCON-AGLink S7-PPI serial of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPPPI( int DevNr );
Delphi syntax:
procedure AGLReadIFPPPI( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 165
9.1.13
This function reads the port settings for ACCON-AGLink RK512/3964R of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPRK( int DevNr );
Delphi syntax:
procedure AGLReadIFPRK( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 166
9.1.14
This function reads the port settings for ACCON-AGLink S5 serial of the selected device from the registry and files it in an internal memory area. C/C++ syntax:
void AGLINK_API AGLReadIFPS5( int DevNr );
Delphi syntax:
procedure AGLReadIFPS5( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 167
9.2
9.2.1
With this function the complete device settings of the device will be written once from the internal memory area into the registry. (S7-MPI serial, S7-MPI serial/TS, S7-PB/CIF, S7PB/NetLinkDrv, S7-PB/Softing, S7-TCP/IP, S7-TCP/NetLinkIP, S7-PPI serial, RK512/3964R, S5 serial as well as the adapted device type) C/C++ syntax:
void AGLINK_API AGLWriteDevice( int DevNr );
Delphi syntax:
procedure AGLWriteDevice( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 168
9.2.2
This function writes the selected device type from the internal memory area into the registry C/C++ syntax:
void AGLINK_API AGLWriteDevType( int DevNr );
Delphi syntax:
procedure AGLWriteDevType( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 169
9.2.3
This function writes the port settings for ACCON-AGLink S7-MPI serial of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPMPI( int DevNr );
Delphi syntax:
procedure AGLWriteIFPMPI( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 170
9.2.4
This function writes the port settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPTS( int DevNr );
Delphi syntax:
procedure AGLWriteIFPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 171
9.2.5
This function writes the location settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteLPTS( int DevNr );
Delphi syntax:
procedure AGLWriteLPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 172
9.2.6
This function writes the dial number settings for ACCON-AGLink S7-MPI serial/TS of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteDPTS( int DevNr );
Delphi syntax:
procedure AGLWriteDPTS( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 173
9.2.7
This function writes the port settings for ACCON-AGLink S7-PB/CIF of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPCIF( int DevNr );
Delphi syntax:
procedure AGLWriteIFPCIF( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 174
9.2.8
This function writes the port settings for ACCON-AGLink S7-PB/NetLinkDrv of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPNLDRV( int DevNr );
Delphi syntax:
procedure AGLWriteIFPNLDRV( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 175
9.2.9
This function writes the port settings for ACCON-AGLink S7-PB/Softing of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPSOFTING( int DevNr );
Delphi syntax:
procedure AGLWriteIFPSOFTING( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 176
Delphi syntax:
procedure AGLWriteIFPTCPIP( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 177
9.2.11
This function writes the port settings for ACCON-AGLink S7-TCP/NetLinkIP of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPNLIP( int DevNr );
Delphi syntax:
procedure AGLWriteIFPNLIP( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 178
9.2.12
This function writes the port settings for ACCON-AGLink S7-PPI serial of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPPPI( int DevNr );
Delphi syntax:
procedure AGLWriteIFPPPI( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 179
9.2.13
This function writes the port settings for ACCON-AGLink RK512/3964R of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPRK( int DevNr );
Delphi syntax:
procedure AGLWriteIFPRK( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Page 180
9.2.14
This function writes the port settings for ACCON-AGLink S5 serial of the selected device from the internal memory area into the registry. C/C++ syntax:
void AGLINK_API AGLWriteIFPS5( int DevNr );
Delphi syntax:
procedure AGLWriteIFPS5( DevNr: Long ); stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Seite 181
9.3
9.3.1
This function returns the currently set device type of the requested device. C/C++ syntax:
int AGLINK_API AGLGetDevType( int DevNr );
Delphi syntax:
function AGLGetDevType( DevNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr Return values: >= 0 <0 currently selected AGL_DEVTYPE_TS, ...) type (AGL_DEVTYPE_MPI, number of device (0 ... 7)
Page 182
9.3.2
This function selects the port settings for ACCON-AGLink S7 MPI serial from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPMPI( int DevNr, LPIFPARA_MPI Para, int Len );
Delphi syntax:
function AGLGetIFPMPI( DevNr: Long; var Para: IFPARA_MPI; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 in case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 183
9.3.3
This function selects the port settings for ACCON-AGLink S7 MPI serial/TS from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPTS( int DevNr, LPIFPARA_TS Para, int Len );
Delphi syntax:
function AGLGetIFPTS( DevNr: Long; var Para: IFPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 184
9.3.4
This function selects the location settings for ACCON-AGLink S7 MPI serial/TS from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetLPTS( int DevNr, LPLOCPARA_TS Para, int Len );
Delphi syntax:
function AGLGetLPTS( DevNr: Long; var Para: LOCPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 185
9.3.5
This function selects the dial number settings for ACCON-AGLink S7 MPI serial/TS from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetDPTS( int DevNr, LPDPARA_TS Para, int Len );
Delphi syntax:
function AGLGetDPTS( DevNr: Long; var Para: DPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 186
9.3.6
This function selects the port settings for ACCON-AGLink S7-PB/CIF from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPCIF( int DevNr, LPIFPARA_CIF Para, int Len );
Delphi syntax:
function AGLGetIFPCIF( DevNr: Long; var Para: IFPARA_CIF; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 187
9.3.7
This function selects the port settings for ACCON-AGLink S7-PB/NetLinkDrv from the internal memory area and writes it into the selected parameter structure.
C/C++ syntax:
int AGLINK_API AGLGetIFPNLDRV( int DevNr, LPIFPARA_NL_DRV Para, int Len );
Delphi syntax:
function AGLGetIFPNLDRV( DevNr: Long; var Para: IFPARA_NL_DRV; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 188
9.3.8
This function selects the port settings for ACCON-AGLink S7-PB/Softing from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPSOFTING( int DevNr, LPIFPARA_SOFTING Para, int Len );
Delphi syntax:
function AGLGetIFPSOFTING( DevNr: Long; var Para: IFPARA_SOFTING; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 189
9.3.9
This function selects the port settings for ACCON-AGLink S7-TCP/IP from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPTCPIP( int DevNr, LPIFPARA_TCPIP Para, int Len );
Delphi syntax:
function AGLGetIFPTCPIP( DevNr: Long; var Para: IFPARA_TCPIP; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 190
Delphi syntax:
function AGLGetIFPNLIP( DevNr: Long; var Para: IFPARA_NL_IP; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 191
9.3.11
This function selects the port settings for ACCON-AGLink S7-PPI serial from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPPPI( int DevNr, LPIFPARA_PPI Para, int Len );
Delphi syntax:
function AGLGetIFPPPI( DevNr: Long; var Para: IFPARA_PPI; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 192
9.3.12
This function selects the port settings for ACCON-AGLink RK512/3964R from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPRK( int DevNr, LPIFPARA_RK Para, int Len );
Delphi syntax:
function AGLGetIFPRK( DevNr: Long; var Para: IFPARA_RK; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 193
9.3.13
This function selects the port settings for ACCON-AGLink S5 serial from the internal memory area and writes it into the selected parameter structure. C/C++ syntax:
int AGLINK_API AGLGetIFPS5( int DevNr, LPIFPARA_S5 Para, int Len );
Delphi syntax:
function AGLGetIFPS5( DevNr: Long; var Para: IFPARA_S5; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 194
9.4.1
This function sets the device type of the selected device on the current value. C/C++ syntax:
int AGLINK_API AGLSetDevType( int DevNr, int DevType );
Delphi syntax:
function AGLSetDevType( DevNr, DevType: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr DevType number of device (0 ... 7) device type to be set (AGL_DEVTYPE_MPI, AGL_DEVTYPE_TS, ...)
Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Seite 195
9.4.2
This function changes the port settings for ACCON-AGLink S7 MPI serial to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPMPI( int DevNr, LPIFPARA_MPI Para, int Len );
Delphi syntax:
function AGLSetIFPMPI( DevNr: Long; var Para: IFPARA_MPI; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 196
9.4.3
This function changes the port settings for ACCON-AGLink S7 MPI serial/TS to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPTS( int DevNr, LPIFPARA_TS Para, int Len );
Delphi syntax:
function AGLSetIFPTS( DevNr: Long; var Para: IFPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 197
9.4.4
This function changes the location settings for ACCON-AGLink S7 MPI serial/TS to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetLPTS( int DevNr, LPLOCPARA_TS Para, int Len );
Delphi syntax:
function AGLSetLPTS( DevNr: Long; var Para: LOCPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 198
9.4.5
This function changes the dial number settings for ACCON-AGLink S7 MPI serial/TS to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetDPTS( int DevNr, LPDPARA_TS Para, int Len );
Delphi syntax:
function AGLSetDPTS( DevNr: Long; var Para: DPARA_TS; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 199
9.4.6
This function changes the port settings for ACCON-AGLink S7-PB/CIF to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPCIF( int DevNr, LPIFPARA_CIF Para, int Len );
Delphi syntax:
function AGLSetIFPCIF( DevNr: Long; var Para: IFPARA_CIF; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 200
9.4.7
This function changes the port settings for ACCON-AGLink S7-PB/NetLinkDrv to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPNLDRV( int DevNr, LPIFPARA_NL_DRV Para, int Len );
Delphi syntax:
function AGLSetIFPNLDRV( DevNr: Long; var Para: IFPARA_NL_DRV; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 201
9.4.8
This function changes the port settings for ACCON-AGLink S7-PB/Softing to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPSOFTING( int DevNr, LPIFPARA_SOFTING Para, int Len );
Delphi syntax:
function AGLSetIFPSOFTING( DevNr: Long; var Para: IFPARA_SOFTING; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 202
9.4.9
This function changes the port settings for ACCON-AGLink S7-TCP/IP to the values submitted in the parameter structure, provided that this is permitted.
C/C++ syntax:
int AGLINK_API AGLSetIFPTCPIP( int DevNr, LPIFPARA_TCPIP Para, int Len );
Delphi syntax:
function AGLSetIFPTCPIP( DevNr: Long; var Para: IFPARA_TCPIP; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 203
Delphi syntax:
function AGLSetIFPNLIP( DevNr: Long; var Para: IFPARA_NL_IP; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 204
9.4.11
This function changes the port settings for ACCON-AGLink S7-PPI serial to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPPPI( int DevNr, LPIFPARA_PPI Para, int Len );
Delphi syntax:
function AGLSetIFPPPI( DevNr: Long; var Para: IFPARA_PPI; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 205
9.4.12
This function changes the port settings for ACCON-AGLink RK512/3964R to the values submitted in the parameter structure, provided that this is permitted. C/C++ syntax:
int AGLINK_API AGLSetIFPRK( int DevNr, LPIFPARA_RK Para, int Len );
Delphi syntax:
function AGLSetIFPRK( DevNr: Long; var Para: IFPARA_RK; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Page 206
Delphi syntax:
function AGLSetIFPS5( DevNr: Long; var Para: IFPARA_S5; Len: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
not implemented
Parameters: DevNr Para Len Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS) number of device (0 ... 7) parameter structure length of structure
Seite 207
9.5
Additional functions
9.5.1
This function calls the program "AGLink_Config.EXE". This must be filed in the search path or in the current work directory of your application. C/C++ syntax:
int AGLINK_API AGLConfig( int DevNr );
Delphi syntax:
function AGLConfig( DevNr: Long ): Long; stdcall; external 'AGLink.DLL';
LabVIEW syntax:
Parameters: DevNr Number of device (0 ... 7 if only a specific device shall be configured or -1 if all devices shall be configured)
Return values: AGL_SUCCESS <0 In case of success an error code (see AGLink.H, AGLink.BAS or AGLink.PAS)
Page 208
Seite 209
10 Appendix A
10.1 Q&A list for ACCON-AGLink
10.1.1
This depends on which hardware components and which transmission paths are used. In internal tests we determined the following approximated values for reading of 16 data bytes: Tested hardware components S7 315-2 DP with Siemens PC adapter V5.0 S7 412-1 with Siemens PC adapter V5.0 S7 315-2 DP with ACCON-MPI adapter S7 412-1 with ACCON-MPI adapter S7 315-2 DP with ACCON-PB/MP card on MPI board with 187,5 kBaud S7 412-1 with ACCON-PB/MPI card on MPI board with 187,5 kBaud S7 318-2 with ACCON-PB/MPI card on MPI board with 187,5 kBaud S7 318-2 with ACCON-PB/MPI card on MPI board with 1500 kBaud S7 416-2 with ACCON-PB/MPI card on MPI board with 1500 kBaud S7 315-2 DP with CP 343-1 S7 318-2 with CP 343-1 S7 414-3 with CP 443-1 S7 416-2 with CP 443-1 IT S7 2xx with 9,6 kBaud S7 2xx with 19,2 kBaud Used ACCON-AGLink module S7-MPI serial S7-MPI serial S7-MPI serial S7-MPI serial S7-PB S7-PB S7-PB S7-PB S7-PB S7-TCP/IP S7-TCP/IP S7-TCP/IP S7-TCP/IP S7-PPI serial S7-PPI serial Averaged time per transmission in ms 100 100 54 52 35 26 21 10 10 36 18 9 9 106 54
The listed times can vary depending on the PLC load and the data traffic on the bus. When more data are transmitted, then up to the packet size (approx. 220 bytes for S7 300 and 460 bytes for S7 400) the pure data transmission time has to be added.
Page 210
10.1.2
No, because of the uniform software interface of ACCON-AGLink it is possible, only to implement the new DLL and to adjust the parameters with the program AGLink_Config.EXE. The new hardware components can be used immediately. That's all.
10.1.3
When I need e.g. MPI serial and TCP/IP, do I obtain two different DLL versions?
No. All hardware supports purchased by you are in one DLL and are always at your disposal. A version administration (on which customer computer is which hardware DLL) is not necessary.
10.1.4
ACCON-AGLink is fast, compact and easy to use. All files needed for the customer match comfortably on a floppy disk. These can be copied simply on the target computer. An expensive installing is not necessary. ACCON-AGLink is on the one hand multithread safe and on the other hand permits an asynchronous communication at all modules. In the foreground you can react fast to user inputs while the communication is treated unnoticeably in the background. In addition offers ACCON-AGLink a uniform software interface for all modules. When customers need further hardware support, you don't have to change your programs. It suffices to implement the new DLL and to configure the interface according to the used hardware components. ACCON-AGLink is free of runtime charges. Every developer that implements programs with ACCON-AGLink needs his own license. Also see the complete license agreement to this subject in appendix C.
10.1.5
What happens when there appear new hardware components, which were not yet supported from my ACCON-AGLink release?
ACCON-AGLink is permanently developed further and adapted to new hardware components. To ensure that you are always up to date, we offer for ACCON-AGLink a maintenance agreement. The agreement includes that you receive automatically all new releases of your DLL sent by e-mail. The most comfortable way to remain up to date.
10.1.6
Of course. You can get the demo version simply from the Internet www.deltalogic.de. We are also glad to send you our current software CD-ROM by mail. Please call us or send us a fax or a e-mail.
Seite 211
10.1.7
With the demo version you can test the full scope of ACCON-AGLink. The communication is stopped merely every five minutes and an indication appears on the screen that you use a demo version of ACCON-AGLink.
10.1.8
Do I have to pay runtime charges for programs that are developed with ACCON-AGLink?
No. You acquire only one license of ACCON-AGLink per developer place. No further charges appear for the developed programs made by you in accordance with the license agreement. Please see the complete license agreement to this subject in appendix C.
10.1.9
No. All functions for the administration of the phone numbers, for the connection set-up and for the data transmission are completely dealt with by ACCON-AGLink S7 MPI serial/TS.
10.1.10 What happens when the cable is removed using ACCON-AGLink S7- MPI serial?
You receive a corresponding error message. De-initialize in this case the interface complete with the functions AGLPLCDisconnect, AGLExitAdapter and AGLHangUp. Try now to restart the communication with the functions AGLDialUp and AGLInitAdapter. As soon as the adapter is plugged in again, you receive with the function AGLInitAdapter no more error message. Now you can execute the function AGLPLCConnect and continue the communication.
Page 212
real numbers etc. ACCON-AGLink contains conversion functions for reading or writing access to the corresponding buffer.
10.1.14 Can I access with ACCON-AGLink S7-MPI the PLC also via Profibus?
Yes. For you no difference is recognizable. It is important for the Profibus access that you have selected the correct bus baud rate for the communication in the function AGLink_Config.EXE (or program-controlled).
10.1.15 What can I do, when the communication via PC adapter is too slow?
You most simply use our MPI-/Profibus card in such cases. It offers a higher data throughput with moderate costs PLC-sided is no CP necessary.
10.1.16 Does every arbitrary Profibus card works with ACCON-AGLink S7-PB?
No. At present we support besides the Profibus cards also the ACCON-PB/MPI card of the company Softing. This is identically constructed with the Profibus cards of the company Hilscher. Whether and when further cards will be supported, it depends on the customer demand and the manufacturer support.
10.1.17 How can I access to the S7 with a PC adapter, when the MPI port is occupied from a OP?
MPI is a bus. You simply need a corresponding bus plug with feed-through input for the connection of the OP. It is important that the power supplies are looped through, otherwise the adapter remains dark.
Seite 213
connect to the next one. You can alternatively also split your bus system into corresponding smaller segments and then use one communication adapter per segment (applies to MPI or Profibus). ACCON-AGLink supports up to eight simultaneous devices with each respectively up to 16 simultaneous PLCs (version 3.0), i.e. you have at most 128 PLCs directly in the access. When you use TCP/IP, it suffices to parameterize and use another additional device than TCP/IP. For the 128 PLCs no additional hardware components are necessary on the PC side.
10.1.19 Can I connect the PPI cable only to one series 200 PLC?
No. You can connect several series 200 controls with a Profibus wiring to a network. You only have to take care that every PLC receives its own and unique address. You can adjust this with the programming system. With ACCON-AGLink S7 PPI serial you list the number of the selected PLC with the function call.
10.1.20 The function AGLPLCConnect of ACCON AGLink S7 TCP/IP is successful, however the reading of the data provides an error code. What's wrong?
In the parameter setting with the function AGLink_Config (or in the program code) you have presumably typed the rack and slot number of the CP and not the requested CPU. Please take the correct values from the hardware configuration and insert these with the function AGLink_Config or in the parameters.
10.1.21 Why appears under Windows 95 an error message during processing a with ACCON-AGLink developed program ?
ACCON-AGLink is not released for Windows 95, as described in the documentation. When some prerequisites are given, the program can execute. The following descriptions are given without guarantee, we dont ensure functionality. First, it is necessary to install the network protocol TCP/IP. This is even necessary when neither the extended function scope (ACCON-AGLink S7-TCP/IP) nor the corresponding communication function is used. In addition the release number of the network protocol is important. Per default for the versions of Windows 95 Winsock V1 (Winsock.dll) was delivered , but ACCON-AGLink needs Winsock V2 (WS2_32.dll). On the website of the company Microsoft is an update available, please take into account their hints and information.
10.1.22 Why are the device settings not permanently stored under Windows 2000/XP ?
When the parameter settings of the program AGLink_Config (or via program code) are not stored under Windows 2000/XP, you have presumably limited user authority. ACCON-AGLink stores these parameters in the registry data base (Registry) in the directory HKLM. With Windows 2000/XP only the user group Hauptbenutzer has the necessary access in this directory. With Windows NT the access as user is sufficient.
Page 214
Take care that you have access in the needed group and the parameter settings can be stored permanently.
Seite 215
10.2.1
Release 2.1
description Release 2.1 approved
10.2.2
Release 2.2
description For reasons of compatibility towards AGLink release 1.x the result structure changed from Typedef struct tagRESULT { long State; long ErrCode; long SError; SYSTEMTIME SysTime; } RESULT, *LPRESULT; to typedef struct tagRESULT { long State; long ErrCode; SYSTEMTIME SysTime; Long SError; } RESULT, *LPRESULT;
06.04.2001 RH 06.04.2001 RH
AGLink_Config.EXE changed, that no source code of the AGLink.DLL is used in the project, AGLink.DLL is called directly.. DLL info functions added. These are in detail: AGLGetDLLVersion AGLGetOptions AGLGetSerialNumber AGLGetClientName determine the version of DLL determine the available options determine the serial number of DLL determine the registered user
AGLink_Info.EXE created. This console application finds the information of the DLL out with above functions and returns these values. Correction made in AGLPLCDisconnect. the module S7-MPI/CIF in the function
The functions of the AGLink.DLL are exported in addition with fixed numbers. Thereby additional functions can be inserted without changing the order of the functions. Else the adding of new functions and use of the old programs can lead otherwise to a protection injury (GP). NOTICE: All programs that use the AGLink-DLL as LoadOnStart
Page 216
Industrial PLC-Communication Suite (statically), must be linked again. This affects BCB and MSVC.
20.04.2001 RH
The module S7-MPI/CIF changed that several jobs can be worked off completely parallel on different controls. Up to 8 controls can be addressed at the same time. Release 2.2 approved
23.04.2001 RH
10.2.3
Release 2.3
description Demo limitation changed. A call number dependent indication replaced by a time-dependent indication. Every 5 minutes appears now the indication that it is a demo version of ACCON-AGLink (instead after every 512 calls). A restriction in the number of bytes per job doesn't exist any more. This corresponds now to the complete version. In module S7-MPI/TS support for TS adapter version 3.2 integrated. TCP/IP module finished. TCP/IP parameterization in AGLink_Config.EXE integrated. Release 2.3 approved.
16.07.2001 RH
Seite 217
10.2.5
Release 2.4
Description Implementation of LabView support in ACCON-AGLink. The functions to access via PPI cable to S7 series 200 implemented. Therefore the structure of the interface parameters for PPI changed. For the use of the new DLL, the configuration program must be re-called once and the interface parameters stored again, if PPI was already selected. AGLink_Config.EXE adapted to implementation of version check. the changed structure and
12.02.2002 RH 16.02.2002 RH
Additional functions to access to the additional areas of the S7 series 200 implemented. These are in particular: AGLReadSFlagBytes, AGLReadVarBytes, AGLWriteSFlagBytes, AGLWriteVarBytes. As an alternative to these functions the compatible functions (see the corresponding chapter of the function reference) can be used for the development hardware-independent programs.
16.02.2002 RH 18.02.2002 RH
Internal error handling (messages from the PLC) improved. This affects all modules. Release 2.4 approved.
Page 218
10.3.1
Release 3.0
Description Error in function AGLReadS5Time eliminated. ACCON-AGLink S7 TCP/IP adapted to the peculiarities of the old CPs in case of large data packets. If required, "Fast Acknowledge" is used automatically now. The functions AGLReadPLCInfo adapted to the memory areas of the "great" PLCs. The function AGLActivate implemented. ACCON-AGLink must be now activated first with an enclosed key before you can communicate. Every DLL can therefore only be used by the specific licensee. The number of simultaneously usable PLCs per device increased from 8 to 16. With the modules ACCON-AGLink S7 PB and ACCON-AGLink S7 TCP/IP 16 open connections can be used simultaneously, for the other modules the hardware isn't suitable. The modules ACCON-AGLink S7-MPI serial and ACCON-AGLink S7PB/CIF prepared for the expansion of profiles and type of connection. Therefore a change of structure was necessary. Is also in the current release downward compatible implemented. For ACCON-AGLink S7 TCP/IP the expansion capabilities are also considered in the structure. For the use of the new DLL, the configuration program must be re-called once and the interface parameters must be stored again if one of the listed modules was already selected. Change of name for the module ACCON-AGLink S7 MPI/CIF in new name ACCON-AGLink S7 PB/CIF. The further modules ACCON-AGLink S7 PB/NetLinkDrv, ACCON-AGLink S7 PB/Softing and ACCON-AGLink S7 TCP/NetLinkIP already fixed by name. In module ACCON-AGLink S7 TCP/IP problem at renewed connection set-up after pulled network cable under W2K solved. The functions for the access with ACCON-NetLink and device driver to the S7 series 300 and S7 series 400 implemented. Structures already prepared for the access to the S7 series 300 and S7 series 400 with ACCON-NetLink and TCP/IP. The functions implemented for the access to the S7 series 300 and S7 series 400 via the Profibus cards of the company Softing. Additional functions for storing, loading, reading and writing of parameters of the news modules implemented. Function AGLink_Config.EXE adapted to the changed structures and latest supported communication hardware and release check implemented. An additional function AGLGetDLLVersionEx implemented. This also provides besides the principal and secondary release number also the
15.05.2002 RH 23.05.2002 RH
04.06.2002 RH
13.06.2002 RH
14.06.2002 RH
05.07.2002 RH
Seite 219
provides besides the principal and secondary release number also the build number and the creation date.. 06.07.2002 RH An additional support program AGLink_Performance.EXE written. This program is in the directory AGLink_Tools and determines the data throughput based on the selected communication hardware. It is looking in the attached PLC for the respectively largest data block and then consults it for the measuring of the reading throughput. Optionally the writing throughput also can be determined. Release 3.0 approved.
08.07.2002 RH
10.3.2
Version 3.1
Was Improvement of error handling series S7-200.
15.11.2002 UWa Implementation of AGLink for DotNet with corresponding example programs in C# and VB.net 15.11.2002 AE 18.11.2002 Hre 11.12.2002 RH 12.12.2002 RH English version of file AGLink_Error.TXT. LabVIEW-syntax implementation completed. problem (TCP/IP version) for AGLPLCConnect immediately after AGLPLCDisconnect solved. Change of function AGLGetErrorMsg. the error file is no longer expected in the directory of the EXE but in the directory AGLink.DLL. In the past this constellation caused problems especially in the development environment (VB, LabVIEW). Change of function AGLConfig. the program AGLink_Config.EXE is searched first in the directory AGLink.DLL. If not found there, it will be searched in the path. New functions implemented for copying of strings into a Byte buffer (AGLString2Buff) and for copying of a Byte buffer into a string (AGLBuff2String). This simplifies the handling under e.g. VB. New function implemented for returning a signed 16 bit integer from a byte buffer (AGLReadInt16). New function implemented for accessing to a control with e.g. a separate Profibus-CP with information of rack and slot number of the CPU (AGLPLCConnectEx). Complete implementation of in release 3.0 prepared connection types (PG, OP and Others). Complete implementation of in release 3.0 prepared connection profiles (MPI, DP, standard and universal (DP/FMS)). New function implemented for loading the error text (AGLLoadErrorFile) especially for changing the message language. file
12.12.2002 RH
12.12.2002 RH
12.12.2002 RH 18.12.2002 RH
New function implemented for accessing the peripherical area These functions are AGLReadPInBytes for reading from the peripherical input area and AGLWritePOutBytes for writing to the peripherical output area. Additional type (TYPE_PERIPHERIE) implemented for the functions AGLReadMix and AGLWriteMix, this enables the access to the
23.12.2002 RH
Page 220
Industrial PLC-Communication Suite peripherical areas. CAUTION: the use of the size constant SIZE_BIT is not supported in these cases and leads to an error code (PARA_ERR).
23.12.2002 RH 27.12.2002 RH
PB/NetLinkDRV support improved and function AGLInitAdapter for PB/NetLinkDRV optimized. New function implemented for returning the diagnostic buffer of a control (AGLReadDiagBuffer) and translation of the binary content in plain text (AGLReadDiagBufferEntry). Examples for Microsoft Office implemented. Change of installation because of size and number of DotNet-examples. Files that are used for all example programs (AGLink.DLL, AGLink_Config.EXE, AGLink_Error.TXT, AGLink_Error.ENG) are listed only in the directory AGLink_Redist. We recommend to copy these files in the Windows system directory or in the directory of the corresponding example. Please consider the notes in the DotNet subdirectory. Error during reading of timer and counter words corrected. Handling of initialization errors in the modules S7-MPI serial and S7-MPI serial/TS improved. Release 3.1 approved.
Seite 221
Page 222
11 Appendix C
11.1 Software license agreement Terms and conditions for the software cession of individual user licenses version 2000-12-08
1.
1.1
1.2
1.3
Object of the contract is the use of the license that is listed in the order confirmation and/or in the delivery note.
2.
2.1
License grants
For the contract duration the licenser gives the licensee the non-exclusive and non-transferable cash right to use the Software Application Programming Interface, inclusive of the functionality of one license on a single computer, summarizing called platform, and used by a single individual user. A use of the copy of a license by more or different persons is not permitted unless something else is particularly agreed in these terms and conditions. If multiple copies have been purchased the licensee is authorized to install the license on one computer. The licensee is entitled under consideration of section 2.1 to make the use of the license possible for the number of persons in accordance with the number of acquired copies of a license. For data saving and disaster-recovery purposes the licensee is also authorized to make (a) a backup copy of the license or (b) to transfer the license to a hard disk and to keep the original copy solely. Applying to the distribution of software products which have been created with Java libraries or libraries of the licenser: The licensee is entitled to distribute software products which have been developed with the license and are not appointed as software development tool, in this respect that the access to the functionality of the license by means of Software Application Programming Interface and Value-Added interface - direct and indirect- is not able.
2.2
2.3 2.4
Seite 223
License restrictions
The software is in the property of the licenser or his suppliers. It is on copyright, civil law and criminal protected and the licensee may use it only according to the available terms and conditions for licensees. The license is granted neither exclusive nor a transferable usufruct. The licensee is not entitled to the external distribution a) of any components of the Software Application Programming Interface b) of any components of the Value-Added interface and c) any executable delivered with the software unless other conditions are particularly agreed in these terms and conditions.
3.4
Furthermore the licensee is not authorized to: a) decompile, disassemble or reverse engineer any object code form of any part of the software b) rent or lend the software, c) disclose the source code of the software to any person or entity d) copy the product documentation including all on-line available documentation.
4.0
4.1
4.2
4.3 4.4
5.0
5.1
Limited warranty
It is pointed out that it is not possible for the current developments in technology to develop computer software that works error-free in all conceivable combinations and applications. Object of the contract and object of the warranty is therefore a in principle useable software according to the product documentation. The software requires the application by a software programmer with experience in the application of development tools and class libraries. The software isn't designed to the application of laymen like private consumers or for the private domestic use. The licenser ensures that the after delivery unchanged software under normal operating conditions and normal maintenance fulfils all functions essentially which arise from the product documentation. The warranty period starts with delivery and is 6 months. Defects have to be immediately announced to the licenser in writing and described in detail. At first the warranty right is restricted to improvement. After this the licenser makes all reasonable efforts for the remedying of considerable, proved and lasting defects of the unchanged software. If the defect isn't cleared by the licenser within an adequate time period by improvement or by substitute delivery, then the licensee can reduce the license fee adequately or demand redhibition of the contract. In the case of a substitute delivery or the redhibition of the contract the scheduled obligations of the licensee in paragraphs 2, 3 and 4 remain valid. The licensee can agree on further-reaching maintenance and help performances at the use of the left software on the basis of a maintenance agreement to be compensated separately on the respectively applicable maintenance terms of the licenser. If the licensee has used improvement although there was not a defect then he has to compensate adequately the service of the licenser for the check of the facts.
5.7
5.8
6.2 6.3
7.0
7.1 7.2
8.0
8.1 8.2
Miscellaneous
Place of performance is the respective residence of the licenser. Supplementary agreements or contract changes and additions require the in writing. The terms and conditions regulated here are more important than contrary conditions which can appear at the call of the software over display. Other general terms and Conditions, particularly those of the licensee do not become contract contents even when the licenser doesn't contradict particularly. Place of jurisdiction is Schwbisch Gmnd provided that the licensee is full merchant. This contract is subject to the right of the Federal Republic of Germany. If a regulation of these terms and conditions should be trivial, ineffective or impracticable, then this does not touch the effectiveness of the contract in the whole. The legal regulation takes the place of the trivial, ineffective or impracticable determination that corresponds the most to the intended.