ETH-RELAIS-8 / OPTOIN-8 - DEDITECdeditec.de/pdf/manual_e_eth-relais-8-optoin-8.pdf · ETH-RELAIS-8...

107
Hardware-Description Oktober ETH-RELAIS-8 / OPTOIN-8 2015

Transcript of ETH-RELAIS-8 / OPTOIN-8 - DEDITECdeditec.de/pdf/manual_e_eth-relais-8-optoin-8.pdf · ETH-RELAIS-8...

Hardware-Description

Oktober

ETH-RELAIS-8 / OPTOIN-8

2015

INDEX

Index | 2Seite

1. Introduction 7

1.1. General remarks 7

1.2. Customer satisfaction 7

1.3. Customer response 7

2. Hardware description 9

2.1. Quick installation 9

92.1.1. Step 1 - Installation of the software and driver 92.1.2. Step 2 - Connecting of the module 92.1.3. Step 3 - Testing the connection and the module

102.1.4. DIP-Switches

2.2. ETH-RELAIS-8 12

122.2.1. Technical data 122.2.2. Product pictures 132.2.3. Overview screen 142.2.4. Pin assignment 142.2.4.1. Pin assignment J1

142.2.4.2. Pin assignment J2

152.2.5. Outputs 152.2.5.1. Relay outputs

152.2.5.2. Timeout protection

15

2.2.5.3. Visual control of the outputs (depends ofmodule)

2.3. ETH-OPTOIN-8 16

162.3.1. Technical data 172.3.2. Product pictures 182.3.3. Overview screen 192.3.4. Pin assignment 192.3.4.1. Pin assignment J1

192.3.4.2. Pin assignment J2

202.3.5. Inputs 202.3.5.1. Registering short input pulses

202.3.5.2. Galvanically decouppled through optocouplers

202.3.5.3. Visual control of the inputs (depends of module)

INDEX

Index | 3Seite

3. Hardware 23

3.1. LED blinking behavior 23

3.2. DIP-Switches 25

4. Firmware update 30

4.1. DEDITEC Flasher 30

5. Software 34

5.1. Using our products 34

345.1.1. Access via graphical applications 345.1.2. Access via the DELIB driver library 345.1.3. Access via protocol 355.1.4. Access via provided test programs

5.2. DELIB driver library 36

365.2.1. Overview 365.2.1.1. Program under diverse operating systems

375.2.1.2. Program with diverse programming languages

375.2.1.3. Program independent of the interface

375.2.1.4. SDK-Kit for Programmer

385.2.2. Supported operating systems 385.2.3. Supported programming languages 395.2.4. Installation DELIB driver library 415.2.5. DELIB Configuration Utility

5.3. Integration of the DELIB 42

425.3.1. Integration of the delib.h in Visual-C/C++ 455.3.2. Integration of the delib.cs in Visual-C# 465.3.3. Integration of the delib.cs in Visual-C# unter Windows 64bit 505.3.4. Integration of the delib.pas in Delphi 515.3.5. Integration of the delib.bas in Visual Basic 525.3.6. Integration of the delib.vb in VB.NET 535.3.7. Integration of the delib.bas in MS-Office (VBA) 555.3.8. Integration of the delib.dll in LabVIEW 555.3.8.1. Integration of the delib.dll in LabVIEW

645.3.8.2. Usage of the VIs in LabVIEW

INDEX

Index | 4Seite

5.4. Test programs 66

665.4.1. Digital Input-Output Demo

5.5. DELIB CLI (command-line interface) 67

695.5.1. Customisation for USB-Modules (only Linux) 705.5.2. Customisation for RO-ETH-Modules (only Linux) 715.5.3. DELIB CLI samples

6. DELIB API reference 76

6.1. Management functions 76

766.1.1. DapiOpenModule 776.1.2. DapiCloseModule 786.1.3. DapiGetDELIBVersion 796.1.4. DapiSpecialCMDGetModuleConfig 816.1.5. DapiOpenModuleEx

6.2. Error handling 82

826.2.1. DapiGetLastError 836.2.2. DapiGetLastErrorText

6.3. Reading Digital inputs 84

846.3.1. DapiDIGet1 856.3.2. DapiDIGet8 866.3.3. DapiDIGet16 876.3.4. DapiDIGet32 886.3.5. DapiDIGet64 896.3.6. DapiDIGetFF32 906.3.7. DapiDIGetCounter 916.3.8. DapiSpecialCounterLatchAll 926.3.9. DapiSpecialCounterLatchAllWithReset 936.3.10. Dapi_Special_DI_FF_Filter_Value_Get 946.3.11. Dapi_Special_DI_FF_Filter_Value_Set

6.4. Setting Digital outputs 95

956.4.1. DapiDOSet1_WithTimer 966.4.2. DapiDOSet1 976.4.3. DapiDOSet8 986.4.4. DapiDOSet16

INDEX

Index | 5Seite

996.4.5. DapiDOSet32 1006.4.6. DapiDOSet64 1016.4.7. DapiDOReadback32 1026.4.8. DapiDOReadback64

6.5. Example program 103

7. Appendix 106

7.1. Revisions 106

7.2. Copyrights and trademarks 107

I

Introduction |Seite 6

Introduction

Introduction |Seite 7

1. Introduction

1.1. General remarks

First of all, we would like to congratulate you to the purchase of a high qualityDEDITEC product.

Our products are being developed by our engineers according to qualityrequirements of high standard. Already during design and development we takecare that our products have -besides quality- a long availability and an optimalflexibility.

Modular design

The modular design of our products reduces the time and the cost of development.Therefor we can offer you high quality products at a competitive price.

Availability

Because of the modular design of our products, we have to redesign only a moduleinstead of the whole product, in case a specific component is no longer available.

1.2. Customer satisfaction

Our philosophy: a content customer will come again. Therefor customersatisfaction is in first place for us.

If by any chance, you are not content with the performance of our product, pleasecontact us by phone or mail immediately.

We take care of the problem.

1.3. Customer response

Our best products are co-developments together with our customers. Therefor weare thankful for comments and suggestions.

II

Hardware description |Seite 8

Hardware description

Hardware description |Seite 9

2. Hardware description

2.1. Quick installation

2.1.1. Step 1 - Installation of the software and driver

Now install the driver DELIB library with the file "delib_install.exe" from the suppliedDEDITEC-Driver CD.

These can be found in the "\zip\DELIB\delib_install.exe" on the DEDITEC-DriverCD.

Note: On our website www.deditec.de you can always find the latest DELIB driverversion.

2.1.2. Step 2 - Connecting of the module

Connect the ETH-RELAIS-8 or the ETH-OPTOIN-8 with a ethernet cable with yournetwork or PC.

2.1.3. Step 3 - Testing the connection and the module

In the Start menu, see "Start -> All Programs -> DEDITEC -> DELIB -> SamplePrograms" you will find some example programs to test your module.

Hardware description |Seite 10

2.1.4. DIP-Switches

You can configure DHCP- and EEPROM settings on the module directly via DIP-Switches.

Achtung: Alle Änderungen an den DIP-Schaltern werden nur nach Trennung undWiederherstellung der Spannungsversorgung übernommen.

DIP Switch1

Mode / Description

ON DHCP is active

The network settings IP, subnet mask, DNS-Domain andgateway will be received from a DHCP Server.

OFF DHCP is not active

The network settings ip, subnet mask, DNS-Domain andgateway from the module (EEPROM) itself will be used.

With the DELIB-Configuration Utility those settings can be editedand saved in to the EEPROM of the module.

Hardware description |Seite 11

DIP Switch2

Mode / Description

ON EEPROM is write protected

If the write protection is on, no settings can be configured via theDELIB-Configuration Utility.

OFF EEPROM write protection is off

DIP Switch3

Mode / Description

ON The settings from the EEPROM will be ignored on module start.The modul will start with factory settings. The settings which willbe ignored are the IP-address, gateway, subnet mask andDHCP.

Factory settings:

IP: 192.168.1.1

Subnet mask: 255.255.255.0

Gateway: 192.168.1.254

DHCP: Off

The settings in the EEPROM will not be changed.

OFF The module will start with the settings from the EEPROM

DIP Switch4

Mode / Description

ON Modul will start normally.

OFF Only for service.

The module will stay in bootloader mode and won't start thefirmware. All settings in the EEPROM will not be changed.

Hardware description |Seite 12

2.2. ETH-RELAIS-8

2.2.1. Technical data

Ethernet-Interface 100/10Mbit

Power supply: External 12-24V DC

8 Relays outputs (36V, 1A, 10W, make contact)

Max. switching voltage: 36V DC

Max. switching current: 0,5A

Max. switching power: 10W

Max. transport current: 1,25A

Isolation : 5TOhm

Switching time: 0,5ms

Fall time: 0,1ms

Timeout protection

2 Control-LEDs (Status, Interface activity)

8 LED Output-LEDs, one for each output

Dimensions: 77 x 67,5 x 55 mm (L x B x H)

Operation temperature: 10°C .. 50°C

2.2.2. Product pictures

ETH-RELAIS-8

Hardware description |Seite 13

2.2.3. Overview screen

Hardware description |Seite 14

2.2.4. Pin assignment

2.2.4.1. Pin assignment J1

Pin Description

1 Output Channel 1

2 Output Channel 1

3 Output Channel 2

4 Output Channel 2

5 Output Channel 3

6 Output Channel 3

7 Output Channel 4

8 Output Channel 4

2.2.4.2. Pin assignment J2

Pin Description

9 Output Channel 5

10 Output Channel 5

11 Output Channel 6

12 Output Channel 6

13 Output Channel 7

14 Output Channel 7

15 Output Channel 8

16 Output Channel 8

Hardware description |Seite 15

2.2.5. Outputs

2.2.5.1. Relay outputs

The relays are able to switch voltages up to 36V. The max. current is 1A at a max.power of 15W.

Additionally, the relays provide a safe electrical isolation of the module to theconnected equipment.

2.2.5.2. Timeout protection

The timeout-protection gives the possibility to switch-off automatically the outputsto prevent damage. This takes place, if in a predefined time frame anycommunication with the module was possible. Reasons could be cable disruption,PC-crash and so on. This way damage control, surcharge of connected equipmentand risk of accidents can be avoided.

2.2.5.3. Visual control of the outputs (depends of module)

The state of each output is directly signalized by a separate LED. This simplifies todetect and rectify wiring errors, because the signals on the cables are directlyobservable.

Hardware description |Seite 16

2.3. ETH-OPTOIN-8

2.3.1. Technical data

Ethernet-Interface 100/10MbitPower supply: External 12-24V DC8 opto-coupler inputs

24V AC switching voltage (optional 15V, 12V and 5V are available)

16 Bit-Counter for each input

Detection of pulses between two selection cycles

Galvanically isolated using opto-couplers

Variable input voltage range min 5V, max 30V AC (standard: 15-30V)

Logging of impulses between 2 read out cycles

Control-LED LED for 5V power supply Dimensions: 77 x 67,5 x 55 mm (L x W x H)

Operating temperature: 10°C .. 50°C

Hardware description |Seite 17

2.3.2. Product pictures

ETH-RELAIS-8

Hardware description |Seite 18

2.3.3. Overview screen

Hardware description |Seite 19

2.3.4. Pin assignment

2.3.4.1. Pin assignment J1

Pin Description

1 Input Channel 1 +

2 Input Channel 1 -

3 Input Channel 2 +

4 Input Channel 2 -

5 Input Channel 3 +

6 Input Channel 3 -

7 Input Channel 4 +

8 Input Channel 4 -

2.3.4.2. Pin assignment J2

Pin Description

9 Input Channel 5 +

10 Input Channel 5 -

11 Input Channel 6 +

12 Input Channel 6 -

13 Input Channel 7 +

14 Input Channel 7 -

15 Input Channel 8 +

16 Input Channel 8 -

Hardware description |Seite 20

2.3.5. Inputs

2.3.5.1. Registering short input pulses

Short input pulses between to read-out cycles are registered through an additionallogic and can be separately read-out.

2.3.5.2. Galvanically decouppled through optocouplers

AC input opto-couplers provide a galvanic isolation of the module towards theconnected equipment. They also provide a safe connection to the module forreverse currents and high voltage peaks.

2.3.5.3. Visual control of the inputs (depends of module)

The state of each input is directly signalized by a separate LED. This simplifies todetect and rectify wiring errors, because the signals on the cables are directlyobservable.

Note: Only available for the ETH-RELAIS-8 and ETH-RELAIS-8_B module

Hardware description |Seite 21

III

Hardware |Seite 22

Hardware

Hardware |Seite 23

3. Hardware

3.1. LED blinking behavior

Description

1.) Boot sequence

The boot sequence starts directly after connecting the power supply.

The boot sequence runs only once.

2.) Application or bootloader

2.1 Application

The boot squence was successfull and the module is now in the application. Themodule is now ready.

The Status-LED turns on for 5 seconds and turns off for 300ms. This LED-sequence repeats as long as the module stays in the application and is ready.

Hardware |Seite 24

In addition the Status-LED modules on modules with ethernet-interface (exceptRO-ETH and RO-CPU-800) will show the network status.

Status-LED turns off once = static IP

Status-LED turns off twice = IP via DHCP

Status-LED turns off thrice = Can't get IP via DHCP e.g. no DHCP server could bereached

Hardware |Seite 25

2.2. Bootloader

If the module stays in the bootloader, something went wrong. This means forexample a error in the firmware occoured.

In most cases, the problem can be fixed via installing the newest firmware onto themodule.

The newest firmware can be downloaded via the DT-Flasher tool. ( => seeFirmware Update )

The Status-LED turns on for 2 seconds and turns off for 300ms. This sequencerepeats.

3.) Force Bootloader

The module can be forced in to the bootloader via DIP-Switches. The bootloader isonly for service applications.

The Status-LED turns on and off for 2 seconds. This sequence runs only once.3.2. DIP-Switches

With the DIP-switches the DHCP and EEPROM-settings can be configured.

Hardware |Seite 26

Note: To take effect of the DIP-Switches you need to restart the module byremoving the power supply.

DIP Switch1

Mode / Description

ON DHCP ist active

The network settings (IP, subnetmask, DNS-Domain andGateway) will be received from a DHCP-Server from yournetwork.

OFF DHCP is inactiv

The network settings (IP, subnetmask, DNS-Domain andGateway) will be used from the EEPROM of the module.

With the DELIB-Configuration-Utility can those settings bechanged.

Hardware |Seite 27

DIP Switch2

Mode / Description

ON EEPROM write-protection is on

No settings with the DELIB-Configuration-Utility can be made.

OFF EEPROM write-protection is off

DIP Switch3

Mode / Description

ON The module will start with the saved settings from the EEPROM.

OFF All saved values in the EEPROM (IP-Adresse, Gateway,Subnetzmaske, DHCP) will be ignored.

The module will start with the default settings.

Default Settings:

IP: 192.168.1.1

Subnetzmaske: 255.255.255.0

Gateway: 192.168.1.254

DHCP: Off

All settings in the EEPROM will be preserved.

DIP Switch4

Mode / Description

ON Modul will start normally

OFF For service only

Modul will stay in bootloader mode and won't start theapplication.All settings in the EEPROM will be preserved.

Hardware |Seite 28

Geben Sie hier den Text ein.

IV

Firmware update |Seite 29

Firmware update

Firmware update |Seite 30

4. Firmware update

4.1. DEDITEC Flasher

You can find the latest firmware version for your DEDITEC product always at thedownload section of our homepage.

( -> http://www.deditec.de/en/module/downloads/firmware-updates.html )

Approach after download

Unzip the ZIP archive

Start the program deditec-flasher.exe

The following application will be opened:

You can find a detailed description of the available commands on the followingpage.

Firmware update |Seite 31

1. Select the Interface of the module of the RO-Series

Command (Key) Interface

U USB-Interface

S Serial Interface (RS-232 / RS-485)

C CAN-Interface

E Ethernet-Interface

V USB2-Interface

Note:

1) The current selected interface will be displayed in the last line (Selected Device= USB)

2) Press key Q to flash "non-RO-Series-products" (USB-Mini-Sticks, USB-Logi-500, ..)

3) In order to flash products of the RO-CAN-Series, you have to connect themodule with your PC via the CAN/SER adapter.

2. Additional options

Command (Key) Description

D Flasher runs in DEBUG mode

Therefore, additional information will be displays

P Reads the current firmware of connected DEDITECproducts

3. Select the module which you want to flash (RO-Series only)

Command (Key) Description

M Flash the RO-Interface module

A Flash all AD16, AD16-DA4, DA4 or AD16_ISO submodules

B Flash all DA2_ISO sub modules

G Flash all STEPPER2 sub modules

H Flash all O8-R8 or M16 sub modules

I Flash all PT100 sub modules

J Flash all CNT8 or CNT/IGR sub modules

Z Scan the module for available sub modules

Firmware update |Seite 32

After successful update procedure, the message FLASH-OK! appears.

V

Software |Seite 33

Software

Software |Seite 34

5. Software

5.1. Using our products

5.1.1. Access via graphical applications

We provide driverinterfaces e.g. for LabVIEW and ProfiLab. The DELIB driverlibrary is the basis, which can be directly activated by ProfiLAB.

For LabVIEW, we provide a simple driver connection with examples!

5.1.2. Access via the DELIB driver library

In the appendix, you can find the complete function reference for the integration ofour API-functions in your software. In addition we provide examples for thefollowing programming languages:

C

C++

C#

Delphi

VisualBasic

VB.NET

MS-Office

5.1.3. Access via protocol

The protocol for the activation of our products is open source. So you are able touse our products on systems without Windows or Linux.

Software |Seite 35

5.1.4. Access via provided test programs

We provide simple handling test programs for the most important functions of ourproducts. These will be installed automatically by the installation of the DELIBdriver library.

So you can test directly e.g. relays or you can check the voltage of an A/Dconverter.

Software |Seite 36

5.2. DELIB driver library

5.2.1. Overview

The following figure explains the structure of the DELIB driver library

The DELIB driver library allows an uniform response of DEDITEC hardware withparticular consideration of the following viewpoints:

Independent of operating system

Independent of programming language

Independent of the product

5.2.1.1. Program under diverse operating systems

The DELIB driver library allows an uniform response of our products on diverseoperating systems.

We has made sure, that all of our products can be responded by a few commands.Whatever which operating system you use. - Therefore the DELIB cares!

Software |Seite 37

5.2.1.2. Program with diverse programming languages

We provide uniform commands to create own applications. This will be solved bythe DELIB driver library.

You choose the programming language!

It can be simply developed applications under C++, C, Visual Basic, Delphi orLabVIEW®.

5.2.1.3. Program independent of the interface

Write your application independent of the interface !

Program an application for an USB product of us. - Also, it will work with anethernet or RS-232 product of us !

5.2.1.4. SDK-Kit for Programmer

Integrate the DELIB in your application. On demand you receive an installationscript for free, which allows you, to integrate the DELIB installation in yourapplication.

Software |Seite 38

5.2.2. Supported operating systems

Our products support the following operating systems:

Windows 7

Windows Vista

Windows XP

Windows 2000

Linux

5.2.3. Supported programming languages

Our products are responsive via the following programming languages:

C

C++

C#

Delphi

VisualBasic

VB.NET

MS-Office

Software |Seite 39

5.2.4. Installation DELIB driver library

Start screen of the DELIB installer

Insert the DEDITEC driver CD into the drive and start „delib_install.exe“. TheDELIB driver library is also available on http://www.deditec.en/delib

Click on „Install“.

Software |Seite 40

The drivers will be installed.

The DELIB driver library is now installed. Press „Close“ to finish the installation.

You can configure your module with the „DELIB Configuration Utility“ (see nextchapter). This is only necessary, if more than one module is present.

Software |Seite 41

5.2.5. DELIB Configuration Utility

Start the “DELIB Configuration Utility” as follows:

Start Programs DEDITEC DELIB DELIB Configuration Utility.

The „DELIB Configuration Utility“ is a program to configure and subdivideidentical USB-modules in the system. This is only necessary if more than onemodule is present.

Software |Seite 42

5.3. Integration of the DELIB

5.3.1. Integration of the delib.h in Visual-C/C++

Description of the DELIB integration in Visual-C/C++

The DELIB Installation defines environment variables to facilitate links to theDELIB-include and DELIB-lib directory.

DELIB_LIB = C:\Programs\DEDITEC\DELIB\lib

DELIB_INCLUDE = C:\Programs\DEDITEC\DELIB\include

Start Visual-C/C++ and open via menu "Projekt -> Einstellungen"

Software |Seite 43

DELIB.H entry in the Visual-C/C++ Project configurations

Under the tab "C/C++" choose the "Kategorie" Präprozessor and enter on"Zusätzliche Include Verzeichnisse" "$(DELIB_INCLUDE)".

Software |Seite 44

DELIB.LIB entry in the Visual-C/C++ Project configurations

Under the tab "Linker" extend the existing line in "Zusätzliche IncludeVerzeichnisse" with the ending "$(DELIB_LIB)\delib.lib"

Software |Seite 45

5.3.2. Integration of the delib.cs in Visual-C#

Description of the DELIB integration in Visual-C#

You can find the needed files for Visual-C# in the directory C:\Programme\DEDITEC\DELIB\Include\delib.cs. Start Visual-C# and open viamenu "Projekt -> Vorhandes Element hinzufügen" in the directory C:\Programme\DEDITEC\DELIB\Include\ the file "delib.cs" to import.

Add the following reference in your program:using DeLib;

Software |Seite 46

5.3.3. Integration of the delib.cs in Visual-C# unter Windows 64bit

Program sample for the DELIB driver library under Windows 64 Bit

In the following sections there is a description how to compile the project as "x86"

Show all settings

Open the options via menue "Extras -> Optionen"

Check “Alle Einstellungen anzeigen"

Software |Seite 47

Check under "Projekte und Projektmappen" "Erweiterte Buildkonfigurationenanzeigen".

Software |Seite 48

The Configuration Manager

Open the configuration manager via "Any CPU -> Konfigurations-Manager...".

In the configuration manager select under der column "Plattform" "Any CPU ->Neu...".

Under "Neue Plattform" select "x86".

Software |Seite 49

Start debugging

You can start the debugging as normal via the "Start-Button". Note that the toolbarcombobox for Platform Configuration now lists both "x86" and "AnyCPU" and has"x86" selected

Software |Seite 50

5.3.4. Integration of the delib.pas in Delphi

Description of the "delib.pas" integration in Delphi

You can find the needed files for Delphi in the directory C:\Programme\DEDITEC\DELIB\include\delib.pas.

Start Delphi and open via menu "Projekt -> dem Projekt hinzufügen" the file "delib.pas" to import.

Software |Seite 51

5.3.5. Integration of the delib.bas in Visual Basic

Description of the "delib.bas" integration in Visual Basic

You can find the needed files for VB in the directory C:\Programme\DEDITEC\DELIB\include\delib.bas.

Start Visual Basic and open via menu "Projekt -> Datei hinzufügen..." the file"delibi.bas" to import.

Software |Seite 52

5.3.6. Integration of the delib.vb in VB.NET

Description of the DELIB integration in VB.NET

You can find the needed files for VB.NET in the directory C:\Programme\DEDITEC\DELIB\Include\delib.vb. Start VB.NET and open via menu"Projekt -> Vorhandes Element hinzufügen" in the directory C:\Programme\DEDITEC\DELIB\Include\ the file "delib.vb" to import.

Software |Seite 53

5.3.7. Integration of the delib.bas in MS-Office (VBA)

Description of the "delib.bas" integration in Visual Basic for Applications

You can find the needed files for VBA in the directory C:\Programme\DEDITEC\DELIB\include\delib.bas.

Start Microsoft Excel and open via menu "Extras -> Makro -> Visual Basic Editor".

Software |Seite 54

Creation of UserForm

Create a new UserForm via menu "Einfügen -> UserForm". In the top left-handcorner of the project manager right click on "UserForm -> Datei importieren". Openin the directory C:\Programme\DEDITEC\DELIB\include the file "delib.bas" toimport.

Software |Seite 55

5.3.8. Integration of the delib.dll in LabVIEW

5.3.8.1. Integration of the delib.dll in LabVIEW

The LabVIEW-Sampleprogram "Deditec_Modul_Control.vi" is not a EXE-File andyou need to execute this file the LabVIEW development environment.

Description of the delib.dll integration in LabVIEW Version 11

- You can find the needed files for LabVIEW in the directorys

"C:\Windows\System32\delib.dll" and "C:\Programme\DEDITEC\DELIB\include\ delib.h"

- Start LabVIEW and open the menu "Tools -> Import -> DLL ..."

Software |Seite 56

- Choose the option "create VIs for DLL" and press continue

Software |Seite 57

- In the next window, choose the path to the delib.h and delib.dll and press continue

Software |Seite 58

- Press continue again

- The Header-File will now be analized. Afterwards press continue.

Software |Seite 59

- Follow the instructions and configurate the name and the saving location for theVIs.

Software |Seite 60

- In the new window choose "Easy error correction" in the drop-down menu andpress continue.

Software |Seite 61

- VIs which are working with 64-bit values must be edited. The display must bechanged from "unsigned long" to "unsigned quad".

- The following VIs must be edited:

-> DapiCNT48CounterGet48 (function return)

-> DapiDIGet64 (function return)

-> DapiDOSet64 (data)

-> DapiDOReadBack64 (function return)

Software |Seite 62

- In addition for some VIs you need to change the elementype to "numeric".

- The following VIs must be edited:

-> DapiWriteLongLong (value)

-> DapiReadLongLong (function return)

- Afterwards press continue.

Software |Seite 63

- You recive a summary of the executed steps.

- Press continue

- The VIs will now be created and are ready to use.

Software |Seite 64

5.3.8.2. Usage of the VIs in LabVIEW

Some functions of the DELIB-library are expecting a string as a parameter value.

This example shows how to use such functions in LabVIEW.

We will use the A/D converter function which is used to set the voltage range as anexample.

The definition of this function is:void DapiADSetMode(ULONG handle, ULONG ch, ULONG mode);

The voltage ranges for this function are already defined in the DELIB-library.

Example code in C/C++:DapiADSetMode(handle, 0, ADDA_MODE_UNIPOL_5V);

This code can also be written like this:DapiADSetMode(handle, 0, 1);

In the delib.h file can you read the hexadecimal values to determine the modes.The hex values must be convertet to decimal.

After the installation of the DELIB-library, the delib.h file is located in the followingdirectory: C:\Programs\Deditec\DELIB\Include\delib.h

Software |Seite 65

The function could look like this in LabVIEW:

The channel and mode are passed as unsigned long

Software |Seite 66

5.4. Test programs

5.4.1. Digital Input-Output Demo

Start “Digital Input-Output Demo” as follows:

Start Programme DEDITEC DELIB Digital Input-Output Demo.

The screenshot shows a test of the RO-USB-O64-R64. The configuration of themodule (64 inputs and 64 outputs) is shown on the upper left side.

Software |Seite 67

5.5. DELIB CLI (command-line interface)

In some programming languages (like PHP), you can't include DLLs, therefore isan extra console command, which you can directly call out of the program (withappropriate parameters). You can find this command after installation of the DELIBdriverlibrary in the directory C:\Programme\DEDITEC\DELIB\Programs\Console.

You can find the DELIB CLI Command for Windows after Installation of the DELIBdriverlibrary in the directory C:\Programme\DEDITEC\DELIB\programs\cli\ .

The DELIB CLI Command for Linux is located in the directory "/deditec-cli/, afterunzipping the ZIP-Archiv "delib-linux-cli".

Definition (Windows)

delib_cli command channel [value | unit ["nounit"] ]

Definition for USB-Module (Linux)

sudo delib-cli-usb command channel [value | unit ["nounit"] ]

Definition for RO-ETH-Module (Linux)

delib-cli-eth command channel [value | unit ["nounit"] ]

Note: The parameters are separated by spaces.

These commands and parameters are not case sensitive.

Parameter

command channel value unit nounit

di1 0, 1, 2, ...

- hex nounitdi8

0, 8, 16, ...di16

di24

do1 0, 1, 2, ... 0/1 (1-bit command)

- -do8

0, 8, 16, ...8-bit value

(Bit 0 for channel 1, Bit1 for channel 2, ...)do16 16-bit value

do24 24-bit value

ai 0, 1, 2, ... - hex, volt, mA nounit

ao 0, 1, 2, ...

integer or hexadecimal number

(starting with 0x).

For an integer a V for Volt, mA formilli Ampere can be attached.

- -

Software |Seite 68

Return-value

Read state of the inputs (in combination with command = di, di8, di16, di32 andai).

Read state of the inputs as hexadecimal (in combination with command = di, di8,di16, di32 and ai and unit "hex")

Voltage of the input (in combination with unit "volt" and command "ai")

Current of the input (in combination with unit "mA" and command "ai")

Software |Seite 69

5.5.1. Customisation for USB-Modules (only Linux)

In order to access the right module under Linux via DELIB CLI, you have to set themodule id at the command "DapiOpenModule". Therefore you can find in thedirectory "/deditec-cli/source" the file "delib_cli_open_module_usb.c" afterunzipping the ZIP archive.

By default, the program "delib-cli-usb" (see source code) tries to open a RO-USBmodule. If the module is not found, it will try to open an USB-Mini-Stick, and so on...

Since this causes unnecessary error-messages, you can simply remark notneeded entries.

#include "../../delib-sources/delib/delib.h"

ULONG handle;

ULONG delib_cli_open_module(){

handle = DapiOpenModule(RO_USB, 0);if(handle==0){

handle = DapiOpenModule(USB_MINI_STICK, 0);}if(handle==0){

handle = DapiOpenModule(USB_RELAIS_8, 0);}if(handle==0){

handle = DapiOpenModule(USB_OPTOIN_8_RELAIS_8, 0);}if(handle==0){

handle = DapiOpenModule(USB_OPTOIN_16_RELAIS_16, 0);}if(handle==0){

handle = DapiOpenModule(USB_OPTOIN_32_RELAIS_32, 0);}

return handle;}

Note:

The project "delib-cli-usb" has to recompiled after each modification. Therefore,you can find in the directory "/deditec-cli/", the shell script "compile_delib_cli_usb.sh", with which you can compile the project under Linux.

Software |Seite 70

5.5.2. Customisation for RO-ETH-Modules (only Linux)

In order to access a RO-ETH module under Linux, you have to set IP address of themodule. Therefore you can find in the directory "/deditec-cli/source" the file"delib_cli_open_module_eth.c" after unzipping the ZIP archive.

You have to modify following entry:

#include "../../delib-sources/delib/delib.h"

extern char global_ip_addr[];ULONG handle;

ULONG delib_cli_open_module(){

sprintf(global_ip_addr, "192.168.1.11"); // Set the IP address of the RO-ETHmodule here

handle = DapiOpenModule(RO_ETH,0);

return handle;}

Note:

The project "delib-cli-eth" has to recompiled after each modification. Therefore,you can find in the directory "/deditec-cli/", the shell script "compile_delib_cli_eth.sh", with which you can compile the project under Linux.

Software |Seite 71

5.5.3. DELIB CLI samples

Digital Outputs

Windowsdelib_cli DO1 17 1-> digital output 18 will be switched on

delib_cli DO1 3 0-> digital output 4 will be switched on

delib_cli DO8 0 255-> digital outputs 1-8 will be switched on

delib_cli DO16 0 0-> digital outputs 1-16 will be switched off

delib_cli DO16 16 65535-> digital outputs 17-32 will be switched on

delib_cli DO32 0 4294967295-> digital outputs 1-32 will be switched on

Linuxsudo delib_cli _usb DO1 17 1-> digital output 18 of an USB-Module will be switched on

delib_cli _eth DO1 3 0-> digital output 18 of a RO-ETH-Module will be switched off

Software |Seite 72

Digitale Inputs

Windowsdelib_cli DI1 3Example of a return value: 1 -> reads the state of digital input 4

delib_cli DI8 0 hexExample of a return value: 0xFF-> reads the state of digital input 4 as hexadecimal

delib_cli DI16 0 hexExample of a return value: 0xFFFF-> reads the state of digital inputs 1-16 as hexadecimal

delib_cli DI32 0 hexExample of a return value: 0xFFFFFFFF-> reads the state of digital inputs 1-32 as hexadecimal

Alternatively you can append the argument "nounit"delib_cli DI8 0 hex nounitExample of a return value: FF-> reads the state of digital inputs 1-8 as hexadecimal

Linuxsudo delib_cli _usb DI1 3Example of a return value: 1-> reads the state of digital input 4 of an USB-Module

delib_cli_eth DI8 0 hexExample of a return value: 0xFF-> reads the state of digital input 1-8 of a RO-ETH-Module as hexadecimal

Software |Seite 73

Analog Outputs

Windowsdelib_cli AO 7 4711->analog output 8 will be set to the decimal value 4711

delib_cli AO 6 0x4711->analog output 7 will be set to the hexadecimal value 0x4711

delib_cli AO 7 3.7V-> the voltage of analog output 8 will be set to 3,7 Volt (the comma "," and the dot "." can be used for decimal separation)

delib_cli AO 7 13.3mA-> the current of analog output 8 will be set to 13,3 mA (the comma "," and the dot "." can be used for decimal separation)

Linuxsudo delib_cli_usb AO 7 4711-> analog output 8 of an USB-Module will be set to the decimal value 4711

delib_cli_eth AO 6 0x4711-> analog output 7 of a RO-ETH-Module will be set to the hexadecimal value 0x4711

Software |Seite 74

Analog Inputs

Windowsdelib_cli AI 2Example of a return value: 1234-> reads the value of analog input 3 as decimal

delib_cli AI 2 hexExample of a return value: 0x1FA-> reads the value of analog input 3 as hexadecimal

delib_cli AI 2 VExample of a return value: 12.500000V-> reads the voltage of analog input 3 as point number

delib_cli AI 2 mAExample of a return value: 20.551600mA-> reads the current of analog input 3 as point number

Alternatively you can append the argument "nounit"

delib_cli AI 3 hex nounitExample of a return value: 1FA-> reads the value of analog input 4 as hexadecimal

delib_cli AI 3 V nounitExample of a return value: 12.500000-> reads the voltage of analog input 4 as point number

delib_cli AI 3 mA nounitExample of a return value: 20.551600-> reads the current of analog input 4 as point number

Linuxsudo delib_cli_usb AI 2Example of a return value: 1234-> reads the value of analog input 3 of an USB-Module as decimal

delib_cli_eth AI 2 hexExample of a return value: 0x1FA-> reads the value of analog input 3 of an RO-ETH-Module as hexadecimal

VI

DELIB API reference |Seite 75

DELIB API reference

DELIB API reference |Seite 76

6. DELIB API reference

6.1. Management functions

6.1.1. DapiOpenModule

Description

This function opens a particular module.

Definition

ULONG DapiOpenModule(ULONG moduleID, ULONG nr);

Parameters

moduleID=Specifies the module, which is to be opened (see delib.h)

nr=Indicates No of module which is to be opened.

nr=0 -> 1. module

nr=1 -> 2. module

Return value

handle=handle to the corresponding module

handle=0 -> Module was not found

Remarks

The handle returned by this function is needed to identify the module for all otherfunctions.

Example program

// USB-Modul öffnenhandle = DapiOpenModule(RO_USB1, 0);printf("handle = %x\n", handle);if (handle==0){// USB Modul wurde nicht gefundenprintf("Modul konnte nicht geöffnet werden\n");return;}

DELIB API reference |Seite 77

6.1.2. DapiCloseModule

Description

This command closes an opened module.

Definition

ULONG DapiCloseModule(ULONG handle);

Parameters

handle=This is the handle of an opened module

Return value

none

Example program

// Close the moduleDapiCloseModule(handle);

DELIB API reference |Seite 78

6.1.3. DapiGetDELIBVersion

Description

This function returns the installed DELIB version.

Definition

ULONG DapiGetDELIBVersion(ULONG mode, ULONG par);

Parameters

mode=Mode, with which the version is readout (must be 0).

par=This parameter is not defined (must be 0).

Return value

version=Version number of the installed DELIB version [hex].

Example program

version = DapiGetDELIBVersion(0, 0);//Bei installierter Version 1.32 ist version = 132(hex)

DELIB API reference |Seite 79

6.1.4. DapiSpecialCMDGetModuleConfig

Description

This command returns the hardware equipment (number of in-/output channels) ofthe module.

Definition

ULONG DapiSpecialCommand(ULONG handle,DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, par, 0, 0);

Parameters

handle=This is the handle of an open module.

Get number of digital input channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI

Get number of digital output channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DO

Get number of digital in-/output channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DX

Get number of analog input channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_AD

Get number of analog output channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DA

Get number of stepper channels

par=DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_STEPPER

DELIB API reference |Seite 80

Return value

Get number of digital input channels

return=Number of digital input channels

Get number of digital output channels

return=Number of digital output channels

Get number of digital in-/output channels

return=Number of digital in-/output channels

Get number of analog input channels

return=Number of analog input channels

Get number of analog output channels

return=Number of analog output channels

Get number of stepper channels

return=Number of stepper channels

Example program

ret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0);//Gibt die Anzahl der digitalen Eingangskanäle zurückret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DO, 0, 0);//Gibt die Anzahl der digitalen Ausgangskanäle zurückret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DX, 0, 0);//Gibt die Anzahl der digitalen Ein-/Ausgangskanäle zurückret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_AD, 0, 0);//Gibt die Anzahl der analogen Eingangskanäle zurückret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DA, 0, 0);//Gibt die Anzahl der analogen Ausgangskanäle zurückret=DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG,DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_STEPPER, 0, 0);//Gibt die Anzahl der Stepperkanäle zurück

DELIB API reference |Seite 81

6.1.5. DapiOpenModuleEx

Description

This function opens a specific RO-ETH-module.The particularity of this commandis, that parameters like IP-address and portnumber can be specified.

Definition

ULONG DapiOpenModuleEx(ULONG moduleID, ULONG nr, unsigned char*exbuffer);

Parameters

moduleID=Specifies the module, which is to be opened (see delib.h)

nr=Indicates No of module which is to be opened.

nr=0 -> 1. module

nr=1 -> 2. module

exbuffer=buffer for IP-adresse and port

Return value

handle=handle to the corresponding module

handle=0 -> Module was not found

Remarks

The handle returned by this function is needed to identify the module for all otherfunctions.

Currently, this command is only supported by our RO-ETH-Series.

Example program

// Open ETH-Module with parameter

DAPI_OPENMODULEEX_STRUCT open_buffer;

strcpy((char*) open_buffer.address, "192.168.1.10");open_buffer.portno = 0;

handle = DapiOpenModuleEx(RO_ETH, 0, (unsigned char*) &open_buffer);printf("Module handle = %x\n", handle);

DELIB API reference |Seite 82

6.2. Error handling

6.2.1. DapiGetLastError

Description

This function returns the last registered error.

Definition

ULONG DapiGetLastError();

Parameters

None

Return value

Error code

0=no error. (see delib.h)

Example program

ULONG error;error=DapiGetLastError();if(error==0) return FALSE;printf("ERROR = %d", error);

DELIB API reference |Seite 83

6.2.2. DapiGetLastErrorText

Description

This function reads the text of the last registered error.

Definition

extern ULONG __stdcall DapiGetLastErrorText(unsigned char * msg, unsigned longmsg_length);

Parameters

msg = text buffer

msg_length = length of the buffer

Example program

BOOL IsError (){ if (DapiGetLastError () != DAPI_ERR_NONE)

{ unsigned char msg[500];

DapiGetLastErrorText((unsigned char*) msg, sizeof(msg)); printf ("Error Code = %x * Message = %s\n", 0, msg); return TRUE;}

return FALSE;}

DELIB API reference |Seite 84

6.3. Reading Digital inputs

6.3.1. DapiDIGet1

Description

This command reads a single digit input.

Definition

ULONG DapiDIGet1(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the number of input that is to be read (0 ..).

Return value

State of the input (0 / 1).

DELIB API reference |Seite 85

6.3.2. DapiDIGet8

Description

This command reads 8 digital inputs simultaneously.

Definition

ULONG DapiDIGet8(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the number of the input, from which it begins to read from (0, 8, 16,24, 32, ..)

Return value

State of the read inputs.

DELIB API reference |Seite 86

6.3.3. DapiDIGet16

Description

This command reads 16 digital inputs simultaneously.

Definition

ULONG DapiDIGet16(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the number of the input, from which it begins to read from (0, 16, 32,..)

Return value

State of the read inputs.

DELIB API reference |Seite 87

6.3.4. DapiDIGet32

Description

This command reads 32 digital inputs simultaneously.

Definition

ULONG DapiDIGet32(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the number of the input, from which it begins to read from (0, 32, 64,..)

Return value

State of the read inputs.

Example program

unsigned long data;// ----------------------------------------------------// Einen Wert von den Eingängen lesen (Eingang 1-31)data = (unsigned long) DapiDIGet32(handle, 0);// Chan Start = 0printf("Eingang 0-31 : 0x%x\n", data);printf("Taste für weiter\n");getch();// ----------------------------------------------------// Einen Wert von den Eingängen lesen (Eingang 32-64)data = (unsigned long) DapiDIGet32(handle, 32);// Chan Start = 32printf("Eingang 32-64 : 0x%x\n", data);printf("Taste für weiter\n");getch();

DELIB API reference |Seite 88

6.3.5. DapiDIGet64

Description

This command reads 64 digital inputs simultaneously.

Definition

ULONGLONG DapiDIGet64(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the number of the input,from which it begins to read from (0, 64, ..)

Return value

State of the read inputs.

DELIB API reference |Seite 89

6.3.6. DapiDIGetFF32

Description

This command reads the flip-flops from the inputs and resets them. (Input statechange).

Definition

ULONG DapiDIGetFF32(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module .

ch=Specifies the number of the input, from which it begins to read from (0, 32, ..)

Return value

State of 32 input change states

DELIB API reference |Seite 90

6.3.7. DapiDIGetCounter

Description

This command reads the counter of a digital input

Definition

ULONG DapiDIGetCounter(ULONG handle, ULONG ch, ULONG mode);

Parameters

handle=This is the handle of an opened module.

ch=Specifies the digital input,from which the counter will be read.

mode=0 (Normal counter function)

mode=DAPI_CNT_MODE_READ_WITH_RESET (Reading and resetting thecounter)

mode=DAPI_CNT_MODE_READ_LATCHED (Reading the latched counter)

Return value

Value of the counter.

Example program

value = DapiDIGetCounter(handle, 0 ,0);// Reading counter of DI Chan 0

value = DapiDIGetCounter(handle, 1 ,0);// Reading counter of DI Chan 1

value = DapiDIGetCounter(handle, 8 ,0);// Reading counter of DI Chan 8

value = DapiDIGetCounter(handle, 0 ,DAPI_CNT_MODE_READ_WITH_RESET);// Reading AND resetting counter of DI Chan 0

value = DapiDIGetCounter(handle, 1, DAPI_CNT_MODE_READ_LATCHED);// Reading the latched counter of DI Chan 1

DELIB API reference |Seite 91

6.3.8. DapiSpecialCounterLatchAll

Description

This command saves the counters of all digital inputs simultaneously into atemporary storage (latch).

So, after that, the counter of the latch can be read successively.

Here, the speciality is, that it is possible to "freeze" simultaneously the counter andthe frozen counter (latch) can be read one by one.

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_COUNTER,DAPI_SPECIAL_COUNTER_LATCH_ALL, 0, 0);

Parameters

None

Example program

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_COUNTER,DAPI_SPECIAL_COUNTER_LATCH_ALL, 0, 0);

DELIB API reference |Seite 92

6.3.9. DapiSpecialCounterLatchAllWithReset

Description

This command saves the counters of all digital inputs simultaneously into atemporary storage (latch).

In addition, the counters of the digital inputs will be reset.

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_COUNTER,DAPI_SPECIAL_COUNTER_LATCH_ALL_WITH_RESET, 0, 0);

Parameters

None

Example program

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_COUNTER,DAPI_SPECIAL_COUNTER_LATCH_ALL_WITH_RESET, 0, 0);

DELIB API reference |Seite 93

6.3.10. Dapi_Special_DI_FF_Filter_Value_Get

Description

This command returns the filter [ms], in which time interval the digital inputs aresampled.

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,DAPI_SPECIAL_DI_FF_FILTER_VALUE_GET, 0, 0);

Parameters

handle=This is the handle of an opened module.

Return value

Time [ms]

Example program

value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,DAPI_SPECIAL_DI_FF_FILTER_VALUE_GET, 0, 0);//Gibt das Zeitintervall zum Abtasten der digitalen Eingangskanäle zurück.

DELIB API reference |Seite 94

6.3.11. Dapi_Special_DI_FF_Filter_Value_Set

Description

This command sets a filter [ms], in which time interval the digital inputs aresampled.

Definition

void DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, ULONG time_ms, 0);

Parameters

handle=This is the handle of an opened module.

time_ms=time interval [ms], in which digital inputs are sampled.

Return value

None

Remarks

This command only supports pulse durations between 5ms and 255ms.

If no time is set, the default value (100ms) will be used.

Example program

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, 5, 0);// Setzt das Zeitintervall auf 5msDapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, 150, 0);// Setzt das Zeitintervall auf 150ms

DELIB API reference |Seite 95

6.4. Setting Digital outputs

6.4.1. DapiDOSet1_WithTimer

Description

This function sets a digital output (ch) to a value (data - 0 or 1) for a specified timein msec.

Definition

void DapiDOSet1_WithTimer(ULONG handle, ULONG ch, ULONG data, ULONGtime_ms);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output, from which it begins to write to (0, 32, 64, ..)

data=Specifies the data values, to write to the outputs

time_ms=Specifies the time, in which an output is set [ms]

Return value

None

Remarks

This function is only supported by our RO-O8-R8 module.

This function will lose its validity, if it is overwritten with other values.

If you want to deactivate this function, you will have to overwrite it with time_ms=0.

Example program

DapiDOSet1_WithTimer(handle, 2, 1, 1000);//Setting channel 2 for 1000msec to 1

DELIB API reference |Seite 96

6.4.2. DapiDOSet1

Description

This is the command to set a single output.

Definition

void DapiDOSet1(ULONG handle, ULONG ch, ULONG data);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output to be set to (0 ..)

data=Specifies the data value that is to be written (0 / 1)

Return value

None

DELIB API reference |Seite 97

6.4.3. DapiDOSet8

Description

This command sets 8 digital outputs simultaneously.

Definition

void DapiDOSet8(ULONG handle, ULONG ch, ULONG data);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output, from which it begins to write to (0, 8, 16, 24,32, ..)

data=Specifies the data values, to write to the outputs

Return value

None

DELIB API reference |Seite 98

6.4.4. DapiDOSet16

Description

This command sets 16 digital outputs simultaneously.

Definition

void DapiDOSet16(ULONG handle, ULONG ch, ULONG data);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output, from which it begins to write to (0, 16, 32, ..)

data=Specifies the data values, to write to the outputs

Return value

None

DELIB API reference |Seite 99

6.4.5. DapiDOSet32

Description

This command sets 32 digital outputs simultaneously.

Definition

void DapiDOSet32(ULONG handle, ULONG ch, ULONG data);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output, from which it begins to write to (0, 32, 64, ..)

data=Specifies the data values, to write to the outputs

Return value

None

Example program

// Einen Wert auf die Ausgänge schreibendata = 0x0000ff00; // Ausgänge 9-16 werden auf 1 gesetztDapiDOSet32(handle, 0, data); // Chan Start = 0printf("Schreibe auf Ausgänge Daten=0x%x\n", data);printf("Taste für weiter\n");getch();// ----------------------------------------------------// Einen Wert auf die Ausgänge schreibendata = 0x80000000; // Ausgang 32 wird auf 1 gesetztDapiDOSet32(handle, 0, data); // Chan Start = 0printf("Schreibe auf Ausgänge Daten=0x%x\n", data);printf("Taste für weiter\n");getch();// ----------------------------------------------------// Einen Wert auf die Ausgänge schreibendata = 0x80000000; // Ausgang 64 wird auf 1 gesetztDapiDOSet32(handle, 32, data); // Chan Start = 32printf("Schreibe auf Ausgänge Daten=0x%x\n", data);printf("Taste für weiter\n");getch();

DELIB API reference |Seite 100

6.4.6. DapiDOSet64

Description

This command is to set 64 digital outputs.

Definition

void DapiDOSet64(ULONG handle, ULONG ch, ULONG data);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the output, from which it begins to write to (0, 64, ..)

data=Specifies the data values, to write to the outputs

Return value

None

DELIB API reference |Seite 101

6.4.7. DapiDOReadback32

Description

This command reads back the 32 digital outputs.

Definition

ULONG DapiDOReadback32(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the input, from which it begins to read from (0, 32, ..)

Return value

Status of 32 outputs.

DELIB API reference |Seite 102

6.4.8. DapiDOReadback64

Description

This command reads back the 64 digital outputs.

Definition

ULONGLONG DapiDOReadback64(ULONG handle, ULONG ch);

Parameters

handle=This is the handle of an opened module

ch=Specifies the number of the input, from which it begins to read from (0, 64, ..)

Return value

Status of 64 outputs.

DELIB API reference |Seite 103

6.5. Example program

// ****************************************************************************// ****************************************************************************// ****************************************************************************// ****************************************************************************// ****************************************************************************//// (c) DEDITEC GmbH, 2009//// web: http://www.deditec.de//// mail: [email protected]//////// dtapi_prog_beispiel_input_output.cpp////// ****************************************************************************// ****************************************************************************// ****************************************************************************// ****************************************************************************// ****************************************************************************////// Folgende Bibliotheken beim Linken mit einbinden: delib.lib// Dies bitte in den Projekteinstellungen (Projekt/Einstellungen/Linker(Objekt-Bibliothek-Module) .. letzter Eintrag konfigurieren#include <windows.h>#include <stdio.h>#include "conio.h"#include "delib.h"// ----------------------------------------------------------------------------// ----------------------------------------------------------------------------// ----------------------------------------------------------------------------// ----------------------------------------------------------------------------// ----------------------------------------------------------------------------

void main(void){unsigned long handle;unsigned long data;unsigned long anz;unsigned long i;unsigned long chan;// ----------------------------------------------------// USB-Modul öffnenhandle = DapiOpenModule(USB_Interface8,0);printf("USB_Interface8 handle = %x\n", handle);if (handle==0){// USB Modul wurde nicht gefundenprintf("Modul konnte nicht geöffnet werden\n");printf("TASTE für weiter\n");getch();

DELIB API reference |Seite 104

return;}// Zum Testen - ein Ping senden// ----------------------------------------------------printf("PING\n");anz=10;for(i=0;i!=anz;++i){data=DapiPing(handle, i);if(i==data){// OKprintf(".");}else{// No answerprintf("E");}}printf("\n");

// ----------------------------------------------------// Einen Wert auf die Ausgänge schreibendata = 255;DapiWriteByte(handle, 0, data);printf("Schreibe auf Adresse=0 daten=0x%x\n", data);// ----------------------------------------------------// Einen Wert auf die Ausgänge schreibendata = 255;DapiWriteByte(handle, 1, data);printf("Schreibe auf Adresse=0 daten=0x%x\n", data);// ----------------------------------------------------// Einen Wert auf die Ausgänge schreibendata = 255;DapiWriteByte(handle, 2, data);printf("Schreibe auf Adresse=2 daten=0x%x\n", data);// ----------------------------------------------------// Einen Wert von den Eingängen lesendata = (unsigned long) DapiReadByte(handle, 0);printf("Gelesene Daten = 0x%x\n", data);// ----------------------------------------------------// Einen A/D Wert lesenchan=11; // read chan. 11data = DapiReadWord(handle, 0xff010000 + chan*2);printf("Adress=%x, ret=%x volt=%f\n", chan, data, ((float) data) / 1024*5);//Bei 5 Volt Ref// ----------------------------------------------------// Modul wieder schliessenDapiCloseModule(handle);printf("TASTE für weiter\n");getch();return ;}

VII

Appendix |Seite 105

Appendix

Appendix |Seite 106

7. Appendix

7.1. Revisions

Rev 2.00 First DEDITEC issue

Rev 2.01 Added chapter "Firmware update" and "Integration of theDELIB"

Rev 2.02 Added index

Appendix |Seite 107

7.2. Copyrights and trademarks

Linux is registered trade-mark of Linus Torvalds.

Windows CE is registered trade-mark of Microsoft Corporation.

USB is registered trade-mark of USB Implementers Forum Inc.

LabVIEW is registered trade-mark of National Instruments.

Intel is registered trade-mark of Intel Corporation

AMD is registered trade-mark of Advanced Micro Devices, Inc.