Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Meilhaus Electronic - Intelligent Driver System (ME-iDS)

Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows
  • Main Page
  • Related Pages

Meilhaus Electronic - Intelligent Driver System (ME-iDS)

Windows XP, Vista, 7, 8, 8.1 und 10

Version 2.1.6.0 - 12.08.2020

Introduction

The ME-iDS system consists of a main driver and individual device drivers for each board family running in kernel mode and a user-mode DLL which implements the platform independant ME-iDS API.

In the current version the ME-iDS system supports the following Meilhaus Electronic boards in PCI, compact PCI, Synapse USB and Synapse LAN versions:

  • ME-94 / ME-95 / "ME-96" (Interrupt not supported).
  • ME-630
  • ME-1000 / ME-5310
  • ME-1400 (OSC-Output not supported) / ME-5314.
  • ME-1600
  • ME-4610 / ME-4650 / ME-4660 / ME-4670 / ME-4680
  • ME-5100 / ME-5284-8 / ME-5284-8E / ME-5261-8 / ME-5261-8E / ME-5265-8 / ME-5265-8E / ME-5001 / ME-5351 / ME-5810A / ME-5820 / ME-5821 / ME-5810A/S / ME-5002 / ME-5004
  • ME-Axon
  • ME-6000 / ME-6100 / ME-6200 / ME-6300
  • ME-8100
  • ME-8200

The following boards or devices are supported as USB versions

  • ME-630 (Mephisto Switch)
  • ME-1400 (Mephisto Digi)
  • ME-8200 (Mephisto Opto)
  • MEphistoScope
Note:
The serial boards, ME-9x00, are not supported.

Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Related Pages

Related Pages

Here is a list of all related documentation pages:
  • Properties
  • Bugs removed, Changes and Additions
  • Error Codes and their Meanings
  • System constants
  • ME-iDS API
  • meIDSTools.dll
  • Description of the C++ Console Test Programs
  • Description of the C-Sharp Test Programs
  • FAQ (Frequently Asked Questions).
  • Supported Hardware
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Properties

Properties

Properties are characteristics of a device, sub-device, channel etc. which can be read and in some cases written. The name of a property is a defined string.

An example for a property which can only be read is the type of a sub-device (Digital In, Digital Out, Digital In/Out, Analog In etc.).

An example of a property which can also be written is the direction of a Digital In/Out sub-device which can be set either to Input or Output.

Properties are collected together in containers. A container contains properties and and can also contain other containers. In this way, all the properties for the system are organised hierarchically into a tree structure.

The root of the property tree is a container represented by two consecutive backslashes. The components of a property path are seperated by one backslash.

To access a property the entire path to the property from the root "\\" through all the intervening containers, separated by backslashes ('\' characters) and ending with the <Property name> must be used.
A backslash should not be appended to the end of a property path.

So for example, to access the sub-device type of sub-device 2 on device 1 the correct property path is
"\\Devices\Device1\Subdevices\Subdevice2\Type"

Note:
Depending on the programming language you use, the backslash might be an escape character (e.g. C, C++, C#). In this case in the source code two backslashes must be used to represent one backslash in a property string.

Property routines are implemented as ANSI and UTF-16 unicode versions.
The ANSI versions of the property functions have suffix 'A' and use NULL terminated ANSI strings (char*). The unicode routines use wide character strings (wchar_t*) and have the same names but with a suffix 'W' instead of the suffix 'A'.
The routines can be splitted into getter functions for reading and setter functions for writing values.

Reading property values

Depending on the property data type the appropriate function must be used to get the value.
The following functions exist for reading properties:

  • ANSI versions
    • int mePropertyGetIntA(char* pcPropertyPath, int* piValue)
      Reads a property as 32bit signed integer value
    • int mePropertyGetDoubleA(char* pcPropertyPath, double* pdValue)
      Reads a floating point property as 64bit double value
    • int mePropertyGetStringA(char* pcPropertyPath, char* pcValue, int iBufferLength)
      Reads a string property as a NULL terminated ANSI character array
  • Unicode versions
    • int mePropertyGetIntW(wchar_t* pcPropertyPath, int* piValue)
      Reads a property as 32bit signed integer value
    • int mePropertyGetDoubleW(wchar_t* pcPropertyPath, double* pdValue)
      Reads a floating point property as 64bit double value
    • int mePropertyGetStringW(wchar_t* pcPropertyPath, wchar_t* pcValue, int iBufferLength)
      Reads a string property as a NULL terminated unicode character array

Writing property values

Depending on the property data type the appropriate function must be used to set the value.
The following functions exist for writing properties:

  • ANSI versions
    • int mePropertySetIntA(char* pcPropertyPath, int iValue)
      Sets a property as 32bit signed integer value
    • int mePropertySetDoubleA(char* pcPropertyPath, double dValue)
      Sets a floating point property as 64bit double value
    • int mePropertySetStringA(char* pcPropertyPath, char* pcValue)
      Sets a string property as a NULL terminated ANSI character array
  • Unicode versions
    • int mePropertySetIntW(wchar_t* pcPropertyPath, int iValue)
      Sets a property as 32bit signed integer value
    • int mePropertySetDoubleW(wchar_t* pcPropertyPath, double dValue)
      Sets a floating point property as 64bit double value
    • int mePropertySetStringW(wchar_t* pcPropertyPath, wchar_t* pcValue)
      Sets a string property as a NULL terminated unicode character array

In the following the ANSI routines are used for all examples and explanations, but in every case in which an ANSI routine appears the corresponding unicode routine could also have been used.

Property attributes

Properties and containers have attributes which can also be read with the property functions.
Attributes provide additional information concerning properties or containers, e.g. the data type of the property, whether the property is read only or writable too, the number of elements a container holds etc.
To read an attribute simply add an additional backslash to the property path followed by the attribute name.

The following attributes are defined:

Attributes
Property name | Defined for | Property type | Possible values | Description
NumberOfElements | Containers | Integer | - | The number of elements in the container
PropertyName | Properties and containers | String | - | The name of the property - maximum 64 characters, not bytes, including the terminating NULL character
PropertyType | Properties and containers | Define | ME_PROPERTY_TYPE_CONTAINER, ME_PROPERTY_TYPE_BOOL, ME_PROPERTY_TYPE_INT, ME_PROPERTY_TYPE_DOUBLE, ME_PROPERTY_TYPE_STRING, ME_PROPERTY_TYPE_DEFINE | The data type of the property
PropertyAccess | Properties | Define | ME_PROPERTY_ACCESS_READ_ONLY, ME_PROPERTY_ACCESS_READ_WRITE | Indicates if the property is read only or can be written as well
PropertyDescription | Properties and containers | String | - | The verbal description of the property - maximum 1024 characters, not bytes, including the terminating NULL character
MinValue | Writeable integer and double properties | Integer for integer properties, double for double properties | - | The minimum value allowed for the property
MaxValue | Writeable integer and double properties | Integer for integer properties, double for double properties | - | The maximum value allowed for the property
Length | String properties | Integer | - | The length of the property in characters, not bytes, including the terminating NULL character
MaxLength | Writeable string properties | Integer | - | The maximum length of the property value in characters, not bytes, including the terminating NULL character
NumberOfSelections | Writeable define properties | Integer | - | The number of available selections of the define property
Selection# | Writeable define properties | Integer and string | - | The selection of a define where # is the index

The attribute "NumberOfElements" is defined for any container, but not for other properties. It is a read only integer value which can be queried using the mePropertyGetInt function.
So for example, to find out how many elements (Properties and containers) are in the root container you can call mePropertyGetIntA("\\NumberOfElements", int* piValue). The number of elements is returned in piValue.

Once you know how many elements a container holds you can address the elements even without knowing their names by using their index. The elements are numbered by their index beginning with 0. So, if you have found out that the root container holds 4 elements, then you can address these elements as "\\0", "\\1", ... "\\3".

Using the attribute "PropertyName" you can query the name of each element of the container. So, to find the name of the first element in the root container you can call mePropertyGetStringA("\\0\PropertyName", char* pcValue, int iBufferLength). The name of the property is returned in pcValue.

Once you know the name of a property, you can use this name instead of the index to address the property. So, if the name of the first element in the root container is "LibraryVersion" then you can find the type of this property by calling either mePropertyGetIntA("\\0\PropertyType", int* piValue) or by calling mePropertyGetIntA("\\LibraryVersion\PropertyType", int* piValue) the result is the same.

In this way you can find the names and types of all the elements of the root container. Some of these elements will themselves be containers. You can use the same procedure to find the names and types of the elements in these containers.

For instance, the root container holds a container called "Devices". To find out how many elements are in this container you can call mePropertyGetIntA("\\Devices\NumberOfElements", int* piValue). You can then call mePropertyGetStringA("\\Devices\0\PropertyName", char* pcValue, int iBufferLength) to find the name of the first element in this container and so on.

In this way you can recursively investigate the entire property tree. The example program Con_meIDSSystemProperties of the ME-iDS SDK shows how this can be done using C++ source code in a small console program.

Property types

The attribute "PropertyType" is defined for all properties and containers. If "P" is a valid path to a property or container then the following function call is always defined:

mePropertyGetIntA("P\PropertyType", int* piValue)

The property type is returned in piValue and is one of the following defines:

  • ME_PROPERTY_TYPE_CONTAINER: "P" is a container which itself contains further Properties and containers.
  • ME_PROPERTY_TYPE_BOOL: "P" ia a two-valued property, for example Off/On, False/True, No/Yes etc.
    The value can be queried (and in some cases set) using the mePropertyGetInt and mePropertySetInt routines.
    The value is 0 for False or 1 for True. The value can be also queried using the mePropertyGetString routines. These return a readable version of the property value for display purposes.
  • ME_PROPERTY_TYPE_INT: "P" is an integer property.
    The value can be queried (and in some cases set) using the mePropertyGetInt and mePropertySetInt routines.
    The value is a signed 32-Bit integer.\ The value can be also queried using the mePropertyGetStringA routines. These return a readable version of the property value for display purposes.
  • ME_PROPERTY_TYPE_DOUBLE: "P" is a double property.\ The value can be queried (and in some cases set) using the mePropertyGetDouble and mePropertySetDouble routines.
    The value is a 64-Bit floating point double.\ The value can be also queried using the mePropertyGetString routines. These return a readable version of the property value for display purposes.
  • ME_PROPERTY_TYPE_STRING: "P" is string property, a NULL terminated character sequence. The value can be queried (and in some cases set) using the mePropertyGetString and mePropertySetString routines.
  • ME_PROPERTY_TYPE_DEFINE: "P" is a define property. It can take one of a limited number of pre-defined constant values. The value can be queried (and in some cases set) using the mePropertyGetInt and mePropertySetInt routines.
    The value can be also queried using the mePropertyGetString routines. These return a readable version of the define for display purposes.

The value of a property can be queried by using the property path without an attribute in the appropriate mePropertyGet... routine (see above).
For example, to query the value of the property "LibraryVersion" mentioned above in the root container you can call either mePropertyGetIntA("\\LibraryVersion", int* piValue) which returns the library version as an integer in piValue or mePropertyGetStringA("\\LibraryVersion", char* pcValue, int iBufferLength) which returns the library version in the form of a string in pcValue.

Access type of properties

The attribute "PropertyAccess" indicates if a property is read only or writable as well. PropertyAccess is defined for all properties, but not for containers. If "P" is the path to a property then the following function call is always valid:
mePropertyGetIntA("P\PropertyAccess", int* piValue)

Example for a sub-device index 2 is of Type Counter:
property "ClockSource" of device index 1 sub-device index 2
"\\Devices\Device1\Subdevices\Subdevice2\ClockSource\PropertyAccess"

The property access is returned in piValue and is one of the following defines:

  • ME_PROPERTY_ACCESS_READ_ONLY: The value of the property "P" can only be read.
  • ME_PROPERTY_ACCESS_READ_WRITE: The value of the property "P" can be read and written.

Abbreviations for property paths

For convenience several abbreviations exist to shorten a property path.
The following properties can be abbreviated:

  • Devices: "\\Devices\Device1" can be abbreviated as "\\Device1"
  • Subdevices: "\\Device1\Subdevices\Subdevice0" can be abbreviated as "\\Device1\Subdevice0"
  • Channels: "\\Device1\Subdevice0\Channels\Channel7" can be abbreviated as "\\Device1\Subdevice0\Channel7"
  • Configurations: "\\Device1\Subdevice0\Configurations\Configuration0" can be abbreviated as "\\Device1\Subdevice0\Configuration0"

General system properties

These properties are elements of the root container "\\" and can therefore be accessed via the path "\\<Property name>"

System properties
Property name | Type | Access | Description
LibraryVersion | Integer | Read only | Determines the version number of the ME-iDS library
MainDriverVersion | Integer | Read only | Determines the version number of the ME-iDS main driver
NumberOfDevices | Integer | Read only | The number of devices recognized by the ME-iDS
Devices | Container | - | Holds the Properties and containers of all ME-iDS devices

General device properties

The path to a device property for a device index X is:
"\\Devices\X\<Property name>"
or "\\Devices\DeviceX\<Property name>".

This can be abbreviated as:
"\\DeviceX\<Property name>"

Example: property "NumberOfSubdevices" for device index 0
"\\Devices\Device0\NumberOfSubdevices"
or abbreviated as: "\\Device0\NumberOfSubdevices"

General device properties - always present
Property name | Type | Access | Possible values | Description
Name | String | Read only | - | The name of the device
DriverName | String | Read only | - | The name of the device specific driver module
DriverVersion | Integer | Read only | - | Version number of the device specific driver module
Description | String | Read only | - | The device description
SerialNumber | Integer | Read only | - | The serial number of the device
BusType | Define | Read only | ME_BUS_TYPE_PCI, ME_BUS_TYPE_USB, ME_BUS_TYPE_LAN_PCI, ME_BUS_TYPE_LAN_USB | The bus type by which the device is connected with the PC (PCI/cPCI, USB)
AccessType | Define | Read only | ME_ACCESS_TYPE_LOCAL, ME_ACCESS_TYPE_REMOTE | Indicates if the device can be accessed locally or by remote connection
Plugged | Define | Read only | ME_PLUGGED_IN, ME_PLUGGED_OUT | Indicates if the device is physically available
FirmwareSelectable | Boolean | Read only | False, True | Indicates if the device can load different firmware files
NumberOfSubdevices | Integer | Read only | - | The number of available sub-devices beginning at index 0
Subdevices | Container | - | - | Contains the properties and other containers for the sub-devices

Note:
If a device is not plugged in the properties and containers of that device can not be accessed. The error number ME_ERRNO_DEVICE_UNPLUGGED will be returned when a property of the Device is read or written.

General sub-device properties

The path to a sub-device property for device index X and sub-device index Y is:
"\\Devices\DeviceX\Subdevices\Y\<Property name>"
or "\\Devices\DeviceX\Subdevices\SubdeviceY\<Property name>".

This can be abbreviated as:
"\\DeviceX\SubdeviceY\<Property name>"

Example: property "NumberOfChannels" of device index 0, sub-device index 2
"\\Devices\Device0\Subdevices\Subdevice2\NumberOfChannels"
or abbreviated as: "\\Device0\Subdevice2\NumberOfChannels"

General sub-device properties - always present
Property name | Type | Access | Description
Type | Define | Read only | The type of the sub-device, e.g. Analog output, Digital input/output, Frequency input
Subtype | Define | Read only | The subtype of the sub-device, e.g. Single, Streaming, Counter 8254
NumberOfChannels | Integer | Read only | The number of channels of the sub-device
Configurable | Boolean | Read only | Indicates if the sub-device type can be configured

If the boolean property "Configurable" is True then the following three sub-device properties also exist:

Additional properties for configurable sub-devices
Property name | Type | Access | Description
NumberOfConfigurations | Integer | Read only | The number of available configurations for the sub-device
CurrentConfiguration | Integer | Read only | The number of the current active configuration
Configurations | Container | - | Contains the properties and other containers for the configurations of the sub-device

The Container "Configurations" contains "NumberOfConfigurations" elements, which describe the available sub-device type configurations:

The path to a configuration property for device index X, sub-device index Y and configuration number Z is:
"\\Devices\DeviceX\Subdevices\SubdeviceY\Configurations\Z\<Property name>"
or "\\DeviceX\SubdeviceY\Configurations\ConfigurationZ\<Property name>".

This can be abbreviated as:
"\\DeviceX\SubdeviceY\ConfigurationZ\<Property name>"

Example: property "SubdeviceNumberOfChannels" of device index 0, sub-device index 2, configuration number 1
"\\Devices\Device0\Subdevice2\Configurations\1\SubdeviceNumberOfChannels"
or abbreviated as: "\\Device0\Subdevice2\Configuration1\SubdeviceNumberOfChannels"

Configuration properties
Property name | Type | Access | Description
SubdeviceType | Define | Read only | The sub-device type
SubdeviceSubtype | Define | Read only | The sub-device subtype
SubdeviceNumberOfChannels | Integer | Read only | The number of channels of the sub-device
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Bugs removed, Changes and Additions

Bugs removed, Changes and Additions

Note:
The version number in the left-hand column is the version in which the bug was first removed, the change was made etc.
Bugs removed, Changes and Additions
Version | Type | Component | Summary | Description
2.1.1 Bug removed All boards except those of the ME-5xxx series Device description truncated to 64 characters On all boards except those of the ME-5xxx series, the device description was truncated to 64 characters.
The device description can be obtained by calling the routine meQueryDescriptionDevice and contains details of the various sub-devices available on the device. This description has a maximum length 0f 256 (ME_DEVICE_DESCRIPTION_MAX_COUNT) characters.
Due to an error which crept into version 2.0.0 of the ME-iDS, only the first part of this description up to a maximum of 64 characters was returned to the routine meQueryDescriptionDevice.
2.1.0 | General stability improvement | ME-iDS | Stability improvements for Windows 8, Windows 8.1 and Windows 10 | ME-iDS is now stable under Windows 8, Windows 8.1 and Windows 10
2.1.0 | Support for Windows 10 | ME-iDS | ME-iDS compiled for Windows 10 for both x86 and x64 versions. | ME-iDS supports Windows 10 (x86/x64).
2.1.0 | Support for Windows 8, Windows 8.1 | ME-iDS | ME-iDS compiled for Windows 8, Windows 8.1 for both x86 and x64 versions. | ME-iDS supports Windows 8 and Windows 8.1 (x86/x64).
2.0.6 | Bug removed | ME-5810A and ME-5810A/S boards, Digital input sub-device (sub-device 0) and second counter sub-device (sub-device 3). | Sub-devices influenced each other in an unpredictable fashion. | Due to an error in the firmware, operations on the digital input sub-device could have undesirable and unpredictable effects on the second counter sub-device.
2.0.6 Bug removed ME-52xx boards, Analog input sub-device. Certain values for 'iFifoIrqThreshold' in meIOStreamConfig caused the streaming operation to malfunction. If in meIOStreamConfig a value was passed for the parameter 'iFifoIrqThreshold' which was less than the number of input channels, then the acquisition would not run correctly. In particular, an acquisition with a limited amount of data would not terminate.
Since all channels are acquired simultaneously, a value for 'iFifoIrqThreshold' smaller than the number of input channels makes no sense anyway. Such a value is now corrected internally and made equal to the number of channels.
2.0.5 Bug removed ME-5100, ME-52xx and ME-5810A/S boards, AI and DI streaming sub-devices. Acquisition does not function correctly with small IRQ thresholds. Using a value greater than 0 and less than 4 for the parameter 'iFifoIrqThreshold' in the routine meIOStreamConfig caused the following data acquisition to misfunction. In particular, using a value of 1 would cause the acquisition to block indefinitely.
Please note, to avoid very high CPU usage such low FIFO IRQ thresholds should only be used at correspondingly low sample rates.
If a iFifoIrqThreshold of 0 is used, then a suitable value will be calculated automatically.
2.0.5 Bug removed ME-5100, ME-52xx and ME-5810A/S boards, AI and DI streaming sub-devices. Long delay on terminating after a ring buffer overflow. If a streaming acquisition on these sub-devices caused a ring buffer overflow (ME_ERRNO_RING_BUFFER_OVERFLOW, error 72) because the application was not able to process the incoming data quickly enough, then the operation would not be terminated immediately but only after a considerable delay.
In particular, at high sampling rates, the system could become complete unresponsive and a reboot may have been necessary.
2.0.5 | Bug removed | ME-5100, ME-52xx and ME-5810A/S boards, AI and DI streaming sub-devices. | Acquisition using internal counter did not terminate correctly. | On these boards, if an acquisition with a pre-determined number of data was using the internal counter (flag ME_IO_STREAM_CONFIG_INTERNAL_COUNTER in meIOStreamConfig) then the acquisition would not be terminated correctly after the requested number of data had been acquired.
2.0.5 | Bug removed | ME-5810A/S boards, DI streaming sub-devices. | Delivery of data acquisition delayed. | At low sampling rates an acquisition would only start to deliver data after a considerable delay and the acquisition of a pre-determined number of data would take longer than expected.
2.0.5 | Bug removed | ME-52xx boards, AI and DIO sub-devices. | A race condition between these two sub-devices caused a number of problems. | Both these sub-devices use the same register for enabling interrupts. Due to an imperfect synchronisation on accessing this register, interference could arise between the two sub-devices which would cause unpredictable problems.
2.0.5 | Bug removed | ME-5100 and ME-5810A/S boards, DI streaming sub-devices. | Acquisition could not be started in blocking mode with an external trigger. | If the sub-device was so configured that the acquisition would start on receiving an external trigger and meIOStart was called in blocking mode, then the acquisition would never start, even after the arrival of the trigger.
2.0.5 | Addition | C++ test programs. | New test programs for C++ to demonstrate using the 52xx boards for AI streaming. | Three new programs Con_meIOStreamRead5200, Con_meIOStreamReadScan5200 and Con_meIOStreamReadCallbacks5200 were added to show how to use the ME-52xx boards for AI streaming acquisition. These programs are similar to the existing programs without the ...5200 suffix for the ME-46xx family of boards.
2.0.4 | Bug removed | ME-5004 boards. | Not recognized. | The new ME-5004 boards were not recognized by the ME-iDS driver system.
2.0.4 | Bug removed | ME-5xxx boards, DI, DO and DIO sub-devices. | Incorrect result on reading byte wise. | On all 16-bit wide ports of the ME-5xxx family of boards, reading byte wise would always return the value for channel 0 (low byte) even if channel 1 (high byte) was required and the correct channel number had been entered for the parameter 'iChannel' in the meIOSingle structure..
2.0.3 | Bug removed | ME-5261-8 and ME-5261-8E boards, AI sub-devices. | Data corruption. | Under certain circumstances the data acquired from the AI sub-devices on the ME-5261-8 and ME-5261-8E boards was corrupted in a random way.
2.0.2 | Bug removed | ME-5xxx boards, streaming input sub-devices. | The computer would ocasionally crash or freeze. | On ending a streaming input operation on an ME-5xxx board the computer would occasionally crash or freeze. This was more likely to happen when acquiring data at very high speeds.
2.0.2 | Bug removed | ME-52xx boards, AI sub-devices. | Hardware trigger not functioning for streaming operations. | On the AI sub-devices of the ME-52xx boards, although an acquisition had been configured to start or stop on the detection of a hardware trigger, this trigger would in fact have no effect.
2.0.2 | Bug removed | ME-52xx boards, FO sub-devices. | No signal was output. | The FO sub-devices on the ME-52xx boards did not function correctly. No signal was output.
2.0.2 Bug removed ME-581A boards. Subdevices 0 and 1 could not be reconfigured. On the ME-581A boards, sub-device 0 was permanently configured as a digital input sub-device and could not be reconfigured as a frequency input sub-device if required.
. Similarly, sub-device 1 was permanently configured as a digital output sub-device and could not be reconfigured as a frequency output sub-device if required.
This bug only affected the ME-5810A boards, not the ME-5810A/S boards.
2.0.2 | Bug removed | All ME-52xx boards except the ME-5284-8, DIO sub-devices. | Property 'Direction' could not ber read correctly. | On all the ME-52xx boards except the ME-5284-8, trying to read the value of the property 'Direction' on the digital input/output sub-device would return the error 'ME_ERRNO_PROPERTY_UNKNOWN' (89).
2.0.2 | Bug removed | ME-52xx boards, FI sub-devices. | Calling meQuerySubdeviceCaps returned an error code. | A call to the function meQuerySubdevice for the FI sub-device on an ME-5xxx board would return a random error code.
2.0.2 | Addition | ME-iDS Control Center | Menu bar added to the main window and copy command to the popup menu. | The menu bar now contains the menu items of the systray context menu and the export command. With the copy command of the popup menu the text of the selected item will be copied to the clipboard.
2.0.2 | Bug removed | ME-iDS Control Center | Export function did not work. | On Windows 7 64bit the export function did not save the content of the ME-iDS device tree to the text file.
2.0.1 | Bug removed | ME-5810A and ME-5810A/S boards, Counter sub-devices. | Reading from a counter sub-device on an ME-5810A or ME-5810A/S board could cause an application to hang. | If, on reading from a counter sub-device on these boards the first counter impulse had not yet arrived, so that the read routine returned with the error code 'ME_ERRNO_SUBDEVICE_NOT_RUNNING' (52), then the next attempt to read from or write to a counter sub-device or to write a single value to the DO sub-device would 'hang' (delay indefinitely) while waiting for a resource which had not been released correctly by the previous operation..
2.0.1 Bug removed ME-52xx boards. Streaming input operations on the ME-52xx boards did not achieve the expected sampling rate. On the AI and DI sub-devices of the ME-52xx family of boards the actual input rate was lower than the expected rate.
The difference was a maximum of 3% at a sampling rate of 2 MHz and proportionately less for lower sampling rates being < 0.2 % at 100 kHz.
2.0.1 Addition ME-5261-8E, ME-5265-8E and ME-5284-8E. Support was added for three new boards of the ME-52xx family with an AI input range of -+104 V. The three new boards are:

ME-5261-8E - Functionally equivalent to the ME-5261-8, but with an AI input range of -+104 V instead of -+10.4 V.
ME-5265-8E - Functionally equivalent to the ME-5265-8, but with an AI input range of -+104 V instead of -+10.4 V.
ME-5284-8E - Functionally equivalent to the ME-5284-8, but with an AI input range of -+104 V instead of -+10.4 V.
2.0.1 | Addition | ME-5004. | Support was added for a new board, the ME-5004, a variant of the ME-5002. | The new ME-5004 board has exactly the same functionality as the ME-5002 but with an extra D-sub connector.
2.0.0 | Bug removed | ME-6xxx boards which support streaming. | Synchronous start of several AO sub-devices on an ME-6xxx board would often not function correctly. | In the routine meIOStreamStart on the ME-6xxx family of boards, instead of checking for the correct flag "ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS", a check was made for the flag "ME_IO_SINGLE_START_TYPE_TRIG_SYNCHRONOUS" which is not used in this context. The result was, that an attempt to synchronously start a streaming output on several sub-devices would not function correctly.
2.0.0 | Bug removed | Systems using a config file | Devices not actually present on the system could nevertheless be marked as present | If no physical devices were actually present on an ME-iDS system, but a config file existed, then any devices listed in this config file would be marked incorrectly as 'plugged' instead of being marked as 'unplugged'.
2.0.0 | Addition | API. | The utility function meUtilityPWMRestart was added to the standard ME-iDS API | The new function makes it possible to restart a PWM operation that has been run once with meUtilityPWMStart and stopped with meUtilityPWMStop without repeating all the parameters which have to be passed to meUtilityPWMStart. Another advantage is that many of the changes made internally by meUtilityPWMStart need not be made again as meUtilityPWMRestart assumes that meUtilityPWMStart has already been called once.
2.0.0 Addition API. A new interface, 'Properties' for interaction with the ME-iDS driver system has been added to the ME-iDS API. The new interface is used for querying and setting device and sub-device characteristics. For details please see here.

At the moment, the new interface is only fully supported by the ME-5xxx family of boards. Support for older boards will be added gradually. All the older boards and the new ME-5xxx boards can also be programmed as before using the existing API which has been used up to this point. This existing interface will continue to be supported in the future.

One or two special features of boards in the ME-5xxx family can only be accessed using the new 'properties' API.

Calls to the existing API and to the new 'properties' API can be mixed as desired. For example, you can use the property "IOPinVoltageLevel" to set the general voltage level on a ME-5100 board to 3.3 volts and do the rest of your programming with the standard API.
2.0.0 Addition ME-5xxx boards. Support was added for the ME-5100, ME-5261-8, ME-5265-8, ME-5284-8, ME-5810A, ME-5810A/S, ME-5001 and ME-5002 boards The ME-5xxx is a new family of acquisition boards. At the moment the following boards ara available and supported by the ME-iDS API: ME-5100, ME-5261-8, ME-5265-8, ME-5284-8, ME-5810A, ME-5810A/S, ME-5001 and ME-5002. For further details please see here.

More boards in this family are planned and will be supported by the API as soon as they are available.
1.3.8 Bug Removed Systems using a config file. When using a config file (created with the config tool, MEiDC.exe) a small memory leak occurred each time meOpen was called. If a config file existed then calling meOpen caused a small memory leak. Repeatedly calling the sequence meOpen, meClose inside an application could lead to such a huge memory consumption that the application eventually crashed.

Note:
It is neither necessary nor desirable to call meOpen more than once in an application.
meOpen should be called just once on starting the application and meClose just once on terminating the application.
Apart from the problem with the memory leak which has now been fixed, a great deal of code is executed in meOpen and calling this function repeatedly would certainly slow an application down.
1.3.8 | Bug Removed | All Boards supporting meIOIrq... routines whether for external interrupt or other sub-devices. | Under rare circumstances a crash could occur when using these routines. | Calling meIOIrqWait with a time-out (which is done automatically if the callback routines are used) left a very narrow window of time in which an incoming interrupt could cause the system to crash (blue screen).
1.3.8 Change ME-46xxF Boards Continuous mode is no longer supported for FI sub-devices. Using continuous mode (by omitting the flag ME_IO_SINGLE_CONFIG_FI_SINGLE_MODE when calling meIOSingleConfig) on an FI-subdevice could cause the system to flooded with interrupts.
For this reason, continuous mode is no longer supported. Ths flag ME_IO_SINGLE_CONFIG_FI_SINGLE_MODE has been removed and the device always uses what was previously called single mode.

The flag ME_IO_SINGLE_TYPE_NONBLOCKING is also no longer supported in meIOSingle for FI sub-devices.
If the flag ME_IO_SINGLE_TYPE_FI_LAST_VALUE is used, then the routine returns immediately with the last mesured value. If ME_IO_SINGLE_TYPE_FI_LAST_VALUE is not used, then the routine returns after a new value has been measured or after the time-out has expired, whichever occurrs first.
1.3.8 Addition ME-Axon (ME-7). Additional ranges are now available for the voltage channels on the boards of the ME-Axon family. On all the boards of the Axon family except the ME-0712 and the ME-0714, the voltage channels now support four different ranges instead of a single range as previously.
For details please see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo for the ME-Axon boards.
1.3.7 Addition ME-46xxF Boards Support for the new FI and FO sub-devices on a new series of boards in the ME-46xx family. The ME-46xx family of boards has been extended. In the new series of boards, two of the DIO sub-devices have been replaced by four FI sub-devices and four FO sub-devices.

The FI sub-devices (Frequency In) are intended for frequency measurement of an incoming square wave.
The FO sub-devices (Frequency Out) are intended for pulse generation.

For details see ME-46xx device types, Frequency input (frequency measurement) sub-device and Frequency output (pulse generation) sub-device.

In particular, rwo new functions have been added to the ME-iDS API to support these sub-devices, see meIOSingleTicksToTime and meIOSingleTimeToTicks
1.3.7 Bug Removed ME-8100A Boards. Version 1.3.6 of the driver for this board caused the system to crash on installing the board. Due to an error which crept into the version 1.3.6 of the driver (meIDS8100.sys) for this board, trying to install a new board or updating the driver for an existing board caused a system crash with blue screen.
This bug did not affect the ME-8100B boards.
1.3.7 | Bug Removed | Counter sub-devices on all boards. | The code to recognize the 'NULL count' condition was incorrectly implemented. | The code introduced in version 1.3.6 (see below) to correct an error in recognizing a "NULL count' was, unfortunately, still not correct.
1.3.7 Change ME-Axon (ME-7). The 500 ampere range for the current channels on the AI sub-device is no longer supported. The current channels on the AI sub-devices on the ME-Axon boards no longer support the 500 ampere range (range index 1).
This range is reported by the routines meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo, but is no longer supported API.
An attempt to use this range in the routines meIOSingleConfig or meIOStreamConfig will cause an error ME_ERRNO_INVALID_SINGLE_CONFIG (4) "Invalid single configuration specified." respectively ME_ERRNO_INVALID_STREAM_CONFIG (37) "Invalid stream configuration specified." to be returned.
1.3.6 | Bug Removed | meIDS4000, meIDS6000 | In streaming operations, the 'NewValues' callback routine would not always be called as required. | Due to an error caused by a change in version 1.3.5, on AI and AO sub-devices on boards in the ME-46xx and ME-6xxx families, if using callback routines then the 'NewValues' callback would often not be called at all if a 'Start' callback routine had not been installed.
1.3.6 | Bug Removed | Counter sub-devices on all boards. | The code to recognize the 'NULL count' condition was incorrectly implemented. | The code introduced in version 1.3.0 (see below) to recognize the 'NULL count' condition on the counter sub-devices on all boards was incorrectly implemented and could lead to incorrect results.
1.3.6 | Bug Removed | ME-Axon (ME-7) | Incorrect error code returned from meIOStreamConfig for AI sub-device. | On the AI sub-device on the ME-Axon family of boards, if the channel list (parameter 'pConfigList') passed to the function meIOStreamConfig was incorrectly built, then the error code returned was ME_ERRNO_INVALID_SINGLE_CONFIG (4) instead of the correct error code ME_ERRNO_INVALID_STREAM_CONFIG (37).
1.3.6 Bug Removed ME-Axon (ME-7) The first voltage channel could not be configured correctly in streaming mode. The first voltage channel on the AI sub-device of the ME-Axon family of boards (channel 2 on the ME07x2 boards, channel 4 on the ME-07x4 boards) could not be configured correctly by calling 'meIOStreamConfig'.
Calling this function with the first voltage channel as a member of the channel list, 'pConfigList' returned the error code ME_ERRNO_INVALID_SINGLE_CONFIG (see the previous bug report above) although the correct range (0 - bipolar 10 V) had been used in the corresponding channel list entry (parameter 'iStreamConfig').
1.3.6 | Bug Removed | ME-1400D | The second external IRQ sub-device was not correctly initialized and would not be recognized. | On the ME-1400D boards, the second external IRQ sub-device (sub-device 37, the last sub-device) was not assigned a type. This meant that it would not be recognized by the query functions. In particular, the config tool, meIDC.exe would return an error if executed on a system containing a board of this type.
1.3.6 | Bug Removed | Python interface | Calling certain functions in the python interface caused memory leaks. | Calling the functions 'meIOStreamRead, 'meIOStreamWrite' or 'meUtilityExtractValues' in the python interface caused a memory leak.
1.3.6 Addition API New function 'meErrorGetLast' added to the API. A new function, meErrorGetLast(int* piErrorCode, int iFlags), was added to the API.

This function returns the value of the last error caused by an API function.
If 'ME_ERRNO_SUCCESS' (0) is returned, then no error has occurred since starting the application or since the internal error variable was last reset.
The internal error variable can be reset to ME_ERRNO_SUCCESS by calling this function with 'iFlags' = ME_ERROR_GET_LAST_CLEAR.
1.3.5 Bug Removed meIDS4000, meIDS6000 On the AI and AO sub-devices, very large sampling times (equivalently, very low frequencies) were sometimes handled incorrectly. On boards in the ME-46xx and ME-6xxx families, calling the function 'meIOStreamTimeToTicks' with a time between approximately 65 and 130 seconds or calling 'meIOStreamFrequencyToTicks' with a frequency between approximately 0.015 and 0.0075 Hz would return tick values which later caused an error when passed to the function 'meIOStreamConfig'.

In addition, on the ME-46xx family of boards, using a time greater than 130 seconds (or a frequency less than 0.0075 Hz) for the scan timer when acquiring data from a single channel would result in an incorrect sampling time.
When sampling a single channel, the maximum allowed sampling time is 130 seconds and using a larger value now causes an error to be returned from 'meIOStreamConfig'.
1.3.5 Bug Removed meIDS4000 and meIDS6000, Synapse LAN On the AI and AO sub-devices, terminating a streaming operation which was using callbacks would often cause an error. On Synapse LAN devices in the ME-46xx and ME-6xxx families, if a streaming operation was using callback functions, then, on calling 'meIOStreamStop' to terminate the operation the error code 62, 'ME_ERRNO_COMMUNICATION' was often returned.

This problem has now been solved as long as the locking routines 'meLock...' are not used in the application. A complete solution will follow shortly.
1.3.5 | Bug Removed | meIDS4000 | On the AI sub-device, meIOStreamRead in blocking mode could 'hang' under certain circumstances. | On the ME-46xx family of boards, if a streaming operation was taking place, 'meIoStreamRead' was called in blocking mode and the streaming operation was terminated (due to internal hardware or software overflow etc.) before the read operation was complete, then the call to 'meIOStreamRead' would never return causing the calling thread to hang.
1.3.5 | Bug Removed | meIDS4000 | When using callbacks during streaming on the AI sub-device, the callback functions were not always correctly called . | On the ME-46xx family of boards, if a limited streaming operation (the number of data to collect is known at the beginning and is determined by entries in the trigger structure) used callback functions, then the 'NewValuesCB' callback function would continue to be called after the acquisition had terminated, and the 'EndCB' callback function would never be called.
1.3.5 | Bug Removed | meIDS4000 | On the AI sub-device a FIFO overflow was not always reported. | On the ME-46xx family of boards, if the internal hardware FIFO happened to overflow during interrupt processing, then the overflow would not be reported to the user.
1.3.5 | Bug Removed | meIDS8200 | Incorrect IRQ status returned for the DI sub-device on newer board types. | With the older version of the board the IRQ status for the DI sub-device was sometimes returned incorrectly when working with the bit mask IRQ. Both the status and the extended status were subject to this error. The attempt to correct this error in version 1.3.2 (see below) was not entirely successful.
1.3.5 Bug Removed C# interface The functions in the C# interface were not declared with the correct calling convention. The functions in the C# interface were declared with the default calling convention (WinApp) instead of the correct calling convention (Cdecl).
In most cases this mistake was transparently corrected by .NET but led to an unseen inefficiency in the code. In the newest .NET framework (4.0 in Visual Studio 2010) this incorrect calling convention led to an error message when the program was running under the debugger.
1.3.5 | Bug Removed | Borland Delphi 6.0 Interface | The functions meErrorGetLastMessage and meErrorGetMessage used an incorrect parameter type. | The functions meErrorGetLastMessage and meErrorGetMessage in the Borland Delphi 6.0 Interface used the type 'AnsiString' for the parameter 'pcErrorMsg'. This could occasionally lead to an exception (access violation). These parameters now use the type 'PChar'.
1.3.3 | Bug Removed | MEphistoScope | Devices apart from MEphistoScope using the FTDI interface caused problems. | If, on a system on which the ME-iDS was installed, devices other than MEphistoScope were present which use the generic USB-interface 'FTDI' then unexpected behaviour including crashes could occur.
1.3.2 | Bug Removed | Mephisto Switch, Mephisto Digi, Mephisto Opto | Errors on accessing different sub-devices simultaneously from different threads. | If two separate threads tried to read simultaneously from different sub-devices, then it could occasionally happen that the first thread would receive the answer intended for the second thread and vice-versa.
1.3.2 | Bug Removed | meIDS8200 | Incorrect IRQ status returned for the DI sub-device on older board types. | With the older version of the board the IRQ status for the DI sub-device was sometimes returned incorrectly when working with the bit mask IRQ. Both the status and the extended status were subject to this error.
1.3.2 | Addition | MEphistoScope | Added support for the USB-device, MEphistoScope. | Support was added for the MEphistoScope device. For details see MEphistoScope Description. For an example of the way in which this device can be programmed using the ME-iDS API see Con_meIOMEphistoScopeStreamRead
1.3.1 | Bug Removed | meIDS8100 | Unable to configure a counter sub-device. | If meIOSingleConfig was called for a counter sub-device on an ME-8100 board then a spurioüs error code 5, "Invalid reference specified." was returned.
1.3.1 | Bug Removed | ME-7 boards - USB-Synapse | Possible system crash when sampling from one of the current channels. | Sampling from a current channel after having sampled from one of the upper voltage channels could, under certain circumstances, cause a crash.
1.3.0 | Bug Removed | meIDS8100 | Unreliable behaviour configuring DI and DO sub-devices. | Configuring a DI or DO sub-device on an ME-8100 board did not always lead to the results desired.
1.3.0 | Bug Removed | All boards, synapse USB versions, Windows 2000 | Suddenly removing the USB device caused the system to crash. | Even though all applications using the device system had been terminated correctly, removing a USB device suddenly by disconnecting the cable would cause the computer to crash. This problem seems only to have occurred with the operating system Windows 2000. Note this problem was considered solved in version 1.2.35 (see below) but persisted under some circumstances.
1.3.0 | Bug Removed | meIDS4000, ME-4680 boards | Problem starting streaming operations synchronously on AO sub-devices | Trying to start streaming operations on a number of separate AO sub-devices simultaneously using the flag 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' in the routine meIOStreamStart did not always work reliably.
1.3.0 Change Counter sub-devices on all boards. Error returned on reading if the counter value has not been loaded. If the counter value has not yet been loaded into the counting element of a counter sub-device (NULL count condition), then, instead of returning a spurious result on reading the counter, 0 is now returned together with an error code ME_ERRNO_SUBDEVICE_NOT_RUNNING.

Note:
The exact moment at which the counter value is loaded into the counting element depends on the counting mode used.
1.3.0 Change meIDS8100, meIDS8200. Resetting a DI or DO sub-device automatically terminates and resets the associated interrupt. On the ME-8200 boards, the DI sub-devices can generate a bit-pattern or bit-change interrupt and the DO sub-devices can generate an excess current interrupt.
On the ME-8100 family of boards, the DI sub-devices can generate a bit-pattern or bit-change interrupt.
In all of these cases, resetting the sub-device now causes interrupt monitoring to be terminated if running and the interrupt count to be reset to zero.
1.3.0 Addition Utility DLL. A utility DLL, meIDSTools.dll was added to the driver system. The utility DLL, in standard (meIDSTools.dll) and Visual Basic (meIDSToolsVB.dll) versions together with the corresponding library is installed automatically with the rest of the driver system.
This DLL will be extended over time and will contain functions which use the ME-iDS API and carry out commonly required tasks.
At the present time, this DLL contains a single function, meIDSToolsWaveGen, which, given an AO sub-device which supports streaming, can output a signal of a given form (sinus, triangle etc.) with a given frequency and amplitude continuously until terminated by the user.
1.3.0 Addition C++ and Visual Basic 2005 test programs. New test programs for C++ and Visual Basic 2005 to demonstrate the use of meIDSToolsWaveGen. A new program 'Con_meIDSToolsWaveGen' was added to the suite of C++ test programs and a new programm 'TestWaveGen' was added to the Visual Basic 2005 test programs.
Both of these programs demonstrate the use of the utility routine 'meIDSToolsWaveGen' contained in the new utility DLL, meIDSTools.dll (or meIDSToolsVB.dll for Visual Basic) mentioned in the previous entry in this table.
1.3.0 Changes and additions Online help file. The online help file was extended and improved. The online help file, the file you are looking at now, was improved and extended.
The exact use of the ME-iDS API for all families of boards is now explained in detail.
The file has a more consistent, hierarchical structure.
1.2.38 | Bug removed | ME-7 boards - USB-Synapse | Occasional crash when sampling from one of the current channels after resetting the offset | After resetting the offset on one of the current channels of the AI sub-device on the ME-7 family of boards using the new constant introduced in version 1.2.35 (see below), acquiring data from the same channel using the routine meIOSingle could lead to a system crash.
1.2.38 | Addition | ME-7 Test program, Dlg_M-7_Test | For each current channel, a button for resetting the offset was added to the user interface | The use of the new constant introduced in version 1.2.35 (see below) which can be used when calling meIOSingle to reset the channel offset and at the present time only applies to the current channels on the AI sub-device of the ME-7 family of boards is now demonstrated in the test program Dlg_M-7_Test.exe.
1.2.38 | Addition | New Visual Basic 6.0 test program | A new visual basic 6.0 test program with source code, TestStreamRead was added to the SDK | This new test program corresponds exactly to the existing Visual Basic 2005 program of the same name.
1.2.37 | Bug removed | ME-7 boards | The routine to reset the calibration offset at run-time did not function correctly. | Trying to use the new constant ME_DIR_SET_OFFSET, for the parameter 'iDir' in the structure 'meIOSingle' to reset the offset for the channels on the AI sub-device of an ME-7 device by calling the routine meIOSingle caused a 'Not Supported' error (16) to be returned.
1.2.37 | Bug removed | meIDS4000, ME-4660s and ME-4660is. | Names and descriptions for these boards were displayed incorrectly. | In the windows device manager, in the ME-iDS control center and in any program making use of the routines meQueryNameDevice or meQueryDescriptionDevice, the text displayed was that corresponding to the version of the board without the 'sample and hold' feature. The ME-4660s board was thus displayed as an ME-4660 board and the ME-4660is board was displayed as an ME-4660i board.
1.2.37 Bug removed C# and Visual Basic (6.0 and 2005) interfaces. New constants were missing from the interface definitions for these languages. Definitions for the following new constants were missing from the interfaces for C#, Visual Basic 6.0 and Visual Basic 2005:

ME_DIR_SET_OFFSET
and
ME_CAPS_AI_SAMPLE_HOLD
1.2.35 | Bug Removed | All boards, synapse USB versions, Windows 2000 | Suddenly removing the USB device caused the system to crash. | Even though all applications using the device system had been terminated correctly, removing a USB device suddenly by disconnecting the cable would cause the computer to crash. This problem seems only to have occurred with the operating system Windows 2000.
1.2.35 | Bug Removed | meIDS4000 | GetSubdeviceCaps occasionally returned a spurious error for DI and DO sub-devices. | On the ME-46xx family of boards, calling GetSubdeviceCaps for DI or DO sub-devices could occasionally return a spurious error although the routine was being called perfectly correctly. The error code returned was random.
1.2.35 | Addition | ME-7 boards | The calibration offset can be determined by the user and reset at run-time. | On the ME-7 boards, using a new constant, ME_DIR_SET_OFFSET, for the parameter 'iDir' in the structure 'meIOSingle', the routine meIOSingle can be used to reset the offset for the channels on the AI sub-device. This is designed to be used in conjunction with the two or four current channels on this sub-device.
1.2.34 | Addition | ME-7 boards | An additional range was added for the current channels on the ME-7 family of boards | A new range, 250 milliamperes with a 5 milliohm resistance, was added to those supported by the current channels on the boards of the new ME-7 family.
1.2.33 | Addition | Support for new hardware | Support was added for the new ME-7 family of data acquisition boards | In the new family of boards, two or four of the potential channels on the AI sub-device are replaced by current channels supporting eight different ranges from -+ 250 microamperes to -+ 500 amperes. If a current overload is detected, then the channel switches automatically into the largest range and an interrupt can be generated.
1.2.32 | Bug Removed | meIDS4000 | Very short data acquisitions sometimes returned a spurious error 47 (ME_ERRNO_CANCELLED). | On the AI sub-device of an ME-4600 board, a finite data acquisition (using ME_TRIG_TYPE_COUNT in the trigger structure) which lasted less than 10 milliseconds could incorrectly generate an error 47 (ME_ERRNO_CANCELLED, "Operation cancelled.") on terminating. The shorter the acquisition, the more likely this was to happen.
1.2.32 | Addition | C++ test programs | A new test program Con_meErrorSetUserProc was added | A new test program Con_meErrorSetUserProc was included in the C++ test program suite. This program demonstrates using the API function meErrorSetUserProc to install a user-defined error function.
1.2.31 | Addition | meIDS4000 | New #define ME_CAPS_AI_SAMPLE_HOLD as possible flag returned by meQuerySubdeviceCaps. | On calling the routine meQuerySubdeviceCaps on the AI streaming sub-device of an ME-4600 board, the function returns with the flag ME_CAPS_AI_SAMPLE_HOLD flag set if the board supports SampleAndHold.
1.2.30 | Bug Removed | meIDS4000, ME-4660, ME-4660I and ME-4680S boards | Incorrect descriptions displayed in device manager. | Due to an error in the file meilhausIDS.inf, an incorrect or incomplete description was displayed for these boards in the windows device manager.
1.2.30 | Bug Removed | meIDS1600 | Only one meIDS1600 device could be addressed correctly. | If a system contained more than one ME-1600 board, then all operations using an meIDS1600 device would address the same board regardless of the device index used in calling the functions.
1.2.30 | Bug Removed | meIDS1600 | Unpredictable output on changing the configuration of an AO sub-device. | Calling 'IoSingleConfig' to change the output range of an AO sub-device resulted in an unpredictable output current or voltage. Now, immediately after changing the range, the output value is automatically set to zero for the -10V - +10V range and to the minimum value for the other ranges.
1.2.30 | Change | Con_meIOStreamReadScan | Test program extended to sample 4 channels (default). | The test program Con_meIOStreamReadScan now makes a data acqisition over the first four channels of the first AI streaming device found in the system. The number of channels sampled is determined by a #define. This can be easily changed and the program recompiled by the customer.
1.2.29 | Addition | ME-PowerLab2 | Measurement laboratory ME-PowerLab2 added to release. | The measurement laboratory software ME-PowerLab2 based on the ME-iDS system is now distributed with the rest of the driver system software.
1.2.29 Change Visual basic 2005 test program Code extended and comments added. The VB 2005 program TestStreamRead was extended to use meQueryRangeByMinMax.
A number of (hopefully) helpful comments were added.
1.2.28 Bug removed Mephisto devices Mephisto device addressed incorrectly in conjunction with an existing configuration file. In a system containing one or more mephisto devices and on which a configuration file had already been created, the mephisto devices were sometimes given incorrect internal device numbers.

This meant that routines called to address a mephisto device would actually address another device in the system with unforseen results.
1.2.28 | Bug removed | meIDS4000, meIDS6000. | On AO-streaming sub-devices, meIOStreamWrite was always executed in non-blocking mode. | Even if meIOStreamWrite was called in blocking mode (by passing ME_WRITE_MODE_BLOCKING for the third parameter 'iWriteMode') the operation would be executed in non-blocking mode. The function would always return immediately and if not enough room was available in the internal ring-buffer, then not all of the data would be transferred.
1.2.28 | Bug removed | meIDS1400, ME-1400C and ME-1400D boards. | External IRQ did not function on the ME-1400C and ME-1400D boards. | The external IRQ did not function at all on these boards. In addition, the ME-1400D board only presented one external IRQ sub-device whereas in fact it contains two.
1.2.28 | Addition | meIDS4000. | Calibration used for AI sub-devices. | The calibration constants contained in the EEPROM of the ME-46xx boards are now used to improve the accuracy of the acquired data.
1.2.28 | Addition | Test programs. | Two new C++ and C# test programs added. | Two new test programs Con_meUtilityPWM and Con_meIOResetDevice were added to the C++ and C# test programs.
1.2.28 Addition C#, Visual Basic 6.0 and Visual Basic 2005 Interfaces. Added missing constants to C# and Visual Basic interfaces. Added missing functions to C# interface. New #defines introduced into the ME-iDS API this year have now been added to the C# and Visual Basic interfaces.

The routines meUtilityDigitalToPhysicalV and meUtilityPhysicalToDigitalV were added to the C# interface for the first time.
1.2.27 Bug removed meIDS4000, PCI boards. A finite AI-Streaming operation was not ended automatically. Due to an error introduced in version 1.2.25, a finite AI-streaming operation on a PCI board was not ended automatically after the required number of data values had been sampled, but continued indefinitely.

This error did not occur on Synapse USB versions of the board.
1.2.27 | Change | meIDS4000 | Small change in the behavior of meIOStreamRead . | If meIOStreamRead is called after a streaming operation is terminated and the data buffer is empty, then the call only returns an error (ME_ERRNO_SUBDEVICE_NOT_RUNNING - 52) on the second and subsequent calls, although, of course, the parameter 'piCount' also contains '0' after returning from the routine the first time it is called.
1.2.27 | Change | C++ Test program Con_meIOStreamReadScan | Code improved and made more understandable. | The code here has been made easier to understand and corresponds more closely to the kind of code which would be used in the practice.
1.2.26 Bug removed meIDS8100. The function meIOSingleConfig often returned ME_ERRNO_SUCCESS although it had failed. On this family of boards, the return value from the function meIOSingleConfig was almost always ME_ERRNO_SUCCESS although the function had failed due to passing incorrect parameters.
There was no indication that the function had failed and that therefore the configuration of the sub-device had not been changed.
1.2.25 | Bug removed | meIDS4000, ME-4660s and ME-4660is. | Trying to install these boards caused a system crash. | Due to an unfortunate omission in the code for the ME-46xx family of boards, trying to install an ME-4660s or an ME-4660is board caused an immediate system crash.
1.2.25 Bug removed meIDS4000, meIDS6000, meIDS8200. Crashes or incorrect behaviour due to race conditions on multiprocessor systems. Under extreme conditions (high frequencies, frequent starting and stopping etc.), race conditions on multiprocessor systems occasionally caused system crashes or application stalls on multiprocessor systems.

All boards supporting streaming operations (input or output) and/or interrupt operations may have been affected.
Among the boards supporting interrupt operations, the ME-8200 and ME-8200B boards were particularly affected.
1.2.25 | Bug removed | meIDS4000. | Differential channels could not be used in an AI streaming operation. | Using differential channels in a call to meIOStreamConfig for an AI operation caused a spurious error message to be generated (error code 3, 'invalid channel') and the configuration operation was rejected.
1.2.25 | Bug removed | meIDS4000. | An AI 'scan' operation sometimes didn't immediately return all the required values. | If a data acquisition operation was configured for a predetermined number of data values by setting iScanStopTrigType or iAcqStopTrigType in the trigger structure to ME_TRIG_TYPE_COUNT. Then, on starting the acquisition and waiting for all the acquired data to be returned in a data buffer by calling meIOStreamRead in blocking mode, this latter function sometimes returned with less than the required number of data values.
1.2.25 | Bug removed | meIDS8100, meIDS9x. | Incorrect bit-wise read operations on DI and DO sub-devices. | Due to an error which inadvertently slipped into these drivers in version 1.2.24, bit-wise read operations on DI and DO sub-devices returned incorrect results.
1.2.25 | Bug removed | meIDS8100. | Incorrect bit and byte-wise write operations on DO sub-devices. | Writing bit or byte-wise to a DO sub-device on the boards of this family produced an incorrect result..
1.2.25 | Bug removed | Counter sub-devices on all boards. | #defines (constants) missing for parameter 'iFlag' in the routine meUtilityPWMStart. | The possible values for the parameter 'iFlag' in the routine meUtilityPWMStart were inadvertently omitted from the file medefines.h. These constants, ME_PWM_START_NO_FLAGS or ME_PWM_START_CONNECT_INTERNAL can now be found in medefines.h.
1.2.25 | Addition | DIO sub-devices on all boards. | iFlags = ME_VALUE_DEFAULT allowed in meIOSingleConfig for DIO sub-devices on all boards. | Instead of having to use the correct define out of the set ME_IO_SINGLE_CONFIG_DIO_... (for example ME_IO_SINGLE_CONFIG_DIO_BYTE for an 8-Bit port, ME_IO_SINGLE_CONFIG_DIO_WORD for a 16-Bit port etc.) for the parameter 'iFlags' in the routine meIOSingleConfig, it is now possible to simply use the constant ME_VALUE_DEFAULT (0) in all cases.
1.2.25 Addition meIDS4000. Error generated if an AI streaming operation causes a hardware or software FIFO overflow. In previous versions of the driver, an AI streaming operation which was terminated internally because it had caused a hardware or software FIFO overflow would be ended silently. Subsequent calls to meIOStreamRead would only return the error code 52, 'subdevice not running'

Now, under such circumstances, a call to meIOStreamRead returns either error code 80, 'hardware FIFO overflow' or error code 72, 'ring buffer overflow' (software FIFO overflow).
1.2.24 Bug removed meIDS1600. Incorrect values output on the AO devices. Calling meUtilityPhysicalToDigital with a physical (amps or volts) value on or above the upper limit of the range used returned an incorrect digital value. Using this digital value in meIOSingle caused a physical value to be output corresponding to the lower limit of the range in use.

The problem was caused by an error in the routines meQueryRangeByMinMax and meQueryRangeInfo for the ME-1600 boards. These routines returned 0x1000 for piMaxData instead of the correct value of 0x0FFF.
There was a corresponding error in the value returned for pdMax.
1.2.24 Bug removed All drivers. Inconsistent results using meIOSingle to read a single bit from a digital sub-device. On some digital sub-devices (DI, DO, DIO) on some boards, calling meIOSingle with the flag ME_IO_SINGLE_TYPE_DIO_BIT returned the value 0 when the bit was cleared and 1 when the bit was set. On other such sub-devices and on other boards, 0 was returned when the bit was cleared, but a value corresponding to the bit's position (1 for bit 0, 2 for bit 1, 4 for bit 2 etc.) was returned when the bit was set.

Now, on all digital sub-devices on all boards 0 is returned when the bit is cleared and 1 when the bit is set.
1.2.24 | Bug removed | meIDS4000, ME-4660i, ME-4670i, ME-4670is, ME-4680i and ME-4680is boards. | Not possible to read back from the DO sub-device on these boards. | The second sub-device (sub-device 1) on each Each of these opto-isolated boards is a DO sub-device. Although it should always be possible to read back the value written to a DO sub-device (or to a DIO sub-device configured in output mode), on these devices a read operation caused an error.
1.2.24 | Bug removed | meIDS8200, old firmware version | Triggering an IRQ on a DI sub-device caused the computer to freeze. | After starting an IRQ operation (mask or pattern) on an ME-8200 board with the old firmware, the first interrupt to be generated would not be cleared, thus causing the computer to remain in an infinite loop. This would freeze operations completely on a machine with only a single processor.
1.2.24 | Bug removed | meIDS6000 | Writing single values to several AO sub-devices synchronously only affected the first four sub-devices. | The ME-6000 boards have up to 16 AO sub-devices. Attempting to write single values synchronously to a selection of these sub-devices had no effect on any except the first four AO sub-devices on the board.
1.2.24 Bug removed meIDS8100 and meIDS8200 Unable to read from a DI port during an interrupt operation on this port. After starting an interrupt operation with meIOIrqStart (bit pattern or bit mask) it was not possible to read from the port until the operation had been terminated with meIOIrqStop.

Note:
In the case of a bit mask interrupt, the value 'piValue' returned by the routine meIOIrqWait or passed to the installed callback routine is not the current value read from the port, but a mask showing which bits have changed since the last time the callback routine or meIOIrqWait was called.

See the entries for the meIDS8200 and meIDS8100 modules under version 1.2.21 below.
1.2.24 Bug removed meIDS4000, ME-4660 and ME-4660i boards. Crash on trying to output single values synchronously on ME-4660 and ME-4660i boards. An attempt to output data synchronously on two or more AO sub-devices on these boards would cause an immediate system crash.

Note:
These boards have two AO sub-devices. All other ME-4000 boards have either 4 AO sub-devices or none at all.
1.2.24 | Bug removed | meIDS4000, meIDS6000 | AO sub-device streaming. No standard output value after calling meIOResetDevice or meIOResetSubdevice. | If an AO sub-device on these boards was operated in streaming mode, then, after stopping the streaming operation, the last output value remained on the wire even after calling meIOResetDevice or meIOResetSubdevice. Calling one of these functions should change the output value to 0 V.
1.2.24 | Bug removed | VB 6.0 and VB 2005 Interfaces | Corrected minor errors in the VB 6.0 (meIDS.bas) and VB 2005 (meIDS.vb) interfaces to the ME-iDS system.. | Errors were corrected in the declarations of the functions meIOSingleConfig and meUtilityPhysicalToDigital for Visual Basic 6.0 and in the declarations of the functions meIOSingleConfig, meQuerySubdeviceCapsArgs, meUtilityPhysicalToDigital, meUtilityPWMStart and meUtilityPWMStop for Visual Basic 2005.
1.2.24 Change Test programs Restructuring of directories. Major renaming of directories and files. Due to problems on the release DVD with the depth of directories and with the length of the complete path names to the test programs, two intermediary directories 'TestConsole' and 'TestDialog' have been removed from the 'MS Visual C' directory. Here and in the directories corresponding to other programming languages, the names of sub-directories and files have been shortened.
For technical reasons the directory 'MS Visual C#' has been renamed 'MS Visual C-Sharp'.
1.2.23 | Bug removed | meIDS4000, meIDS6000 | AO sub-device streaming. Data error on calling meIOStreamWrite. | If a buffer was written to an AO streaming device using meIOStreamWrite, then the first five values written to the device were incorrect. After these first five values the data was the written correctly from the buffer passed, but the last five values of the buffer were not used.
1.2.23 Bug removed meIDS4000 AI sub-device streaming. Data error if meIOStreamConfig was not called before each call to meIOStreamStart. It should be possible to call meIOStreamConfig once and then make several data acquisition operation by repeated calls to meIOStreamStart (followed, if necessary, by a corresponding call to meIOStreamStop).

Due to an error in the implementation of the AI sub-device code for the ME-46xx family of boards, data errors could occur if each call to meIOStreamStart was not preceeded by a call to meIOStreamConfig.
1.2.23 | Bug removed | meIDS1600 | Unsynchronised writes to AO sub-devices were not executed. | Calling meIOSingle for an AO sub-device on an ME-1600 board had no effect unless the parameter 'iFlags' in the corresponding meIOSingle structure was set to 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS'.
1.2.23 Bug removed meIDS6000 meIOSingleConfig did not function correctly for DIO sub-devices. Calling meIOSingleConfig for a DIO sub-device on a corresponding member of the ME-6000 family of boards had no effect. This meant that the sub-devices remained in their default configuration, as input ports. It was not possible to output digital values via these ports.

Note:
Not all members of the ME-6000 family have DIO ports.
1.2.23 Bug removed All drivers meUtilityDigitalToPhysical functioned correctly only with iModuleType = ME_MODULE_TYPE_MULTISIG_NONE. If a module type other than ME_MODULE_TYPE_MULTISIG_NONE was used then it was ignored and the physical value returned was that which would correspond to the digital value if no module were present.

1.2.23 Bug removed meIDSCustomerTrace Error occurred if a trace-file name was entered without a path. A trace-file name can now be entered without a path. In this case the file will be created in the same directory as the application meIDSCustomerTrace itself.

The extension '.etl' will always be appended to the file name. If necessary a different, existing extension will be replaced.
1.2.23 | Addition | Delphi 6.0 | Interface and test programs for Delphin 6.0 added. | Interface and test programs for Delphin 6.0 added.
1.2.23 | Addition | Visual Basic 6.0 test programs | Additional test programs for Visual Basic 6.0 were included. | Additional test programs for Visual Basic 6.0 were included.
1.2.23 Change Python interface Interface and test programs for Python were changed. Changes and improvements were made to the interface and the test programs for Python.

Note:
This version of the ME-iDS supports Python 2.5.2.
1.2.22 | Bug removed | meIDS4000, meIDS6000 | Error in the implementation of meIOSingle on writing to an AO sub-device and using an external trigger | A value written an AO sub-device on an ME-4600 or ME-6000 board would be output immediately although the sub-device had been configured to wait for an external trigger before outputting the value.
1.2.22 | Change | LabVIEW VI | meQueryInfoDevice.vi and singleDIO.vi were updated. | These components were updated to match changes in the underlying system.
1.2.21 | Bug removed | All drivers | Changing the device order with the config tool led to errors | The function meQueryVersionDeviceDriver did not take account of a change in the device order made using the Config tool.
1.2.21 | Bug removed | All drivers - Version without LAN support | In the version without LAN support the config file was ignored | This meant that changes made in the device order using the config tool were not having any effect in the version without LAN support.
1.2.21 | Bug removed | meIDS4000 | Error in the meIDS4000 implementation of meIOIrqStart | The fifth parameter, 'iIRQEdge', passed to meIOIrqStart was incorrectly interpreted in the case of a board belonging to the ME-46xx family.
1.2.21 | Bug removed | meIDS6000 | Error in the meIDS6000 implementation of meIOSingle on reading from an AO sub-device | Reading a value from an AO sub-device on an ME-6000 board returned an incorrect result.
1.2.21 | Bug removed | meIDS8100 | Error in the meIDS8100 implementation of meIOSingle on reading from a DO sub-device | Reading a value from a DO sub-device on an ME-8100 board returned an incorrect result.
1.2.21 Bug removed meIDS4000, meIDS6000 Under certain circumstances, when using an external trigger, AI and AO sub-devices remain 'busy' after an operation is completed On boards in the ME-46xx and ME-6xxx families, when using an external trigger to start single or streaming operations on AI or AO sub-devices, if the trigger did not arrive then the sub-device remained busy after the time-out and could not be used for further operations.

On boards in the ME-46xx family, when using an external trigger to start single operations on an AI sub-device the sub-device remained busy and could not be used for further operations even after successful completion of the operation.
1.2.21 Change meIDS1600 Device/Sub-device relationship changed Instead of 1, 2, 3 or 4 sub-devices each with four channels, the members of this family of boards now have 4, 8, 12 or 16 sub-devices each with a single channel.

In addition, analog output can be carried out simultaneously on any desired combination of sub-devices.
1.2.21 Change meIDS4000, meIDS6000, meIDS630, meIDS8100, meIDS8200 and meIDS9x Sub-device order changed The sub-device order was changed in the following devices: meIDS4000, meIDS6000, meIDS630, meIDS8100, meIDS8200 and meIDS9x.
Note:
The sub-device order for all devices is now as follows: DI, DO, DIO, AI, AO, CTR, ExtIRQ.
1.2.21 Addition meIDS8200, meIDS8100 Flag ME_IO_IRQ_START_PATTERN_FILTERING added. When the ME-8100 or ME-8200 boards are used to generate an interrupt on a pattern match, spurious interrupts may occur if the input, on passing from one non-matching pattern to another non-matching pattern, 'goes through' a pattern match.

Using the flag ME_IO_IRQ_START_PATTERN_FILTERING in the routine meIOIrqStart, these spurious interrupts can be avoided.

If this flag is used an interrupt is only generated if the port value corresponds to the pattern on entering the internal interrupt routine.
1.2.21 Addition meIDS8200, meIDS8100 Flags ME_IO_IRQ_START_EXTENDED_STATUS, ME_IO_IRQ_WAIT_NORMAL_STATUS and ME_IO_IRQ_WAIT_EXTENDED_STATUS added.

Using the flag ME_IO_IRQ_START_EXTENDED_STATUS on calling meIOIrqStart causes an extended status to be returned by the IRQ callback routine or on calling meIOIrqWait.

Calling meIOIrqWait with the flag ME_IO_IRQ_WAIT_NORMAL_STATUS or ME_IO_IRQ_WAIT_EXTENDED_STATUS causes this function to override the status choice made in meIOIrqStart.

Although these flags can always be used in the routines meIOIrqStart and meIOIrqWait, only for the ME-8100 and ME-8200 family of boards and only when generating an interrupt on a bit change (not on a pattern match) is there a difference between the normal status and the extended status.

In this case, the normal status shows the bits which have changed since the last interrupt and the extended status shows separately the bits which have changed on falling edge (1 --> 0) and those which have changed on rising edge (0 --> 1).

  • ME-8100: Bits 0 to 15 - Falling edge; Bits 16 to 31 - Rising edge.
  • ME-8200: Bits 0 to 7 - Falling edge; Bits 16 to 23 - Rising edge.
Note:
On the ME-8100 boards and on the ME-8200 boards with a frirmware version less than 7, this functionality is emulated in software.
On the ME-8200 boards with a firmware version greater than 7, this functionality is supported diorectly in the hardware.
1.2.21 Addition meIDS630, meIDS1400 and meIDS8200 Added support for ME-630, ME-8200 and ME-1400 Mephisto Switch. Digital input and output operations are now supported on the Mephisto Switch devices.
Note:
Interrupts are NOT supported.
1.2.21 | Bug removed | meIDSControlCenter | Error in system tray installation corrected. | On certain systems the meIDSControlCenter application was not being installed correctly in the system tray on starting the operating system.
1.2.21 | Bug removed | C++ Test programs | Error in TestConsole_meIOSingleReadAnalog.exe corrected | Incorrectly placed closing parenthesis caused only one sub-device to be listed even if several suitable sub-devices were available in the system.
1.2.21 | Addition | C++ Test programs | Test program TestConsole_meIDSSystemInfo added | A new C++ test program, TestConsole_meIDSSystemInfo.exe, which simply displays a list of the ME-iDS devices found on the system, was added.
1.2.21 Addition C++ Test programs Test program TestConsole_meIOSingleWriteAnalog generalised. The user is now presented with a choice of all the sub-devices in the system which support single analog write operations.

Previously the first such sub-device was chosen automatically.
1.2.21 Addition C++ Test programs Test program - Four different versions of TestDialog_StreamRead_Callback available.

The TestDialog_StreamRead_Callback program now exists in four different versions:

  • 1. TestDialog_StreamRead_Callback.exe - Displays a data acquisition over the first four channels for the first AI-Streaming sub-device found in the system.
  • 2. TestDialog_StreamRead_Callback_2Boards.exe - Displays a data acquisition over the first four channels for the first two AI-Streaming sub-devices found in the system.
  • 3. TestDialog_StreamRead_Callback_3Boards.exe - Displays a data acquisition over the first four channels for the first three AI-Streaming sub-devices found in the system.
  • 4. TestDialog_StreamRead_Callback_Fullscreen.exe - As 1. above, but adapts itself to the resolution of the screen.
1.2.21 Addition C# support C# support and six C# test programs added.

An interface file for C# was added together with the first six C# test programs:

  • 1. TestConsole_meIDSSystemInfo_CS.exe.
  • 2. TestConsole_meIOSingleReadAnalog_CS.exe.
  • 3. TestConsole_meIOStreamRead_CS.exe
  • 4. TestConsole_meIOExtIrqCallback_CS.exe
  • 5. TestConsole_meIOSingleWriteAnalog_CS.exe
  • 6. TestConsole_meIOStreamWrite_CS.exe

These test programs correspond exactly to the similarly named C++ test programs.

1.2.21 Addition Visual Basic 2005 support Visual Basic 2005 support and a first Visual Basic 2005 test program added.

An interface file for Visual Basic 2005 (meIDS.vb) was added together with the first two VisualBasic 2005 test program:

  • 1. TestSystemInfo_VB2005.exe.
  • 2. TestSystemRead_VB2005.exe.
1.2.21 | Addition | Agilent VEE | Support for Agilent VEE 8.5 added. | This version of Agilent VEE is now supported by the ME-iDS driver system.
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Error Codes and their Meanings

Error Codes and their Meanings

All the API functions return an integer error code.

The table below shows how this return value is to be interpreted.

The API function meErrorGetMessage can be used to convert this error code into a text message.

Error number (dec) | Error number (hex) | Constant | Meaning | Notes, possible reasons
0 | 0x0 | ME_ERRNO_SUCCESS | Success - No error. | The called function returned successfully.
1 | 0x1 | ME_ERRNO_INVALID_DEVICE | Invalid device number specified. | There is no device mapped to the requested device number (device index).
2 | 0x2 | ME_ERRNO_INVALID_SUBDEVICE | Invalid subdevice number specified. | For the requested device there is no subdevice mapped to the requested subdevice number (subdevice index).
3 | 0x3 | ME_ERRNO_INVALID_CHANNEL | Invalid channel number specified. | No channel available with the given index for this subdevice.
4 | 0x4 | ME_ERRNO_INVALID_SINGLE_CONFIG | Invalid single configuration specified. | -
5 | 0x5 | ME_ERRNO_INVALID_REF | Invalid reference specified. | -
6 | 0x6 | ME_ERRNO_INVALID_TRIG_CHAN | Invalid trigger channel specified. | -
7 | 0x7 | ME_ERRNO_INVALID_TRIG_TYPE | Invalid trigger type specified. | -
8 | 0x8 | ME_ERRNO_INVALID_TRIG_EDGE | Invalid trigger edge specified. | -
9 | 0x9 | ME_ERRNO_INVALID_TIMEOUT | Invalid timeout specified. | -
10 | 0xA | ME_ERRNO_INVALID_FLAGS | Invalid flags specified. | -
11 | 0xB | ME_ERRNO_OPEN | Can't open driver system. | The ME-iDS driver system might not be installed properly.
12 | 0xC | ME_ERRNO_CLOSE | Can't close driver system. | -
13 | 0xD | ME_ERRNO_NOT_OPEN | Driver system was not opened by user process. | The API function meOpen must be called before calling any other API function (except meQueryVersionLibrary and the meUtility... functions).
14 | 0xE | ME_ERRNO_INVALID_DIR | Invalid single direction specified. | -
15 | 0xF | ME_ERRNO_PREVIOUS_CONFIG | Device was not configured for this function. | The error happens when the subdevice has been configured for input (e.g. ME_SINGLE_CONFIG_DIO_INPUT), but the function meIOSingle was called with iDir = ME_DIR_OUTPUT
16 | 0x10 | ME_ERRNO_NOT_SUPPORTED | Function not supported by device. | Called function is not supported by subdevice, Functions meUtilityPWMStart, meUtilityPWMStop, meUtilityPWMRestart: used sub-device is not a counter.
17 | 0x11 | ME_ERRNO_SUBDEVICE_TYPE | No such subdevice type available on this device. | -
18 | 0x12 | ME_ERRNO_USER_BUFFER_SIZE | User buffer size is too small to hold name. | The size in bytes of the given buffer is too small. It is recommended to use the constants ME_DEVICE_xxx_MAX_COUNT defined in MeIDS header files.
19 | 0x13 | ME_ERRNO_LOCKED | The Resource or parts of it is locked by another process. | Another application locked the resource using one of the meLockxxx functions
20 | 0x14 | ME_ERRNO_NO_MORE_SUBDEVICE_TYPE | No more subdevice of this type available. | The function meQuerySubdeviceByType() could not find any more subdevices of the given type starting from index in parameter iStartSubdevice.
21 | 0x15 | ME_ERRNO_TIMEOUT | Operation timed out. | The operation took too long to respond.
22 | 0x16 | ME_ERRNO_SIGNAL | Operation aborted by signal. | -
23 | 0x17 | ME_ERRNO_INVALID_IRQ_SOURCE | Invalid irq source specified. | -
24 | 0x18 | ME_ERRNO_THREAD_RUNNING | There is a background thread running on this subdevice. | -
25 | 0x19 | ME_ERRNO_START_THREAD | Cannot start background thread. | -
26 | 0x1A | ME_ERRNO_CANCEL_THREAD | Cannot cancel background thread. | -
27 | 0x1B | ME_ERRNO_NO_CALLBACK | No callback function for notification on irq or new values specified. | A callback function must be set for the subdevice using meIOIrqSetCallback(), meIOStreamSetCallbacks() or meErrorSetUserProc().
28 | 0x1C | ME_ERRNO_USED | The Resource or parts of it is currently used by another process. | -
29 | 0x1D | ME_ERRNO_INVALID_UNIT | Invalid physical unit specified. | Function meQueryRangeByMinMax: The given value in parameter iUnit is not supported by the subdevice
30 | 0x1E | ME_ERRNO_INVALID_MIN_MAX | Invalid minimum and maximum values specified. | -
31 | 0x1F | ME_ERRNO_NO_RANGE | No matching range found. | Function meQueryRangeByMinMax: No range could be found matching the given values of pdMin, pdMax and iUnit.
32 | 0x20 | ME_ERRNO_INVALID_RANGE | Invalid range specified. | No range available on requested sub-device.
33 | 0x21 | ME_ERRNO_SUBDEVICE_BUSY | Subdevice is busy. | Functions meIOSingle, meIOStreamConfig: Subdevice is performing another operation
34 | 0x22 | ME_ERRNO_INVALID_LOCK | Invalid lock specified. | -
35 | 0x23 | ME_ERRNO_INVALID_SWITCH | Invalid switch specified. | -
36 | 0x24 | ME_ERRNO_INVALID_ERROR_MSG_COUNT | Error message string is to small. | -
37 | 0x25 | ME_ERRNO_INVALID_STREAM_CONFIG | Invalid stream configuration specified. | -
38 | 0x26 | ME_ERRNO_INVALID_CONFIG_LIST_COUNT | Invalid stream configuration list count specified. | -
39 | 0x27 | ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE | Invalid acquisition start trigger type specified. | -
40 | 0x28 | ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE | Invalid acquisition start trigger edge specified. | -
41 | 0x29 | ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN | Invalid acquisition start trigger channel specified. | -
42 | 0x2A | ME_ERRNO_INVALID_ACQ_START_TIMEOUT | Invalid acquisition start time out specified. | -
43 | 0x2B | ME_ERRNO_INVALID_ACQ_START_ARG | Invalid acquisition start argument specified. | -
44 | 0x2C | ME_ERRNO_INVALID_SCAN_START_TRIG_TYPE | Invalid scan start trigger type specified. | -
45 | 0x2D | ME_ERRNO_INVALID_SCAN_START_ARG | Invalid scan start argument specified. | -
46 | 0x2E | ME_ERRNO_INVALID_CONV_START_TRIG_TYPE | Invalid conversion start trigger type specified. | -
47 | 0x2F | ME_ERRNO_INVALID_CONV_START_ARG | Invalid conversion start argument specified. | -
48 | 0x30 | ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE | Invalid scan stop trigger type specified. | -
49 | 0x31 | ME_ERRNO_INVALID_SCAN_STOP_ARG | Invalid scan stop argument specified. | -
50 | 0x32 | ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE | Invalid acquisition stop trigger type specified. | -
51 | 0x33 | ME_ERRNO_INVALID_ACQ_STOP_ARG | Invalid acquisition stop argument specified. | -
52 | 0x34 | ME_ERRNO_SUBDEVICE_NOT_RUNNING | Subdevice is not running. | Counter 5284 Subdevices: The written value has not yet been loaded into the counting element. The counter subdevice was read, but it did not get any counting impulse yet.
53 | 0x35 | ME_ERRNO_INVALID_READ_MODE | Invalid read mode specified. | -
54 | 0x36 | ME_ERRNO_INVALID_VALUE_COUNT | Invalid value count specified. | -
55 | 0x37 | ME_ERRNO_INVALID_WRITE_MODE | Invalid write mode specified. | -
56 | 0x38 | ME_ERRNO_INVALID_TIMER | Invalid timer specified. | For frequency-In or frequency-Out subdevices only one of the two timers, the first phase or the total signal period, can be specified.
57 | 0x39 | ME_ERRNO_DEVICE_UNPLUGGED | Device was unplugged. | The device is not physically accessible by the driver, because it is not plugged in.
58 | 0x3A | ME_ERRNO_USED_INTERNAL | Subdevice is reserved for internal usage. | -
59 | 0x3B | ME_ERRNO_INVALID_DUTY_CYCLE | Invalid duty cycle specified. | -
60 | 0x3C | ME_ERRNO_INVALID_WAIT | Invalid wait argument specified. | Function meIOStreamStatus: Given wait mode is not supported
61 | 0x3D | ME_ERRNO_CONNECT_REMOTE | Cannot connect to remote host. | The connection to the remote device could not be established. RPC (remote procedure call) may not be installed properly; during ME-iDS installation select Network Installation.
62 | 0x3E | ME_ERRNO_COMMUNICATION | Communication error. | Reasons can be a disconnected USB or LAN device.
63 | 0x3F | ME_ERRNO_INVALID_SINGLE_LIST | Invalid single list specified. | -
64 | 0x40 | ME_ERRNO_INVALID_MODULE_TYPE | Invalid module type specified. | -
65 | 0x41 | ME_ERRNO_INVALID_START_MODE | Invalid start mode specified. | The flag for the start mode of a streaming operation is not valid. Valid values are e.g. ME_START_MODE_BLOCKING, ME_START_MODE_NONBLOCKING.
66 | 0x42 | ME_ERRNO_INVALID_STOP_MODE | Invalid stop mode specified. | The flag for the stop mode of a streaming operation is not valid. Valid values are e.g. ME_STOP_MODE_IMMEDIATE, ME_STOP_MODE_LAST_VALUE.
67 | 0x43 | ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD | Invalid fifo irq threshold specified. | Function meIOStreamConfig: Value in parameter iFifoIrqThreshold is too big
68 | 0x44 | ME_ERRNO_INVALID_POINTER | Invalid pointer passed. | Passed pointer is NULL.
69 | 0x45 | ME_ERRNO_CREATE_EVENT | Unable to create event. | -
70 | 0x46 | ME_ERRNO_LACK_OF_RESOURCES | Insufficient resources. | -
71 | 0x47 | ME_ERRNO_CANCELLED | Operation cancelled. | -
72 | 0x48 | ME_ERRNO_RING_BUFFER_OVERFLOW, ME_ERRNO_SOFTWARE_BUFFER_OVERFLOW | Ring buffer overflow. | The input buffer in the ME-iDS device driver can not store new values. Occurs in streaming-in operations when the application can not read the data fast enough from the driver.
73 | 0x49 | ME_ERRNO_RING_BUFFER_UNDERFLOW, ME_ERRNO_SOFTWARE_BUFFER_UNDERFLOW | Ring buffer underflow. | The output buffer in the ME-iDS device driver is empty. Occurs in streaming-out operations when the application can not write data to the driver fast enough.
74 | 0x4A | ME_ERRNO_INVALID_IRQ_EDGE | Invalid irq edge specified. | -
75 | 0x4B | ME_ERRNO_INVALID_IRQ_ARG | Invalid irq arg specified. | -
76 | 0x4C | ME_ERRNO_INVALID_CAP | Invalid capability specified. | -
77 | 0x4D | ME_ERRNO_INVALID_CAP_ARG_COUNT | Invalid capability argument count specified. | The value of the parameter iCap of the function meQuerySubdeviceCapsArgs() does not exist for the given device or subdevice.
78 | 0x4E | ME_ERRNO_INTERNAL | Internal error occured. | An error occured, but could not be resolved by the ME-iDS.
79 | 0x4F | ME_ERRNO_VALUE_OUT_OF_RANGE | Value out of range. | The physical value on a channel of an AI subdevice is out of the selected range.
80 | 0x50 | ME_ERRNO_HARDWARE_FIFO_OVERFLOW, ME_ERRNO_HARDWARE_BUFFER_OVERFLOW | Hardware FIFO overflow. | The FIFO full flag was detected, indicating the FIFO can not store any more values. This happens when a streaming-IN operation can not read the values from a FIFO fast enough.
81 | 0x51 | ME_ERRNO_HARDWARE_FIFO_UNDERFLOW, ME_ERRNO_HARDWARE_BUFFER_UNDERFLOW | Hardware FIFO underflow. | The FIFO empty flag was detected, indicating the FIFO is empty and can not write new values. This happens when a streaming-OUT operation does not get enough new values for output.
82 | 0x52 | ME_ERRNO_CONFIG_LOAD_FAILED | Config load failed. | Loading the configuration from a file failed. Either the file was not found or the file didn not contain valid information.
83 | 0x53 | ME_ERRNO_PROPERTY_CONTAINER | The property is a container. | An attempt was made to read or to set a value of a container itself.
84 | 0x54 | ME_ERRNO_PROPERTY_NOT_A_CONTAINER | The property is a not container. | An attempt was made to read the number of elements from the property. The property path or parts of it are not a container.
85 | 0x55 | ME_ERRNO_PROPERTY_DATA_TYPE | Wrong property data type. | The wrong data type was used to read from or write to a property.
86 | 0x56 | ME_ERRNO_PROPERTY_PATH | Property path is invalid. | The given propterty path or parts of it don't exist or is invalid.
87 | 0x57 | ME_ERRNO_PROPERTY_INDEX | Property index is invalid. | A property of type Container was accessed with an index out of range (lower than 0 or greater than the number of elements -1).
88 | 0x58 | ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL | Property buffer is too small. | The length in characters of the buffer is too small. The required length can be determined using the attribute "Length"
89 | 0x58 | ME_ERRNO_PROPERTY_UNKNOWN | Unknown property. | The given property or property path does not exist.
90 | 0x5A | ME_ERRNO_PROPERTY_ATTRIBUTE_UNKNOWN | Unknown property attribute. | The specified attribute does not exist.
91 | 0x5B | ME_ERRNO_PROPERTY_ATTRIBUTE_UNSUPPORTED | Unsupported property attribute. | The attribute is not supported for the given property.
92 | 0x5C | ME_ERRNO_PROPERTY_SELECTION_INVALID | Invalid property selection. | For a property of type Define the value is not among the pre-defined values. The values of a property can be determined using the attribute "NumberOfSelections" and "Selection#" with the index # appended, e.g. "Selection1".
93 | 0x5D | ME_ERRNO_PROPERTY_VALUE_INVALID | Invalid property value. | The value written to the property is not valid.
94 | 0x5E | ME_ERRNO_PROPERTY_READ_ONLY | Property is read only. | An attempt was made to write a value to a property which access type is Read only.
95 | 0x5F | ME_ERRNO_INVALID_ERROR_NUMBER | Invalid error number specified. | Error numbers greater than this constant don't exist in this ME-iDS version.
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: System constants

System constants

For the values of the various system constants used in the ME-iDS API, please see the extract from the system 'C' code below:

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : medefines.h
//              defines for constants used in ME-iDS
//==============================================================================

#ifndef _MEDEFINES_H_
#define _MEDEFINES_H_

/*==================================================================
  General
  ================================================================*/

#define ME_VALUE_NOT_USED                       0x0

#define ME_VALUE_DEFAULT                        0x0

#define ME_NO_FLAGS                             0x0

/*==================================================================
  Defines common to access functions
  ================================================================*/

#define ME_LOCK_RELEASE                         0x00010001
#define ME_LOCK_SET                             0x00010002
#define ME_LOCK_CHECK                           0x00010003

/*==================================================================
  Defines for meOpen function
  ================================================================*/

#define ME_OPEN_NO_FLAGS                        0x0

/*==================================================================
  Defines for meClose function
  ================================================================*/

#define ME_CLOSE_NO_FLAGS                       0x0

/*==================================================================
  Defines for meLockDriver function
  ================================================================*/

#define ME_LOCK_DRIVER_NO_FLAGS                 0x0

/*==================================================================
  Defines for meLockDevice function
  ================================================================*/

#define ME_LOCK_DEVICE_NO_FLAGS                 0x0

/*==================================================================
  Defines for meLockSubdevice function
  ================================================================*/

#define ME_LOCK_SUBDEVICE_NO_FLAGS              0x0

/*==================================================================
  Defines common to meErrorGetLastMessage and meErrorGetMessage
  ================================================================*/

#define ME_ERROR_MSG_MAX_COUNT                  256

/*==================================================================
  Defines for meErrorSetDefaultProc function
  ================================================================*/

#define ME_SWITCH_DISABLE                       0x00020001
#define ME_SWITCH_ENABLE                        0x00020002

/*==================================================================
  Defines for meErrorGetLast function
  ================================================================*/

#define ME_ERROR_GET_LAST_NO_FLAGS				0x0
#define ME_ERROR_GET_LAST_CLEAR					0x1

/*==================================================================
  Defines common to io functions
  ================================================================*/

#define ME_REF_NONE                             0x0
#define ME_REF_DIO_FIFO_LOW                     0x00030001
#define ME_REF_DIO_FIFO_HIGH                    0x00030002

#define ME_REF_CTR_PREVIOUS                     0x00040001
#define ME_REF_CTR_INTERNAL_1MHZ                0x00040002
#define ME_REF_CTR_INTERNAL_10MHZ               0x00040003
#define ME_REF_CTR_EXTERNAL                     0x00040004

#define ME_REF_AI_GROUND                        0x00050001
#define ME_REF_AI_DIFFERENTIAL                  0x00050002

#define ME_REF_AO_GROUND                        0x00060001
#define ME_REF_AO_DIFFERENTIAL                  0x00060002

#define ME_TRIG_CHAN_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_CHAN_DEFAULT                    0x00070001
#define ME_TRIG_CHAN_SYNCHRONOUS                0x00070002

#define ME_TRIG_TYPE_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_TYPE_SW                         0x00080001
#define ME_TRIG_TYPE_THRESHOLD                  0x00080002
#define ME_TRIG_TYPE_WINDOW                     0x00080003
#define ME_TRIG_TYPE_EDGE                       0x00080004
#define ME_TRIG_TYPE_SLOPE                      0x00080005
#define ME_TRIG_TYPE_EXT_DIGITAL                0x00080006
#define ME_TRIG_TYPE_EXT_ANALOG                 0x00080007
#define ME_TRIG_TYPE_PATTERN                    0x00080008	// These two defines are the same
#define ME_TRIG_TYPE_PATTERN_MATCH              0x00080008	// to preserve compatibility
#define ME_TRIG_TYPE_TIMER                      0x00080009
#define ME_TRIG_TYPE_COUNT                      0x0008000A
#define ME_TRIG_TYPE_FOLLOW                     0x0008000B
#define ME_TRIG_TYPE_PATTERN_NO_MATCH           0x0008000C
#define ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT       0x0008000D
#define ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT		0x0008000E
#define ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT	0x0008000F

#define ME_TRIG_EDGE_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_EDGE_ABOVE                      0x00090001
#define ME_TRIG_EDGE_BELOW                      0x00090002
#define ME_TRIG_EDGE_ENTRY                      0x00090003
#define ME_TRIG_EDGE_EXIT                       0x00090004
#define ME_TRIG_EDGE_RISING                     0x00090005
#define ME_TRIG_EDGE_FALLING                    0x00090006
#define ME_TRIG_EDGE_ANY                        0x00090007

#define ME_TIMER_ACQ_START                      0x000A0001
#define ME_TIMER_SCAN_START                     0x000A0002
#define ME_TIMER_CONV_START                     0x000A0003
#define ME_TIMER_FIO_TOTAL                      0x000A0004
#define ME_TIMER_FIO_FIRST_PHASE                0x000A0005

/*==================================================================
  Defines for meIOFrequencyToTicks function
  ================================================================*/

#define ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS						0x0
#define ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE	0x1

/*==================================================================
  Defines for meIOIrqStart function
  ================================================================*/

#define ME_IRQ_SOURCE_DIO_PATTERN               0x000B0001
#define ME_IRQ_SOURCE_DIO_MASK                  0x000B0002
#define ME_IRQ_SOURCE_DIO_LINE                  0x000B0003
#define ME_IRQ_SOURCE_DIO_OVER_TEMP             0x000B0004
#define ME_IRQ_SOURCE_DIO_NORMAL_TEMP           0x000B0005
#define ME_IRQ_SOURCE_DIO_CHANGE_TEMP           0x000B0006

#define ME_IRQ_EDGE_RISING                      0x000C0001
#define ME_IRQ_EDGE_FALLING                     0x000C0002
#define ME_IRQ_EDGE_ANY                         0x000C0003

#define ME_IO_IRQ_START_NO_FLAGS                0x00000000
#define ME_IO_IRQ_START_DIO_BIT                 0x00000001
#define ME_IO_IRQ_START_DIO_BYTE                0x00000002
#define ME_IO_IRQ_START_DIO_WORD                0x00000004
#define ME_IO_IRQ_START_DIO_DWORD               0x00000008
#define ME_IO_IRQ_START_PATTERN_FILTERING       0x00000010
#define ME_IO_IRQ_START_EXTENDED_STATUS         0x00000020
#define ME_IO_IRQ_START_USE_PROPERTIES          0x40000000

/*==================================================================
  Defines for meIOIrqWait function
  ================================================================*/

#define ME_IO_IRQ_WAIT_NO_FLAGS                 0x00000000
#define ME_IO_IRQ_WAIT_NORMAL_STATUS            0x00000001
#define ME_IO_IRQ_WAIT_EXTENDED_STATUS          0x00000002

/*==================================================================
  Defines for meIOIrqStop function
  ================================================================*/

#define ME_IO_IRQ_STOP_NO_FLAGS                 0x0

/*==================================================================
  Defines for meIOIrqSetCallback function
  ================================================================*/

#define ME_IO_IRQ_SET_CALLBACK_NO_FLAGS         0x0

/*==================================================================
  Defines for meIOResetDevice function
  ================================================================*/

#define ME_IO_RESET_DEVICE_NO_FLAGS             0x0

/*==================================================================
  Defines for meIOResetSubdevice function
  ================================================================*/

#define ME_IO_RESET_SUBDEVICE_NO_FLAGS          0x0

/*==================================================================
  Defines for meIOSetChannelOffset function
  ================================================================*/

#define ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS       0x0

/*==================================================================
  Defines for meIOSingleConfig function
  ================================================================*/

#define ME_SINGLE_CONFIG_DIO_INPUT              0x000D0001
#define ME_SINGLE_CONFIG_DIO_OUTPUT             0x000D0002
#define ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE     0x000D0003
#define ME_SINGLE_CONFIG_DIO_SINK               0x000D0004
#define ME_SINGLE_CONFIG_DIO_SOURCE             0x000D0005
#define ME_SINGLE_CONFIG_DIO_MUX32M             0x000D0006
#define ME_SINGLE_CONFIG_DIO_DEMUX32            0x000D0007
#define ME_SINGLE_CONFIG_DIO_BIT_PATTERN        0x000D0008

#define ME_SINGLE_CONFIG_CTR_8254_MODE_0        0x000E0001
#define ME_SINGLE_CONFIG_CTR_8254_MODE_1        0x000E0002
#define ME_SINGLE_CONFIG_CTR_8254_MODE_2        0x000E0003
#define ME_SINGLE_CONFIG_CTR_8254_MODE_3        0x000E0004
#define ME_SINGLE_CONFIG_CTR_8254_MODE_4        0x000E0005
#define ME_SINGLE_CONFIG_CTR_8254_MODE_5        0x000E0006

#define ME_SINGLE_CONFIG_FIO_INPUT				0x001E0001
#define ME_SINGLE_CONFIG_FIO_OUTPUT				0x001E0002
#define ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE     0x001E0002
#define ME_SINGLE_CONFIG_FIO_SINK               0x001E0003
#define ME_SINGLE_CONFIG_FIO_SOURCE             0x001E0004

#define ME_IO_SINGLE_CONFIG_NO_FLAGS            0x00
#define ME_IO_SINGLE_CONFIG_DIO_BIT             0x01
#define ME_IO_SINGLE_CONFIG_DIO_BYTE            0x02
#define ME_IO_SINGLE_CONFIG_DIO_WORD            0x04
#define ME_IO_SINGLE_CONFIG_DIO_DWORD           0x08
#define ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON     0x10
#define ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF    0x20
#define ME_IO_SINGLE_CONFIG_AI_RMS              0x40

/*==================================================================
  Defines for meIOSingle function
  ================================================================*/

#define ME_IO_SINGLE_NO_FLAGS                   0x0

#define ME_DIR_INPUT                            0x000F0001
#define ME_DIR_OUTPUT                           0x000F0002
#define ME_DIR_SET_OFFSET                       0x000F0003

#define ME_IO_SINGLE_TYPE_NO_FLAGS              0x00
#define ME_IO_SINGLE_TYPE_DIO_BIT               0x01
#define ME_IO_SINGLE_TYPE_DIO_BYTE              0x02
#define ME_IO_SINGLE_TYPE_DIO_WORD              0x04
#define ME_IO_SINGLE_TYPE_DIO_DWORD             0x08
#define ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS      0x10
#define ME_IO_SINGLE_TYPE_NONBLOCKING			0x20
#define ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING		ME_IO_SINGLE_TYPE_NONBLOCKING
#define ME_IO_SINGLE_TYPE_READ_NONBLOCKING		ME_IO_SINGLE_TYPE_NONBLOCKING

#define ME_IO_SINGLE_TYPE_FO_START_LOW				0x80
#define ME_IO_SINGLE_TYPE_FO_START_SOFT				0x100
#define ME_IO_SINGLE_TYPE_FI_LAST_VALUE				0x200
#define ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY			0x200
#define ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL			0x400
#define ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE		0x800
#define ME_IO_SINGLE_TYPE_FO_USE_PROPERTIES         0x40000000

/*==================================================================
  Defines for meIOSingleTimeToTicks function
  ================================================================*/

#define ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS			0x0

/*==================================================================
  Defines for meIOSingleTicksToTime function
  ================================================================*/

#define ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS			0x0

/*==================================================================
  Defines for meIOStreamConfig function
  ================================================================*/

#define ME_IO_STREAM_CONFIG_NO_FLAGS            0x0
#define ME_IO_STREAM_CONFIG_BIT_PATTERN         0x1
#define ME_IO_STREAM_CONFIG_WRAPAROUND          0x2
#define ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD     0x4

#define ME_IO_STREAM_CONFIG_INTERNAL_COUNTER	0x80000000

#define ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS       0x0

#define ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS      0x0

/*==================================================================
  Defines for meIOStreamRead function
  ================================================================*/

#define ME_READ_MODE_BLOCKING                   0x00100001
#define ME_READ_MODE_NONBLOCKING                0x00100002

#define ME_IO_STREAM_READ_NO_FLAGS              0x0
#define ME_IO_STREAM_READ_FRAMES                0x1

/*==================================================================
  Defines for meIOStreamWrite function
  ================================================================*/

#define ME_WRITE_MODE_BLOCKING                  0x00110001
#define ME_WRITE_MODE_NONBLOCKING               0x00110002
#define ME_WRITE_MODE_PRELOAD                   0x00110003

#define ME_IO_STREAM_WRITE_NO_FLAGS             0x00000000

/*==================================================================
  Defines for meIOStreamStart function
  ================================================================*/

#define ME_IO_STREAM_START_NO_FLAGS             0x00000000

#define ME_START_MODE_BLOCKING                  0x00120001
#define ME_START_MODE_NONBLOCKING               0x00120002

#define ME_IO_STREAM_START_TYPE_NO_FLAGS                0x0
#define ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS        0x1

/*==================================================================
  Defines for meIOStreamStop function
  ================================================================*/

#define ME_IO_STREAM_STOP_NO_FLAGS              0x00000000

#define ME_STOP_MODE_IMMEDIATE                  0x00130001
#define ME_STOP_MODE_LAST_VALUE                 0x00130002

#define ME_IO_STREAM_STOP_TYPE_NO_FLAGS         0x00000000

/*==================================================================
  Defines for meIOStreamStatus function
  ================================================================*/

#define ME_WAIT_NONE                            0x00140001
#define ME_WAIT_IDLE                            0x00140002

#define ME_STATUS_INVALID                       0x00000000
#define ME_STATUS_IDLE                          0x00150001
#define ME_STATUS_BUSY                          0x00150002
#define ME_STATUS_ERROR                         0x00150003

#define ME_IO_STREAM_STATUS_NO_FLAGS            0x00000000

/*==================================================================
  Defines for meIOStreamSetCallbacks function
  ================================================================*/

#define ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS     0x00000000

/*==================================================================
  Defines for meIOStreamTimeToTicks function
  ================================================================*/

#define ME_IO_TIME_TO_TICKS_NO_FLAGS							0x0
#define ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE			0x1

/*==================================================================
  Defines for module types
  ================================================================*/

#define ME_MODULE_TYPE_MULTISIG_NONE                    0x00000000
#define ME_MODULE_TYPE_MULTISIG_DIFF16_10V              0x00160001
#define ME_MODULE_TYPE_MULTISIG_DIFF16_20V              0x00160002
#define ME_MODULE_TYPE_MULTISIG_DIFF16_50V              0x00160003
#define ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA        0x00160004
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT100              0x00160005
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT500              0x00160006
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT1000             0x00160007
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B              0x00160008
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E              0x00160009
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J              0x0016000A
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K              0x0016000B
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N              0x0016000C
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R              0x0016000D
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S              0x0016000E
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T              0x0016000F
#define ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR         0x00160010

/*==================================================================
  Defines for meQuerySubdeviceCaps function
  ================================================================*/

#define ME_CAPS_DIO_DIR_BIT                     0x00000001
#define ME_CAPS_DIO_DIR_BYTE                    0x00000002
#define ME_CAPS_DIO_DIR_WORD                    0x00000004
#define ME_CAPS_DIO_DIR_DWORD                   0x00000008
#define ME_CAPS_DIO_SINK_SOURCE                 0x00000010
#define ME_CAPS_DIO_BIT_PATTERN_IRQ             0x00000020
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING    0x00000040
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING   0x00000080
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY       0x00000100
#define ME_CAPS_DIO_OVER_TEMP_IRQ               0x00000200
#define ME_CAPS_DIO_NORMAL_TEMP_IRQ             0x00000400

#define ME_CAPS_CTR_CLK_PREVIOUS                0x00000001
#define ME_CAPS_CTR_CLK_INTERNAL_1MHZ           0x00000002
#define ME_CAPS_CTR_CLK_INTERNAL_10MHZ          0x00000004
#define ME_CAPS_CTR_CLK_EXTERNAL                0x00000008

#define ME_CAPS_AI_TRIG_SIMULTANEOUS            0x00000001
#define ME_CAPS_AI_FIFO                         0x00000002
#define ME_CAPS_AI_FIFO_THRESHOLD               0x00000004
#define ME_CAPS_AI_SAMPLE_HOLD                  0x00000008

#define ME_CAPS_AO_TRIG_SIMULTANEOUS            0x00000001
#define ME_CAPS_AO_FIFO                         0x00000002
#define ME_CAPS_AO_FIFO_THRESHOLD               0x00000004

#define ME_CAPS_FIO_SINK_SOURCE                 0x00000010

#define ME_CAPS_EXT_IRQ_EDGE_RISING             0x00000001
#define ME_CAPS_EXT_IRQ_EDGE_FALLING            0x00000002
#define ME_CAPS_EXT_IRQ_EDGE_ANY                0x00000004

/*==================================================================
  Defines for meQuerySubdeviceCapsArgs function
  ================================================================*/

#define ME_CAP_AI_FIFO_SIZE                     0x001D0000
#define ME_CAP_AI_BUFFER_SIZE                   0x001D0001
#define ME_CAP_AI_CHANNEL_LIST_SIZE             0x001D0002
#define ME_CAP_AI_MAX_THRESHOLD_SIZE            0x001D0003

#define ME_CAP_AO_FIFO_SIZE                     0x001F0000
#define ME_CAP_AO_BUFFER_SIZE                   0x001F0001
#define ME_CAP_AO_CHANNEL_LIST_SIZE             0x001F0002
#define ME_CAP_AO_MAX_THRESHOLD_SIZE            0x001F0003

#define ME_CAP_CTR_WIDTH                        0x00200000

#define ME_CAP_FPGA_IN_FIFO_SIZE                0x00300000
#define ME_CAP_FPGA_IN_BUFFER_SIZE              0x00300001
#define ME_CAP_FPGA_OUT_FIFO_SIZE               0x00300002
#define ME_CAP_FPGA_OUT_BUFFER_SIZE             0x00300003

/*==================================================================
  Defines common to query functions
  ================================================================*/

#define ME_UNIT_INVALID                         0x00000000
#define ME_UNIT_VOLT                            0x00170001
#define ME_UNIT_AMPERE                          0x00170002
#define ME_UNIT_ANY                             0x00170003
#define ME_UNIT_HZ                              0x00170004

#define ME_TYPE_INVALID                         0x00000000
#define ME_TYPE_AO                              0x00180001
#define ME_TYPE_AI                              0x00180002
#define ME_TYPE_DIO                             0x00180003
#define ME_TYPE_DO                              0x00180004
#define ME_TYPE_DI                              0x00180005
#define ME_TYPE_CTR                             0x00180006
#define ME_TYPE_EXT_IRQ                         0x00180007
#define ME_TYPE_FIO                             0x00180008
#define ME_TYPE_FO                              0x00180009
#define ME_TYPE_FI                              0x0018000A
#define ME_TYPE_FPGA                            0x0018000B

#define ME_SUBTYPE_INVALID                      0x00000000
#define ME_SUBTYPE_SINGLE                       0x00190001
#define ME_SUBTYPE_STREAMING                    0x00190002
#define ME_SUBTYPE_CTR_8254                     0x00190003
#define ME_SUBTYPE_ANY                          0x00190004
#define ME_SUBTYPE_CTR                          0x00190006

#define ME_DEVICE_DRIVER_NAME_MAX_COUNT         64
#define ME_DEVICE_NAME_MAX_COUNT                64

#define ME_DEVICE_DESCRIPTION_MAX_COUNT         256

#define ME_BUS_TYPE_INVALID                     0x00000000
#define ME_BUS_TYPE_PCI                         0x001A0001
#define ME_BUS_TYPE_USB                         0x001A0002
#define ME_BUS_TYPE_LAN_PCI                     0x001A0101
#define ME_BUS_TYPE_LAN_USB                     0x001A0102

#define ME_PLUGGED_INVALID                      0x00000000
#define ME_PLUGGED_IN                           0x001B0001
#define ME_PLUGGED_OUT                          0x001B0002

#define ME_EXTENSION_TYPE_INVALID               0x00000000
#define ME_EXTENSION_TYPE_NONE                  0x001C0001
#define ME_EXTENSION_TYPE_MUX32M                0x001C0002
#define ME_EXTENSION_TYPE_DEMUX32               0x001C0003
#define ME_EXTENSION_TYPE_MUX32S                0x001C0004
#define ME_EXTENSION_TYPE_ME1001                0x001C0005

#define ME_ACCESS_TYPE_INVALID                  0x00000000
#define ME_ACCESS_TYPE_ANY                      0x001D0000
#define ME_ACCESS_TYPE_LOCAL                    0x001D0001
#define ME_ACCESS_TYPE_REMOTE                   0x001D0002

#define ME_PWM_START_NO_FLAGS                   0x0
#define ME_PWM_START_CONNECT_INTERNAL           0x1

#define ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS			0x0
#define ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS		0x1

//------------------------------------

#define ME_PROPERTY_TYPE_INVALID				0x0
#define ME_PROPERTY_TYPE_CONTAINER				0x1
#define ME_PROPERTY_TYPE_BOOL					0x2
#define ME_PROPERTY_TYPE_INT					0x3
#define ME_PROPERTY_TYPE_DOUBLE					0x4
#define ME_PROPERTY_TYPE_STRING					0x5
#define ME_PROPERTY_TYPE_DEFINE					0x6

#define ME_PROPERTY_ACCESS_READ_ONLY			0x0
#define ME_PROPERTY_ACCESS_READ_WRITE			0x1

#define ME_PROPERTY_BOOLEAN_FALSE				0x00
#define ME_PROPERTY_BOOLEAN_TRUE				0x01

#define ME_CALIBRATION_TYPE_FACTORY				0x001E0000
#define ME_CALIBRATION_TYPE_USER_1				0x001E0001
#define ME_5800_FAMILY							0x5800

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-iDS API

ME-iDS API

  • C/C++ Interface
  • MS Visual Basic 6.0 Interface
  • MS Visual Basic 2005 Interface
  • MS Visual Basic .NET Interface
  • MS Visual C-Sharp Interface
  • Delphi Interface
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Interface

  • ME-iDS API

C/C++ Interface

  • C/C++ Interface Functions
  • C/C++ Interface Definitions
  • C/C++ Interface Type Definitions
  • C/C++ Property Names ANSI
  • C/C++ Property Names UNICODE
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Interface Functions

  • ME-iDS API
  • C/C++ Interface

C/C++ Interface Functions

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : medriver.h
//              function prototypes of ME-iDS import library
//==============================================================================

#ifndef _MEDRIVER_H_
#define _MEDRIVER_H_

#include "metypes.h"
#include "meerror.h"
#include "medefines.h"

#ifdef __cplusplus
extern "C" {
#endif

    /*===========================================================================
      Functions to access the driver system
      =========================================================================*/

    int meOpen(int iFlags);
    int meClose(int iFlags);

    int meLockDriver(int iLock, int iFlags);
    int meLockDevice(int iDevice, int iLock, int iFlags);
    int meLockSubdevice(int iDevice, int iSubdevice, int iLock, int iFlags);

    /*===========================================================================
      Error handling functions
      =========================================================================*/

    int meErrorGetLast(int* piErrorCode, int iFlags);
    int meErrorGetLastMessage(char *pcErrorMsg, int iCount);
    int meErrorGetMessage(int iErrorCode, char *pcErrorMsg, int iCount);
    int meErrorSetDefaultProc(int iSwitch);
    int meErrorSetUserProc(meErrorCB_t pErrorProc);

    /*===========================================================================
      Functions to perform I/O on a device
      =========================================================================*/

    int meIOIrqSetCallback(
            int iDevice,
            int iSubdevice,
            meIOIrqCB_t pCallback,
            void *pCallbackContext,
            int iFlags);
    int meIOIrqStart(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int iIrqSource,
            int iIrqEdge,
            int iIrqArg,
            int iFlags);
    int meIOIrqStop(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int iFlags);
    int meIOIrqWait(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int *piIrqCount,
            int *piValue,
            int iTimeOut,
            int iFlags);

    int meIOResetDevice(int iDevice, int iFlags);
    int meIOResetSubdevice(int iDevice, int iSubdevice, int iFlags);

    int meIOSetChannelOffset(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int iRange,
            double *pdOffset,
            int iFlags);

    int meIOSingleConfig(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int iSingleConfig,
            int iRef,
            int iTrigChan,
            int iTrigType,
            int iTrigEdge,
            int iFlags);

    int meIOSingle(meIOSingle_t *pSingleList, int iCount, int iFlags);

    int meIOSingleTimeToTicks(
            int iDevice,
            int iSubdevice,
            int iTimer,
            double *pdTime,
            int *piTicksLow,
            int *piTicksHigh,
            int iFlags);
    int meIOSingleTicksToTime(
            int iDevice,
            int iSubdevice,
            int iTimer,
            int iTicksLow,
            int iTicksHigh,
            double *pdTime,
            int iFlags);

    int meIOStreamConfig(
            int iDevice,
            int iSubdevice,
            meIOStreamConfig_t *pConfigList,
            int iCount,
            meIOStreamTrigger_t *pTrigger,
            int iFifoIrqThreshold,
            int iFlags);
    int meIOStreamNewValues(
            int iDevice,
            int iSubdevice,
            int iTimeOut,
            int *piCount,
            int iFlags);
    int meIOStreamRead(
            int iDevice,
            int iSubdevice,
            int iReadMode,
            int *piValues,
            int *piCount,
            int iFlags);
    int meIOStreamWrite(
            int iDevice,
            int iSubdevice,
            int iWriteMode,
            int *piValues,
            int *piCount,
            int iFlags);
    int meIOStreamStart(meIOStreamStart_t *pStartList, int iCount, int iFlags);
    int meIOStreamStop(meIOStreamStop_t *pStopList, int iCount, int iFlags);
    int meIOStreamStatus(
            int iDevice,
            int iSubdevice,
            int iWait,
            int *piStatus,
            int *piCount,
            int iFlags);
    int meIOStreamSetCallbacks(
            int iDevice,
            int iSubdevice,
            meIOStreamCB_t pStartCB,
            void *pStartCBContext,
            meIOStreamCB_t pNewValuesCB,
            void *pNewValuesCBContext,
            meIOStreamCB_t pEndCB,
            void *pEndCBContext,
            int iFlags);
    int meIOStreamFrequencyToTicks(
            int iDevice,
            int iSubdevice,
            int iTimer,
            double *pdFrequency,
            int *piTicksLow,
            int *piTicksHigh,
            int iFlags);
    int meIOStreamTimeToTicks(
            int iDevice,
            int iSubdevice,
            int iTimer,
            double *pdTime,
            int *piTicksLow,
            int *piTicksHigh,
            int iFlags);

    /*===========================================================================
      Functions to query the driver system
      =========================================================================*/

    int meQueryDescriptionDevice(int iDevice, char *pcDescription, int iCount);

    int meQueryInfoDevice(
            int iDevice,
            int *piVendorId,
            int *piDeviceId,
            int *piSerialNo,
            int *piBusType,
            int *piBusNo,
            int *piDevNo,
            int *piFuncNo,
            int *piPlugged);

    int meQueryNameDevice(int iDevice, char *pcName, int iCount);
    int meQueryNameDeviceDriver(int iDevice, char *pcName, int iCount);

    int meQueryNumberDevices(int *piNumber);
    int meQueryNumberSubdevices(int iDevice, int *piNumber);
    int meQueryNumberChannels(int iDevice, int iSubdevice, int *piNumber);
    int meQueryNumberRanges(
            int iDevice,
            int iSubdevice,
            int iUnit,
            int *piNumber);

    int meQueryRangeByMinMax(
            int iDevice,
            int iSubdevice,
            int iUnit,
            double *pdMin,
            double *pdMax,
            int *piMaxData,
            int *piRange);
    int meQueryRangeInfo(
            int iDevice,
            int iSubdevice,
            int iRange,
            int *piUnit,
            double *pdMin,
            double *pdMax,
            int *piMaxData);

    int meQuerySubdeviceByType(
            int iDevice,
            int iStartSubdevice,
            int iType,
            int iSubtype,
            int *piSubdevice);
    int meQuerySubdeviceType(
            int iDevice,
            int iSubdevice,
            int *piType,
            int *piSubtype);
    int meQuerySubdeviceCaps(
            int iDevice,
            int iSubdevice,
            int *piCaps);
    int meQuerySubdeviceCapsArgs(
            int iDevice,
            int iSubdevice,
            int iCap,
            int *piArgs,
            int iCount);

    int meQueryVersionLibrary(int *piVersion);
    int meQueryVersionMainDriver(int *piVersion);
    int meQueryVersionDeviceDriver(int iDevice, int *piVersion);

    /*===========================================================================
      Common utility functions
      =========================================================================*/

    int meUtilityExtractValues(
            int iChannel,
            int *piAIBuffer,
            int iAIBufferCount,
            meIOStreamConfig_t *pConfigList,
            int iConfigListCount,
            int *piChanBuffer,
            int *piChanBufferCount);
    int meUtilityDigitalToPhysical(
            double dMin,
            double dMax,
            int iMaxData,
            int iData,
            int iModuleType,
            double dRefValue,
            double *pdPhysical);
    int meUtilityDigitalToPhysicalV(
            double dMin,
            double dMax,
            int iMaxData,
            int *piDataBuffer,
            int iCount,
            int iModuleType,
            double dRefValue,
            double *pdPhysicalBuffer);
    int meUtilityPhysicalToDigital(
            double dMin,
            double dMax,
            int iMaxData,
            double dPhysical,
            int *piData);
    int meUtilityPhysicalToDigitalV(
            double dMin,
            double dMax,
            int iMaxData,
            double* pdPhysicalBuffer,
            int iCount,
            int *piDataBuffer);
    int meUtilityPWMStart(
            int iDevice,
            int iSubdevice1,
            int iSubdevice2,
            int iSubdevice3,
            int iRef,
            int iPrescaler,
            int iDutyCycle,
            int iFlag);
    int meUtilityPWMRestart(
            int iDevice,
            int iSubdevice1,
            int iRef,
            int iPrescaler);
    int meUtilityPWMStop(int iDevice,
            int iSubdevice1);

    /*===========================================================================
      ANSI property routines
      =========================================================================*/

    int mePropertyGetIntA(char* pcPropertyPath, int* piPropertyValue);

    int mePropertyGetDoubleA(char* pcPropertyPath, double* pdPropertyValue);

    int mePropertyGetStringA(char* pcPropertyPath, char* pcPropertyValue, int iBufferLength);

    int mePropertySetIntA(char* pcPropertyPath, int iPropertyValue);

    int mePropertySetDoubleA(char* pcPropertyPath, double dPropertyValue);

    int mePropertySetStringA(char* pcPropertyPath, char* pcPropertyValue);

    /*===========================================================================
      Wide character property routines
      =========================================================================*/

    int mePropertyGetIntW(wchar_t* pwcPropertyPath, int* piPropertyValue);

    int mePropertyGetDoubleW(wchar_t* pwcPropertyPath, double* pdPropertyValue);

    int mePropertyGetStringW(wchar_t* pwcPropertyPath, wchar_t* pwcPropertyValue, int iBufferLength);

    int mePropertySetIntW(wchar_t* pwcPropertyPath, int iPropertyValue);

    int mePropertySetDoubleW(wchar_t* pwcPropertyPath, double dPropertyValue);

    int mePropertySetStringW(wchar_t* pwcPropertyPath, wchar_t* pwcPropertyValue);

#ifdef __cplusplus
}
#endif

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Interface Definitions

  • ME-iDS API
  • C/C++ Interface

C/C++ Interface Definitions

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : medefines.h
//              defines for constants used in ME-iDS
//==============================================================================

#ifndef _MEDEFINES_H_
#define _MEDEFINES_H_

/*==================================================================
  General
  ================================================================*/

#define ME_VALUE_NOT_USED                       0x0

#define ME_VALUE_DEFAULT                        0x0

#define ME_NO_FLAGS                             0x0

/*==================================================================
  Defines common to access functions
  ================================================================*/

#define ME_LOCK_RELEASE                         0x00010001
#define ME_LOCK_SET                             0x00010002
#define ME_LOCK_CHECK                           0x00010003

/*==================================================================
  Defines for meOpen function
  ================================================================*/

#define ME_OPEN_NO_FLAGS                        0x0

/*==================================================================
  Defines for meClose function
  ================================================================*/

#define ME_CLOSE_NO_FLAGS                       0x0

/*==================================================================
  Defines for meLockDriver function
  ================================================================*/

#define ME_LOCK_DRIVER_NO_FLAGS                 0x0

/*==================================================================
  Defines for meLockDevice function
  ================================================================*/

#define ME_LOCK_DEVICE_NO_FLAGS                 0x0

/*==================================================================
  Defines for meLockSubdevice function
  ================================================================*/

#define ME_LOCK_SUBDEVICE_NO_FLAGS              0x0

/*==================================================================
  Defines common to meErrorGetLastMessage and meErrorGetMessage
  ================================================================*/

#define ME_ERROR_MSG_MAX_COUNT                  256

/*==================================================================
  Defines for meErrorSetDefaultProc function
  ================================================================*/

#define ME_SWITCH_DISABLE                       0x00020001
#define ME_SWITCH_ENABLE                        0x00020002

/*==================================================================
  Defines for meErrorGetLast function
  ================================================================*/

#define ME_ERROR_GET_LAST_NO_FLAGS				0x0
#define ME_ERROR_GET_LAST_CLEAR					0x1

/*==================================================================
  Defines common to io functions
  ================================================================*/

#define ME_REF_NONE                             0x0
#define ME_REF_DIO_FIFO_LOW                     0x00030001
#define ME_REF_DIO_FIFO_HIGH                    0x00030002

#define ME_REF_CTR_PREVIOUS                     0x00040001
#define ME_REF_CTR_INTERNAL_1MHZ                0x00040002
#define ME_REF_CTR_INTERNAL_10MHZ               0x00040003
#define ME_REF_CTR_EXTERNAL                     0x00040004

#define ME_REF_AI_GROUND                        0x00050001
#define ME_REF_AI_DIFFERENTIAL                  0x00050002

#define ME_REF_AO_GROUND                        0x00060001
#define ME_REF_AO_DIFFERENTIAL                  0x00060002

#define ME_TRIG_CHAN_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_CHAN_DEFAULT                    0x00070001
#define ME_TRIG_CHAN_SYNCHRONOUS                0x00070002

#define ME_TRIG_TYPE_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_TYPE_SW                         0x00080001
#define ME_TRIG_TYPE_THRESHOLD                  0x00080002
#define ME_TRIG_TYPE_WINDOW                     0x00080003
#define ME_TRIG_TYPE_EDGE                       0x00080004
#define ME_TRIG_TYPE_SLOPE                      0x00080005
#define ME_TRIG_TYPE_EXT_DIGITAL                0x00080006
#define ME_TRIG_TYPE_EXT_ANALOG                 0x00080007
#define ME_TRIG_TYPE_PATTERN                    0x00080008	// These two defines are the same
#define ME_TRIG_TYPE_PATTERN_MATCH              0x00080008	// to preserve compatibility
#define ME_TRIG_TYPE_TIMER                      0x00080009
#define ME_TRIG_TYPE_COUNT                      0x0008000A
#define ME_TRIG_TYPE_FOLLOW                     0x0008000B
#define ME_TRIG_TYPE_PATTERN_NO_MATCH           0x0008000C
#define ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT       0x0008000D
#define ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT		0x0008000E
#define ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT	0x0008000F

#define ME_TRIG_EDGE_NONE                       ME_VALUE_NOT_USED
#define ME_TRIG_EDGE_ABOVE                      0x00090001
#define ME_TRIG_EDGE_BELOW                      0x00090002
#define ME_TRIG_EDGE_ENTRY                      0x00090003
#define ME_TRIG_EDGE_EXIT                       0x00090004
#define ME_TRIG_EDGE_RISING                     0x00090005
#define ME_TRIG_EDGE_FALLING                    0x00090006
#define ME_TRIG_EDGE_ANY                        0x00090007

#define ME_TIMER_ACQ_START                      0x000A0001
#define ME_TIMER_SCAN_START                     0x000A0002
#define ME_TIMER_CONV_START                     0x000A0003
#define ME_TIMER_FIO_TOTAL                      0x000A0004
#define ME_TIMER_FIO_FIRST_PHASE                0x000A0005

/*==================================================================
  Defines for meIOFrequencyToTicks function
  ================================================================*/

#define ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS						0x0
#define ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE	0x1

/*==================================================================
  Defines for meIOIrqStart function
  ================================================================*/

#define ME_IRQ_SOURCE_DIO_PATTERN               0x000B0001
#define ME_IRQ_SOURCE_DIO_MASK                  0x000B0002
#define ME_IRQ_SOURCE_DIO_LINE                  0x000B0003
#define ME_IRQ_SOURCE_DIO_OVER_TEMP             0x000B0004
#define ME_IRQ_SOURCE_DIO_NORMAL_TEMP           0x000B0005
#define ME_IRQ_SOURCE_DIO_CHANGE_TEMP           0x000B0006

#define ME_IRQ_EDGE_RISING                      0x000C0001
#define ME_IRQ_EDGE_FALLING                     0x000C0002
#define ME_IRQ_EDGE_ANY                         0x000C0003

#define ME_IO_IRQ_START_NO_FLAGS                0x00000000
#define ME_IO_IRQ_START_DIO_BIT                 0x00000001
#define ME_IO_IRQ_START_DIO_BYTE                0x00000002
#define ME_IO_IRQ_START_DIO_WORD                0x00000004
#define ME_IO_IRQ_START_DIO_DWORD               0x00000008
#define ME_IO_IRQ_START_PATTERN_FILTERING       0x00000010
#define ME_IO_IRQ_START_EXTENDED_STATUS         0x00000020
#define ME_IO_IRQ_START_USE_PROPERTIES          0x40000000

/*==================================================================
  Defines for meIOIrqWait function
  ================================================================*/

#define ME_IO_IRQ_WAIT_NO_FLAGS                 0x00000000
#define ME_IO_IRQ_WAIT_NORMAL_STATUS            0x00000001
#define ME_IO_IRQ_WAIT_EXTENDED_STATUS          0x00000002

/*==================================================================
  Defines for meIOIrqStop function
  ================================================================*/

#define ME_IO_IRQ_STOP_NO_FLAGS                 0x0

/*==================================================================
  Defines for meIOIrqSetCallback function
  ================================================================*/

#define ME_IO_IRQ_SET_CALLBACK_NO_FLAGS         0x0

/*==================================================================
  Defines for meIOResetDevice function
  ================================================================*/

#define ME_IO_RESET_DEVICE_NO_FLAGS             0x0

/*==================================================================
  Defines for meIOResetSubdevice function
  ================================================================*/

#define ME_IO_RESET_SUBDEVICE_NO_FLAGS          0x0

/*==================================================================
  Defines for meIOSetChannelOffset function
  ================================================================*/

#define ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS       0x0

/*==================================================================
  Defines for meIOSingleConfig function
  ================================================================*/

#define ME_SINGLE_CONFIG_DIO_INPUT              0x000D0001
#define ME_SINGLE_CONFIG_DIO_OUTPUT             0x000D0002
#define ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE     0x000D0003
#define ME_SINGLE_CONFIG_DIO_SINK               0x000D0004
#define ME_SINGLE_CONFIG_DIO_SOURCE             0x000D0005
#define ME_SINGLE_CONFIG_DIO_MUX32M             0x000D0006
#define ME_SINGLE_CONFIG_DIO_DEMUX32            0x000D0007
#define ME_SINGLE_CONFIG_DIO_BIT_PATTERN        0x000D0008

#define ME_SINGLE_CONFIG_CTR_8254_MODE_0        0x000E0001
#define ME_SINGLE_CONFIG_CTR_8254_MODE_1        0x000E0002
#define ME_SINGLE_CONFIG_CTR_8254_MODE_2        0x000E0003
#define ME_SINGLE_CONFIG_CTR_8254_MODE_3        0x000E0004
#define ME_SINGLE_CONFIG_CTR_8254_MODE_4        0x000E0005
#define ME_SINGLE_CONFIG_CTR_8254_MODE_5        0x000E0006

#define ME_SINGLE_CONFIG_FIO_INPUT				0x001E0001
#define ME_SINGLE_CONFIG_FIO_OUTPUT				0x001E0002
#define ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE     0x001E0002
#define ME_SINGLE_CONFIG_FIO_SINK               0x001E0003
#define ME_SINGLE_CONFIG_FIO_SOURCE             0x001E0004

#define ME_IO_SINGLE_CONFIG_NO_FLAGS            0x00
#define ME_IO_SINGLE_CONFIG_DIO_BIT             0x01
#define ME_IO_SINGLE_CONFIG_DIO_BYTE            0x02
#define ME_IO_SINGLE_CONFIG_DIO_WORD            0x04
#define ME_IO_SINGLE_CONFIG_DIO_DWORD           0x08
#define ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON     0x10
#define ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF    0x20
#define ME_IO_SINGLE_CONFIG_AI_RMS              0x40

/*==================================================================
  Defines for meIOSingle function
  ================================================================*/

#define ME_IO_SINGLE_NO_FLAGS                   0x0

#define ME_DIR_INPUT                            0x000F0001
#define ME_DIR_OUTPUT                           0x000F0002
#define ME_DIR_SET_OFFSET                       0x000F0003

#define ME_IO_SINGLE_TYPE_NO_FLAGS              0x00
#define ME_IO_SINGLE_TYPE_DIO_BIT               0x01
#define ME_IO_SINGLE_TYPE_DIO_BYTE              0x02
#define ME_IO_SINGLE_TYPE_DIO_WORD              0x04
#define ME_IO_SINGLE_TYPE_DIO_DWORD             0x08
#define ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS      0x10
#define ME_IO_SINGLE_TYPE_NONBLOCKING			0x20
#define ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING		ME_IO_SINGLE_TYPE_NONBLOCKING
#define ME_IO_SINGLE_TYPE_READ_NONBLOCKING		ME_IO_SINGLE_TYPE_NONBLOCKING

#define ME_IO_SINGLE_TYPE_FO_START_LOW				0x80
#define ME_IO_SINGLE_TYPE_FO_START_SOFT				0x100
#define ME_IO_SINGLE_TYPE_FI_LAST_VALUE				0x200
#define ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY			0x200
#define ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL			0x400
#define ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE		0x800
#define ME_IO_SINGLE_TYPE_FO_USE_PROPERTIES         0x40000000

/*==================================================================
  Defines for meIOSingleTimeToTicks function
  ================================================================*/

#define ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS			0x0

/*==================================================================
  Defines for meIOSingleTicksToTime function
  ================================================================*/

#define ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS			0x0

/*==================================================================
  Defines for meIOStreamConfig function
  ================================================================*/

#define ME_IO_STREAM_CONFIG_NO_FLAGS            0x0
#define ME_IO_STREAM_CONFIG_BIT_PATTERN         0x1
#define ME_IO_STREAM_CONFIG_WRAPAROUND          0x2
#define ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD     0x4

#define ME_IO_STREAM_CONFIG_INTERNAL_COUNTER	0x80000000

#define ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS       0x0

#define ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS      0x0

/*==================================================================
  Defines for meIOStreamRead function
  ================================================================*/

#define ME_READ_MODE_BLOCKING                   0x00100001
#define ME_READ_MODE_NONBLOCKING                0x00100002

#define ME_IO_STREAM_READ_NO_FLAGS              0x0
#define ME_IO_STREAM_READ_FRAMES                0x1

/*==================================================================
  Defines for meIOStreamWrite function
  ================================================================*/

#define ME_WRITE_MODE_BLOCKING                  0x00110001
#define ME_WRITE_MODE_NONBLOCKING               0x00110002
#define ME_WRITE_MODE_PRELOAD                   0x00110003

#define ME_IO_STREAM_WRITE_NO_FLAGS             0x00000000

/*==================================================================
  Defines for meIOStreamStart function
  ================================================================*/

#define ME_IO_STREAM_START_NO_FLAGS             0x00000000

#define ME_START_MODE_BLOCKING                  0x00120001
#define ME_START_MODE_NONBLOCKING               0x00120002

#define ME_IO_STREAM_START_TYPE_NO_FLAGS                0x0
#define ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS        0x1

/*==================================================================
  Defines for meIOStreamStop function
  ================================================================*/

#define ME_IO_STREAM_STOP_NO_FLAGS              0x00000000

#define ME_STOP_MODE_IMMEDIATE                  0x00130001
#define ME_STOP_MODE_LAST_VALUE                 0x00130002

#define ME_IO_STREAM_STOP_TYPE_NO_FLAGS         0x00000000

/*==================================================================
  Defines for meIOStreamStatus function
  ================================================================*/

#define ME_WAIT_NONE                            0x00140001
#define ME_WAIT_IDLE                            0x00140002

#define ME_STATUS_INVALID                       0x00000000
#define ME_STATUS_IDLE                          0x00150001
#define ME_STATUS_BUSY                          0x00150002
#define ME_STATUS_ERROR                         0x00150003

#define ME_IO_STREAM_STATUS_NO_FLAGS            0x00000000

/*==================================================================
  Defines for meIOStreamSetCallbacks function
  ================================================================*/

#define ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS     0x00000000

/*==================================================================
  Defines for meIOStreamTimeToTicks function
  ================================================================*/

#define ME_IO_TIME_TO_TICKS_NO_FLAGS							0x0
#define ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE			0x1

/*==================================================================
  Defines for module types
  ================================================================*/

#define ME_MODULE_TYPE_MULTISIG_NONE                    0x00000000
#define ME_MODULE_TYPE_MULTISIG_DIFF16_10V              0x00160001
#define ME_MODULE_TYPE_MULTISIG_DIFF16_20V              0x00160002
#define ME_MODULE_TYPE_MULTISIG_DIFF16_50V              0x00160003
#define ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA        0x00160004
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT100              0x00160005
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT500              0x00160006
#define ME_MODULE_TYPE_MULTISIG_RTD8_PT1000             0x00160007
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B              0x00160008
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E              0x00160009
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J              0x0016000A
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K              0x0016000B
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N              0x0016000C
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R              0x0016000D
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S              0x0016000E
#define ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T              0x0016000F
#define ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR         0x00160010

/*==================================================================
  Defines for meQuerySubdeviceCaps function
  ================================================================*/

#define ME_CAPS_DIO_DIR_BIT                     0x00000001
#define ME_CAPS_DIO_DIR_BYTE                    0x00000002
#define ME_CAPS_DIO_DIR_WORD                    0x00000004
#define ME_CAPS_DIO_DIR_DWORD                   0x00000008
#define ME_CAPS_DIO_SINK_SOURCE                 0x00000010
#define ME_CAPS_DIO_BIT_PATTERN_IRQ             0x00000020
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING    0x00000040
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING   0x00000080
#define ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY       0x00000100
#define ME_CAPS_DIO_OVER_TEMP_IRQ               0x00000200
#define ME_CAPS_DIO_NORMAL_TEMP_IRQ             0x00000400

#define ME_CAPS_CTR_CLK_PREVIOUS                0x00000001
#define ME_CAPS_CTR_CLK_INTERNAL_1MHZ           0x00000002
#define ME_CAPS_CTR_CLK_INTERNAL_10MHZ          0x00000004
#define ME_CAPS_CTR_CLK_EXTERNAL                0x00000008

#define ME_CAPS_AI_TRIG_SIMULTANEOUS            0x00000001
#define ME_CAPS_AI_FIFO                         0x00000002
#define ME_CAPS_AI_FIFO_THRESHOLD               0x00000004
#define ME_CAPS_AI_SAMPLE_HOLD                  0x00000008

#define ME_CAPS_AO_TRIG_SIMULTANEOUS            0x00000001
#define ME_CAPS_AO_FIFO                         0x00000002
#define ME_CAPS_AO_FIFO_THRESHOLD               0x00000004

#define ME_CAPS_FIO_SINK_SOURCE                 0x00000010

#define ME_CAPS_EXT_IRQ_EDGE_RISING             0x00000001
#define ME_CAPS_EXT_IRQ_EDGE_FALLING            0x00000002
#define ME_CAPS_EXT_IRQ_EDGE_ANY                0x00000004

/*==================================================================
  Defines for meQuerySubdeviceCapsArgs function
  ================================================================*/

#define ME_CAP_AI_FIFO_SIZE                     0x001D0000
#define ME_CAP_AI_BUFFER_SIZE                   0x001D0001
#define ME_CAP_AI_CHANNEL_LIST_SIZE             0x001D0002
#define ME_CAP_AI_MAX_THRESHOLD_SIZE            0x001D0003

#define ME_CAP_AO_FIFO_SIZE                     0x001F0000
#define ME_CAP_AO_BUFFER_SIZE                   0x001F0001
#define ME_CAP_AO_CHANNEL_LIST_SIZE             0x001F0002
#define ME_CAP_AO_MAX_THRESHOLD_SIZE            0x001F0003

#define ME_CAP_CTR_WIDTH                        0x00200000

#define ME_CAP_FPGA_IN_FIFO_SIZE                0x00300000
#define ME_CAP_FPGA_IN_BUFFER_SIZE              0x00300001
#define ME_CAP_FPGA_OUT_FIFO_SIZE               0x00300002
#define ME_CAP_FPGA_OUT_BUFFER_SIZE             0x00300003

/*==================================================================
  Defines common to query functions
  ================================================================*/

#define ME_UNIT_INVALID                         0x00000000
#define ME_UNIT_VOLT                            0x00170001
#define ME_UNIT_AMPERE                          0x00170002
#define ME_UNIT_ANY                             0x00170003
#define ME_UNIT_HZ                              0x00170004

#define ME_TYPE_INVALID                         0x00000000
#define ME_TYPE_AO                              0x00180001
#define ME_TYPE_AI                              0x00180002
#define ME_TYPE_DIO                             0x00180003
#define ME_TYPE_DO                              0x00180004
#define ME_TYPE_DI                              0x00180005
#define ME_TYPE_CTR                             0x00180006
#define ME_TYPE_EXT_IRQ                         0x00180007
#define ME_TYPE_FIO                             0x00180008
#define ME_TYPE_FO                              0x00180009
#define ME_TYPE_FI                              0x0018000A
#define ME_TYPE_FPGA                            0x0018000B

#define ME_SUBTYPE_INVALID                      0x00000000
#define ME_SUBTYPE_SINGLE                       0x00190001
#define ME_SUBTYPE_STREAMING                    0x00190002
#define ME_SUBTYPE_CTR_8254                     0x00190003
#define ME_SUBTYPE_ANY                          0x00190004
#define ME_SUBTYPE_CTR                          0x00190006

#define ME_DEVICE_DRIVER_NAME_MAX_COUNT         64
#define ME_DEVICE_NAME_MAX_COUNT                64

#define ME_DEVICE_DESCRIPTION_MAX_COUNT         256

#define ME_BUS_TYPE_INVALID                     0x00000000
#define ME_BUS_TYPE_PCI                         0x001A0001
#define ME_BUS_TYPE_USB                         0x001A0002
#define ME_BUS_TYPE_LAN_PCI                     0x001A0101
#define ME_BUS_TYPE_LAN_USB                     0x001A0102

#define ME_PLUGGED_INVALID                      0x00000000
#define ME_PLUGGED_IN                           0x001B0001
#define ME_PLUGGED_OUT                          0x001B0002

#define ME_EXTENSION_TYPE_INVALID               0x00000000
#define ME_EXTENSION_TYPE_NONE                  0x001C0001
#define ME_EXTENSION_TYPE_MUX32M                0x001C0002
#define ME_EXTENSION_TYPE_DEMUX32               0x001C0003
#define ME_EXTENSION_TYPE_MUX32S                0x001C0004
#define ME_EXTENSION_TYPE_ME1001                0x001C0005

#define ME_ACCESS_TYPE_INVALID                  0x00000000
#define ME_ACCESS_TYPE_ANY                      0x001D0000
#define ME_ACCESS_TYPE_LOCAL                    0x001D0001
#define ME_ACCESS_TYPE_REMOTE                   0x001D0002

#define ME_PWM_START_NO_FLAGS                   0x0
#define ME_PWM_START_CONNECT_INTERNAL           0x1

#define ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS			0x0
#define ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS		0x1

//------------------------------------

#define ME_PROPERTY_TYPE_INVALID				0x0
#define ME_PROPERTY_TYPE_CONTAINER				0x1
#define ME_PROPERTY_TYPE_BOOL					0x2
#define ME_PROPERTY_TYPE_INT					0x3
#define ME_PROPERTY_TYPE_DOUBLE					0x4
#define ME_PROPERTY_TYPE_STRING					0x5
#define ME_PROPERTY_TYPE_DEFINE					0x6

#define ME_PROPERTY_ACCESS_READ_ONLY			0x0
#define ME_PROPERTY_ACCESS_READ_WRITE			0x1

#define ME_PROPERTY_BOOLEAN_FALSE				0x00
#define ME_PROPERTY_BOOLEAN_TRUE				0x01

#define ME_CALIBRATION_TYPE_FACTORY				0x001E0000
#define ME_CALIBRATION_TYPE_USER_1				0x001E0001
#define ME_5800_FAMILY							0x5800

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Interface Type Definitions

  • ME-iDS API
  • C/C++ Interface

C/C++ Interface Type Definitions

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : metypes.h
//              typedefs of callback functions and structures used in ME-iDS
//==============================================================================

#ifndef _METYPES_H_
#define _METYPES_H_

typedef int (__stdcall *meErrorCB_t)(char *pcFunctionName, int iErrorCode);

typedef int (__stdcall *meIOStreamCB_t)(
            int iDevice,
            int iSubdevice,
            int iCount,
            void *pvContext,
            int iErrorCode);

typedef int (__stdcall *meIOIrqCB_t)(
            int iDevice,
            int iSubdevice,
            int iChannel,
            int iIrqCount,
            int iValue,
            void *pvContext,
            int iErrorCode);

typedef struct meIOSingle {
    int iDevice;
    int iSubdevice;
    int iChannel;
    int iDir;
    int iValue;
    int iTimeOut;
    int iFlags;
    int iErrno;
} meIOSingle_t;

typedef struct meIOStreamConfig {
    int iChannel;
    int iStreamConfig;
    int iRef;
    int iFlags;
} meIOStreamConfig_t;

typedef struct meIOStreamTrigger {
    int iAcqStartTrigType;
    int iAcqStartTrigEdge;
    int iAcqStartTrigChan;
    int iAcqStartTicksLow;
    int iAcqStartTicksHigh;
    int iAcqStartArgs[10];
    int iScanStartTrigType;
    int iScanStartTicksLow;
    int iScanStartTicksHigh;
    int iScanStartArgs[10];
    int iConvStartTrigType;
    int iConvStartTicksLow;
    int iConvStartTicksHigh;
    int iConvStartArgs[10];
    int iScanStopTrigType;
    int iScanStopCount;
    int iScanStopArgs[10];
    int iAcqStopTrigType;
    int iAcqStopCount;
    int iAcqStopArgs[10];
    int iFlags;
} meIOStreamTrigger_t;

typedef struct meIOStreamStart {
    int iDevice;
    int iSubdevice;
    int iStartMode;
    int iTimeOut;
    int iFlags;
    int iErrno;
} meIOStreamStart_t;

typedef struct meIOStreamStop {
    int iDevice;
    int iSubdevice;
    int iStopMode;
    int iFlags;
    int iErrno;
} meIOStreamStop_t;

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Property Names ANSI

  • ME-iDS API
  • C/C++ Interface

C/C++ Property Names ANSI

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : meIDSPropertyNames.h
//              defines for properties used in ME-iDS, ANSI format
//==============================================================================

#ifndef _MEIDSPROPERTYNAMES_H_
#define _MEIDSPROPERTYNAMES_H_

//=================================================================
// Attributes
//=================================================================

#define ME_ATTRIBUTE_NAME_NUMBER_OF_ELEMENTS                     "NumberOfElements"

#define ME_ATTRIBUTE_NAME_PROPERTY_NAME                          "PropertyName"

#define ME_ATTRIBUTE_NAME_PROPERTY_TYPE                          "PropertyType"

#define ME_ATTRIBUTE_NAME_PROPERTY_ACCESS                        "PropertyAccess"

#define ME_ATTRIBUTE_NAME_PROPERTY_DESCRIPTION                   "PropertyDescription"

#define ME_ATTRIBUTE_NAME_MIN_VALUE                              "MinValue"

#define ME_ATTRIBUTE_NAME_MAX_VALUE                              "MaxValue"

#define ME_ATTRIBUTE_NAME_LENGTH                                 "Length"

#define ME_ATTRIBUTE_NAME_MAX_LENGTH                             "MaxLength"

#define ME_ATTRIBUTE_NAME_NUMBER_OF_SELECTIONS                   "NumberOfSelections"

#define ME_ATTRIBUTE_NAME_PREFIX_SELECTION                       "Selection"    // The selection with index # is  "Selection#"

//=================================================================
// Root container (system container)
//=================================================================

#define ME_CONTAINER_NAME_ROOT                                   "\\\\"

//=================================================================
// System properties and containers
//=================================================================

#define ME_PROPERTY_NAME_LIBRARY_VERSION                         "LibraryVersion"

#define ME_PROPERTY_NAME_MAIN_DRIVER_VERSION                     "MainDriverVersion"

#define ME_PROPERTY_NAME_NUMBER_OF_DEVICES                       "NumberOfDevices"

#define ME_CONTAINER_NAME_DEVICES                                "Devices"

//=================================================================
// General device properties and containers - not device specific
//=================================================================

#define ME_CONTAINER_NAME_PREFIX_DEVICE                          "Device"   // The container name for the device with index # is  "Device#"

#define ME_PROPERTY_NAME_NAME                                    "Name"

#define ME_PROPERTY_NAME_DRIVER_NAME                             "DriverName"

#define ME_PROPERTY_NAME_DRIVER_VERSION                          "DriverVersion"

#define ME_PROPERTY_NAME_DESCRIPTION                             "Description"

#define ME_PROPERTY_NAME_SERIAL_NUMBER                           "SerialNumber"

#define ME_PROPERTY_NAME_BUS_TYPE                                "BusType"

#define ME_PROPERTY_NAME_ACCESS_TYPE                             "AccessType"

#define ME_PROPERTY_NAME_PLUGGED                                 "Plugged"

#define ME_PROPERTY_NAME_FIRMWARE_SELECTABLE                     "FirmwareSelectable"

#define ME_PROPERTY_NAME_CURRENT_FIRMWARE_ID                     "CurrentFirmwareID"

#define ME_PROPERTY_NAME_NUMBER_OF_SUBDEVICES                    "NumberOfSubdevices"

#define ME_CONTAINER_NAME_SUBDEVICES                             "Subdevices"

//=================================================================
// Additional properties for PCI devices
//=================================================================

#define ME_PROPERTY_NAME_PCI_VENDOR_ID                           "PCIVendorID"

#define ME_PROPERTY_NAME_PCI_DEVICE_ID                           "PCIDeviceID"

#define ME_PROPERTY_NAME_PCI_BUS_NUMBER                          "PCIBusNumber"

#define ME_PROPERTY_NAME_PCI_SLOT_NUMBER                         "PCISlotNumber"

#define ME_PROPERTY_NAME_PCI_FUNCTION_NUMBER                     "PCIFunctionNumber"

//=================================================================
// General sub-device properties and containers - not sub-device specific
//=================================================================

#define ME_CONTAINER_NAME_PREFIX_SUBDEVICE                       "Subdevice"    // The container name for the sub-device with index # is  "Subdevice#"

#define ME_PROPERTY_NAME_TYPE                                    "Type"

#define ME_PROPERTY_NAME_SUBTYPE                                 "Subtype"

#define ME_PROPERTY_NAME_NUMBER_OF_CHANNELS                      "NumberOfChannels"

#define ME_PROPERTY_NAME_CONFIGURABLE                            "Configurable"

#define ME_PROPERTY_NAME_NUMBER_OF_CONFIGURATIONS                "NumberOfConfigurations"

#define ME_PROPERTY_NAME_CURRENT_CONFIGURATION                   "CurrentConfiguration"

#define ME_CONTAINER_NAME_CHANNELS                               "Channels"

#define ME_CONTAINER_NAME_PREFIX_CHANNEL                         "Channel" // The container name for the channel with index # is "Channel#"

#define ME_CONTAINER_NAME_CONFIGURATIONS                         "Configurations"

#define ME_CONTAINER_NAME_PREFIX_CONFIGURATION                   "Configuration"    // The container name for the configuration with index # is  "Configuration#"

//=================================================================
// Configuration properties
//=================================================================

#define ME_PROPERTY_NAME_SUBDEVICE_TYPE                          "SubdeviceType"

#define ME_PROPERTY_NAME_SUBDEVICE_SUBTYPE                       "SubdeviceSubtype"

#define ME_PROPERTY_NAME_SUBDEVICE_NUMBER_OF_CHANNELS            "SubdeviceNumberOfChannels"

//=================================================================
// ME-5100 and ME-5001 - additional device properties
//=================================================================

#define ME_PROPERTY_NAME_IO_PIN_VOLTAGE_LEVEL                    "IOPinVoltageLevel"

#define ME_PROPERTY_NAME_SUBDEVICES_0_AND_1_TERMINATED           "Subdevice0And1Terminated"

#define ME_PROPERTY_NAME_SUBDEVICES_2_AND_3_TERMINATED           "Subdevice2And3Terminated"

//=================================================================
// Additional sub-device properties for various sub-device types
//=================================================================

#define ME_PROPERTY_NAME_TERMINATED                              "Terminated"

#define ME_PROPERTY_NAME_SYSTEM_CLOCK_FREQUENCY                  "SystemClockFrequency"

//=================================================================
// Additional sub-device properties and containers for AI, DI and DO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_TRIGGER_TYPE                            "TriggerType"

#define ME_PROPERTY_NAME_PREFIX_RISING_EDGE_BIT                  "RisingEdgeBit"    // The name for the trigger condition on bit # is  "RisingEdgeBit#"

#define ME_PROPERTY_NAME_PREFIX_FALLING_EDGE_BIT                 "FallingEdgeBit"   // The name for the trigger condition on bit # is  "FallngEdgeBit#"

#define ME_PROPERTY_NAME_INTERNAL_BUFFER_SIZE                    "InternalBufferSize"

#define ME_PROPERTY_NAME_SAMPLE_FREQUENCY                        "SampleFrequency"

#define ME_PROPERTY_NAME_SAMPLE_TIME                             "SampleTime"

#define ME_PROPERTY_NAME_START_TRIGGER_TYPE                      "StartTriggerType"

#define ME_PROPERTY_NAME_CONV_TRIGGER_TYPE                       "ConvTriggerType"

#define ME_PROPERTY_NAME_STOP_TRIGGER_TYPE                       "StopTriggerType"

#define ME_PROPERTY_NAME_START_STOP_PATTERN                      "StartStopPattern"

#define ME_PROPERTY_NAME_STOP_ON_COUNT                           "StopOnCount"

#define ME_PROPERTY_NAME_STOP_COUNT                              "StopCount"

#define ME_CONTAINER_NAME_INTERRUPT_CONDITION                    "InterruptCondition"

#define ME_CONTAINER_NAME_SINGLE_CONFIGURATION                   "SingleConfiguration"

#define ME_CONTAINER_NAME_EXT_DIGITAL_TRIGGER_CONDITION          "ExtDigitalTriggerCondition"

#define ME_CONTAINER_NAME_STREAMING_CONFIGURATION                "StreamingConfiguration"

#define ME_CONTAINER_NAME_START_AND_CONV_TRIGGER_CONDITION       "StartAndConvTriggerCondition"

#define ME_CONTAINER_NAME_STOP_TRIGGER_CONDITION                 "StopTriggerCondition"

#define ME_CONTAINER_NAME_IRQ_CONFIGURATION                      "IRQConfiguration"

//=================================================================
// Additional sub-device properties for AI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_CALIBRATION                             "Calibration"

#define ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A1                  "RisingEdgeTriggerA1"

#define ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A1                 "FallingEdgeTriggerA1"

#define ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A2                  "RisingEdgeTriggerA2"

#define ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A2                 "FallingEdgeTriggerA2"

#define ME_PROPERTY_NAME_ACQUIRE_CHANNEL                         "AcquireChanne "

//=================================================================
// Additional sub-device properties and containers for DI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A                   "RisingEdgeTriggerA"

#define ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A                  "FallingEdgeTriggerA"

#define ME_PROPERTY_NAME_USE_INTERNAL_TEST_COUNTER               "UseInternalTestCounter"

#define ME_PROPERTY_NAME_TRANSFER_SIZE                           "TransferSize"

#define ME_PROPERTY_NAME_IRQ_SOURCE                              "IRQSource"

#define ME_PROPERTY_NAME_BIT_PATTERN                             "BitPattern"

#define ME_PROPERTY_NAME_BIT_PATTERN_FILTERING                   "BitPatternFiltering"

#define ME_PROPERTY_CONTAINER_BIT_MASK                           "BitMask"

//=================================================================
// Additional sub-device properties and containers forDO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_B                   "RisingEdgeTriggerB"

#define ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_B                  "FallingEdgeTriggerB"

#define ME_PROPERTY_NAME_IRQ_ON_EXCESS_TEMPERATURE               "IRQOnExcessTemperature"

#define ME_PROPERTY_NAME_IRQ_ON_NORMAL_TEMPERATURE               "IRQOnNormalTemperature"

#define ME_PROPERTY_NAME_STOP_PATTERN                            "StopPattern"

#define ME_PROPERTY_NAME_WRAPAROUND                              "Wraparound"

#define ME_PROPERTY_NAME_WRAPAROUND_LOOPS                        "WraparoundLoops"

//=================================================================
// Additional sub-device properties and containers for DO and FO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_OUTPUT_MODE                             "OutputMode"

//=================================================================
// Additional sub-device properties and containers for DIO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_DIRECTION                               "Direction"

//=================================================================
// Additional sub-device properties FI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TICKS              "MinMeasurableTotalTicks"

#define ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TICK               "MaxMeasurableTotalTicks"

#define ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TICKS        "MinMeasurableFirstPhaseTicks"

#define ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TICKS        "MaxMeasurableFirstPhaseTicks"

#define ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TIME               "MinMeasurableTotalTime"

#define ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TIME               "MaxMeasurableTotalTime"

#define ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TIME         "MinMeasurableFirstPhaseTime"

#define ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TIME         "MaxMeasurableFirstPhaseTime"

//=================================================================
// Additional sub-device properties for FO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_MIN_TOTAL_TICKS                         "MinTotalTicks"

#define ME_PROPERTY_NAME_MAX_TOTAL_TICK                          "MaxTotalTicks"

#define ME_PROPERTY_NAME_MIN_FIRST_PHASE_TICKS                   "MinFirstPhaseTicks"

#define ME_PROPERTY_NAME_MAX_FIRST_PHASE_TICKS                   "MaxFirstPhaseTicks"

#define ME_PROPERTY_NAME_MIN_TOTAL_TIME                          "MinTotalTime"

#define ME_PROPERTY_NAME_MAX_TOTAL_TIME                          "MaxTotalTime"

#define ME_PROPERTY_NAME_MIN_FIRST_PHASE_TIME                    "MinFirstPhaseTime"

#define ME_PROPERTY_NAME_MAX_FIRST_PHASE_TIME                    "MaxFirstPhaseTime"

//=================================================================
// FO sub-device channel properties
//=================================================================

#define ME_PROPERTY_NAME_INVERTED                                "Inverted"

#define ME_PROPERTY_NAME_SYNCHRONOUS_START                       "SynchronousStart"

#define ME_PROPERTY_NAME_SOFT_START                              "SoftStart"

//=================================================================
// Counter sub-devices - additional sub-device properties
//=================================================================

#define ME_PROPERTY_NAME_WIDTH_IN_BITS                           "WidthInBits"

#define ME_PROPERTY_NAME_CLOCK_SOURCE                            "ClockSource"

#define ME_PROPERTY_NAME_COUNTER_MODE                            "CounterMode"

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: C/C++ Property Names UNICODE

  • ME-iDS API
  • C/C++ Interface

C/C++ Property Names UNICODE

//==============================================================================
//Copyright(c)  Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : meIDSPropertiesWideCharacter.h
//              defines for properties used in ME-iDS, UNICODE format
//==============================================================================

#ifndef _MEIDSPROPERTIESWIDECHARACTER_H_
#define _MEIDSPROPERTIESWIDECHARACTER_H_

//=================================================================
// Attributes
//=================================================================

#define ME_ATTRIBUTE_NAME_WC_NUMBER_OF_ELEMENTS                     L"NumberOfElements"

#define ME_ATTRIBUTE_NAME_WC_PROPERTY_NAME                          L"PropertyName"

#define ME_ATTRIBUTE_NAME_WC_PROPERTY_TYPE                          L"PropertyType"

#define ME_ATTRIBUTE_NAME_WC_PROPERTY_ACCESS                        L"PropertyAccess"

#define ME_ATTRIBUTE_NAME_WC_PROPERTY_DESCRIPTION                   L"PropertyDescription"

#define ME_ATTRIBUTE_NAME_WC_MIN_VALUE                              L"MinValue"

#define ME_ATTRIBUTE_NAME_WC_MAX_VALUE                              L"MaxValue"

#define ME_ATTRIBUTE_NAME_WC_LENGTH                                 L"Length"

#define ME_ATTRIBUTE_NAME_WC_MAX_LENGTH                             L"MaxLength"

#define ME_ATTRIBUTE_NAME_WC_NUMBER_OF_SELECTIONS                   L"NumberOfSelections"

#define ME_ATTRIBUTE_NAME_WC_PREFIX_SELECTION                       L"Selection"    // The selection with index # is L"Selection#"

//=================================================================
// Root container (system container)
//=================================================================

#define ME_CONTAINER_NAME_WC_ROOT                                   L"\\\\"

//=================================================================
// System properties and containers
//=================================================================

#define ME_PROPERTY_NAME_WC_LIBRARY_VERSION                         L"LibraryVersion"

#define ME_PROPERTY_NAME_WC_MAIN_DRIVER_VERSION                     L"MainDriverVersion"

#define ME_PROPERTY_NAME_WC_NUMBER_OF_DEVICES                       L"NumberOfDevices"

#define ME_CONTAINER_NAME_WC_DEVICES                                L"Devices"

//=================================================================
// General device properties and containers - not device specific
//=================================================================

#define ME_CONTAINER_NAME_PREFIX_WC_DEVICE                          L"Device"   // The container name for the device with index # is L"Device#"

#define ME_PROPERTY_NAME_WC_NAME                                    L"Name"

#define ME_PROPERTY_NAME_WC_DRIVER_NAME                             L"DriverName"

#define ME_PROPERTY_NAME_WC_DRIVER_VERSION                          L"DriverVersion"

#define ME_PROPERTY_NAME_WC_DESCRIPTION                             L"Description"

#define ME_PROPERTY_NAME_WC_SERIAL_NUMBER                           L"SerialNumber"

#define ME_PROPERTY_NAME_WC_BUS_TYPE                                L"BusType"

#define ME_PROPERTY_NAME_WC_ACCESS_TYPE                             L"AccessType"

#define ME_PROPERTY_NAME_WC_PLUGGED                                 L"Plugged"

#define ME_PROPERTY_NAME_WC_FIRMWARE_SELECTABLE                     L"FirmwareSelectable"

#define ME_PROPERTY_NAME_WC_CURRENT_FIRMWARE_ID                     L"CurrentFirmwareID"

#define ME_PROPERTY_NAME_WC_NUMBER_OF_SUBDEVICES                    L"NumberOfSubdevices"

#define ME_CONTAINER_NAME_WC_SUBDEVICES                             L"Subdevices"

//=================================================================
// Additional properties for PCI devices
//=================================================================

#define ME_PROPERTY_NAME_WC_PCI_VENDOR_ID                           L"PCIVendorID"

#define ME_PROPERTY_NAME_WC_PCI_DEVICE_ID                           L"PCIDeviceID"

#define ME_PROPERTY_NAME_WC_PCI_BUS_NUMBER                          L"PCIBusNumber"

#define ME_PROPERTY_NAME_WC_PCI_SLOT_NUMBER                         L"PCISlotNumber"

#define ME_PROPERTY_NAME_WC_PCI_FUNCTION_NUMBER                     L"PCIFunctionNumber"

//=================================================================
// General sub-device properties and containers - not sub-device specific
//=================================================================

#define ME_CONTAINER_NAME_PREFIX_WC_SUBDEVICE                       L"Subdevice"    // The container name for the sub-device with index # is L"Subdevice#"

#define ME_PROPERTY_NAME_WC_TYPE                                    L"Type"

#define ME_PROPERTY_NAME_WC_SUBTYPE                                 L"Subtype"

#define ME_PROPERTY_NAME_WC_NUMBER_OF_CHANNELS                      L"NumberOfChannels"

#define ME_PROPERTY_NAME_WC_CONFIGURABLE                            L"Configurable"

#define ME_PROPERTY_NAME_WC_NUMBER_OF_CONFIGURATIONS                L"NumberOfConfigurations"

#define ME_PROPERTY_NAME_WC_CURRENT_CONFIGURATION                   L"CurrentConfiguration"

#define ME_CONTAINER_NAME_WC_CHANNELS                               L"Channels"

#define ME_CONTAINER_NAME_PREFIX_WC_CHANNEL                         L"Channel"          // The container name for the channel with index # is L"Channel#"

#define ME_CONTAINER_NAME_WC_CONFIGURATIONS                         L"Configurations"

#define ME_CONTAINER_NAME_PREFIX_WC_CONFIGURATION                   L"Configuration"    // The container name for the configuration with index # is L"Configuration#"

//=================================================================
// Configuration properties
//=================================================================

#define ME_PROPERTY_NAME_WC_SUBDEVICE_TYPE                          L"SubdeviceType"

#define ME_PROPERTY_NAME_WC_SUBDEVICE_SUBTYPE                       L"SubdeviceSubtype"

#define ME_PROPERTY_NAME_WC_SUBDEVICE_NUMBER_OF_CHANNELS            L"SubdeviceNumberOfChannels"

//=================================================================
// ME-5100 and ME-5001 - additional device properties
//=================================================================

#define ME_PROPERTY_NAME_WC_IO_PIN_VOLTAGE_LEVEL                    L"IOPinVoltageLevel"

#define ME_PROPERTY_NAME_WC_SUBDEVICES_0_AND_1_TERMINATED           L"Subdevice0And1Terminated"

#define ME_PROPERTY_NAME_WC_SUBDEVICES_2_AND_3_TERMINATED           L"Subdevice2And3Terminated"

//=================================================================
// Additional sub-device properties for various sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_TERMINATED                              L"Terminated"

#define ME_PROPERTY_NAME_WC_SYSTEM_CLOCK_FREQUENCY                  L"SystemClockFrequency"

//=================================================================
// Additional sub-device properties and containers for AI, DI and DO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_TRIGGER_TYPE                            L"TriggerType"

#define ME_PROPERTY_NAME_PREFIX_WC_RISING_EDGE_BIT                  L"RisingEdgeBit"    // The name for the trigger condition on bit # is L"RisingEdgeBit#"

#define ME_PROPERTY_NAME_PREFIX_WC_FALLING_EDGE_BIT                 L"FallingEdgeBit"   // The name for the trigger condition on bit # is L"FallngEdgeBit#"

#define ME_PROPERTY_NAME_WC_INTERNAL_BUFFER_SIZE                    L"InternalBufferSize"

#define ME_PROPERTY_NAME_WC_SAMPLE_FREQUENCY                        L"SampleFrequency"

#define ME_PROPERTY_NAME_WC_SAMPLE_TIME                             L"SampleTime"

#define ME_PROPERTY_NAME_WC_START_TRIGGER_TYPE                      L"StartTriggerType"

#define ME_PROPERTY_NAME_WC_CONV_TRIGGER_TYPE                       L"ConvTriggerType"

#define ME_PROPERTY_NAME_WC_STOP_TRIGGER_TYPE                       L"StopTriggerType"

#define ME_PROPERTY_NAME_WC_START_STOP_PATTERN                      L"StartStopPattern"

#define ME_PROPERTY_NAME_WC_STOP_ON_COUNT                           L"StopOnCount"

#define ME_PROPERTY_NAME_WC_STOP_COUNT                              L"StopCount"

#define ME_CONTAINER_NAME_WC_INTERRUPT_CONDITION                    L"InterruptCondition"

#define ME_CONTAINER_NAME_WC_SINGLE_CONFIGURATION                   L"SingleConfiguration"

#define ME_CONTAINER_NAME_WC_EXT_DIGITAL_TRIGGER_CONDITION          L"ExtDigitalTriggerCondition"

#define ME_CONTAINER_NAME_WC_STREAMING_CONFIGURATION                L"StreamingConfiguration"

#define ME_CONTAINER_NAME_WC_START_AND_CONV_TRIGGER_CONDITION       L"StartAndConvTriggerCondition"

#define ME_CONTAINER_NAME_WC_STOP_TRIGGER_CONDITION                 L"StopTriggerCondition"

#define ME_CONTAINER_NAME_WC_IRQ_CONFIGURATION                      L"IRQConfiguration"

//=================================================================
// Additional sub-device properties for AI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_CALIBRATION                             L"Calibration"

#define ME_PROPERTY_NAME_WC_RISING_EDGE_TRIGGER_A1                  L"RisingEdgeTriggerA1"

#define ME_PROPERTY_NAME_WC_FALLING_EDGE_TRIGGER_A1                 L"FallingEdgeTriggerA1"

#define ME_PROPERTY_NAME_WC_RISING_EDGE_TRIGGER_A2                  L"RisingEdgeTriggerA2"

#define ME_PROPERTY_NAME_WC_FALLING_EDGE_TRIGGER_A2                 L"FallingEdgeTriggerA2"

#define ME_PROPERTY_NAME_WC_ACQUIRE_CHANNEL                         L"AcquireChannel"

//=================================================================
// Additional sub-device properties and containers for DI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_RISING_EDGE_TRIGGER_A                   L"RisingEdgeTriggerA"

#define ME_PROPERTY_NAME_WC_FALLING_EDGE_TRIGGER_A                  L"FallingEdgeTriggerA"

#define ME_PROPERTY_NAME_WC_USE_INTERNAL_TEST_COUNTER               L"UseInternalTestCounter"

#define ME_PROPERTY_NAME_WC_TRANSFER_SIZE                           L"TransferSize"

#define ME_PROPERTY_NAME_WC_IRQ_SOURCE                              L"IRQSource"

#define ME_PROPERTY_NAME_WC_BIT_PATTERN                             L"BitPattern"

#define ME_PROPERTY_NAME_WC_BIT_PATTERN_FILTERING                   L"BitPatternFiltering"

#define ME_PROPERTY_CONTAINER_WC_BIT_MASK                           L"BitMask"

//=================================================================
// Additional sub-device properties and containers forDO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_RISING_EDGE_TRIGGER_B                   L"RisingEdgeTriggerB"

#define ME_PROPERTY_NAME_WC_FALLING_EDGE_TRIGGER_B                  L"FallingEdgeTriggerB"

#define ME_PROPERTY_NAME_WC_IRQ_ON_EXCESS_TEMPERATURE               L"IRQOnExcessTemperature"

#define ME_PROPERTY_NAME_WC_IRQ_ON_NORMAL_TEMPERATURE               L"IRQOnNormalTemperature"

#define ME_PROPERTY_NAME_WC_STOP_PATTERN                            L"StopPattern"

#define ME_PROPERTY_NAME_WC_WRAPAROUND                              L"Wraparound"

#define ME_PROPERTY_NAME_WC_WRAPAROUND_LOOPS                        L"WraparoundLoops"

//=================================================================
// Additional sub-device properties and containers for DO and FO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_OUTPUT_MODE                             L"OutputMode"

//=================================================================
// Additional sub-device properties and containers for DIO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_DIRECTION                               L"Direction"

//=================================================================
// Additional sub-device properties FI sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_MIN_MEASURABLE_TOTAL_TICKS              L"MinMeasurableTotalTicks"

#define ME_PROPERTY_NAME_WC_MAX_MEASURABLE_TOTAL_TICK               L"MaxMeasurableTotalTicks"

#define ME_PROPERTY_NAME_WC_MIN_MEASURABLE_FIRST_PHASE_TICKS        L"MinMeasurableFirstPhaseTicks"

#define ME_PROPERTY_NAME_WC_MAX_MEASURABLE_FIRST_PHASE_TICKS        L"MaxMeasurableFirstPhaseTicks"

#define ME_PROPERTY_NAME_WC_MIN_MEASURABLE_TOTAL_TIME               L"MinMeasurableTotalTime"

#define ME_PROPERTY_NAME_WC_MAX_MEASURABLE_TOTAL_TIME               L"MaxMeasurableTotalTime"

#define ME_PROPERTY_NAME_WC_MIN_MEASURABLE_FIRST_PHASE_TIME         L"MinMeasurableFirstPhaseTime"

#define ME_PROPERTY_NAME_WC_MAX_MEASURABLE_FIRST_PHASE_TIME         L"MaxMeasurableFirstPhaseTime"

//=================================================================
// Additional sub-device properties for FO sub-device types
//=================================================================

#define ME_PROPERTY_NAME_WC_MIN_TOTAL_TICKS                         L"MinTotalTicks"

#define ME_PROPERTY_NAME_WC_MAX_TOTAL_TICK                          L"MaxTotalTicks"

#define ME_PROPERTY_NAME_WC_MIN_FIRST_PHASE_TICKS                   L"MinFirstPhaseTicks"

#define ME_PROPERTY_NAME_WC_MAX_FIRST_PHASE_TICKS                   L"MaxFirstPhaseTicks"

#define ME_PROPERTY_NAME_WC_MIN_TOTAL_TIME                          L"MinTotalTime"

#define ME_PROPERTY_NAME_WC_MAX_TOTAL_TIME                          L"MaxTotalTime"

#define ME_PROPERTY_NAME_WC_MIN_FIRST_PHASE_TIME                    L"MinFirstPhaseTime"

#define ME_PROPERTY_NAME_WC_MAX_FIRST_PHASE_TIME                    L"MaxFirstPhaseTime"

//=================================================================
// FO sub-device channel properties
//=================================================================

#define ME_PROPERTY_NAME_WC_INVERTED                                L"Inverted"

#define ME_PROPERTY_NAME_WC_SYNCHRONOUS_START                       L"SynchronousStart"

#define ME_PROPERTY_NAME_WC_SOFT_START                              L"SoftStart"

//=================================================================
// Counter sub-devices - additional sub-device properties
//=================================================================

#define ME_PROPERTY_NAME_WC_WIDTH_IN_BITS                           L"WidthInBits"

#define ME_PROPERTY_NAME_WC_CLOCK_SOURCE                            L"ClockSource"

#define ME_PROPERTY_NAME_WC_COUNTER_MODE                            L"CounterMode"

#endif
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: MS Visual Basic 6.0 Interface

  • ME-iDS API

MS Visual Basic 6.0 Interface

Attribute VB_Name = "Module1"
'*------------------------------------------------------------------------------+
'-------------------------------------------------------------------------------|
'                                                                               |
'                             me-iDS Constants                                  |
'                                                                               |
'-------------------------------------------------------------------------------|
'------------------------------------------------------------------------------*/

'==================================================================
'  General
'================================================================*/

Global Const ME_ERRNO_SUCCESS = &H0

Global Const ME_VALUE_NOT_USED = &H0

Global Const ME_VALUE_DEFAULT = &H0

Global Const ME_NO_FLAGS = &H0

'=================================================================
'  Defines common to access functions
'===============================================================*/

Global Const ME_LOCK_RELEASE = &H10001
Global Const ME_LOCK_SET = &H10002
Global Const ME_LOCK_CHECK = &H10003

'=================================================================
'  Defines meOpen function
'===============================================================*/

Global Const ME_OPEN_NO_FLAGS = &H0

'=================================================================
'  Defines meClose function
'===============================================================*/

Global Const ME_CLOSE_NO_FLAGS = &H0

'=================================================================
'  Defines meLockDriver function
'===============================================================*/

Global Const ME_LOCK_DRIVER_NO_FLAGS = &H0

'=================================================================
'  Defines meLockDevice function
'===============================================================*/

Global Const ME_LOCK_DEVICE_NO_FLAGS = &H0

'=================================================================
'  Defines meLockSubdevice function
'===============================================================*/

Global Const ME_LOCK_SUBDEVICE_NO_FLAGS = &H0

'=================================================================
'  Defines common to error functions
'===============================================================*/

Global Const ME_ERROR_MSG_MAX_COUNT = 256

Global Const ME_SWITCH_DISABLE = &H20001
Global Const ME_SWITCH_ENABLE = &H20002

'=================================================================
'  Defines common to io functions
'===============================================================*/

Global Const ME_REF_DIO_FIFO_LOW = &H30001
Global Const ME_REF_DIO_FIFO_HIGH = &H30002

Global Const ME_REF_CTR_PREVIOUS = &H40001
Global Const ME_REF_CTR_INTERNAL_1MHZ = &H40002
Global Const ME_REF_CTR_INTERNAL_10MHZ = &H40003
Global Const ME_REF_CTR_EXTERNAL = &H40004

Global Const ME_REF_AI_GROUND = &H50001
Global Const ME_REF_AI_DIFFERENTIAL = &H50002

Global Const ME_REF_AO_GROUND = &H60001

Global Const ME_TRIG_CHAN_DEFAULT = &H70001
Global Const ME_TRIG_CHAN_SYNCHRONOUS = &H70002

Global Const ME_TRIG_TYPE_NONE = &H0
Global Const ME_TRIG_TYPE_SW = &H80001
Global Const ME_TRIG_TYPE_THRESHOLD = &H80002
Global Const ME_TRIG_TYPE_WINDOW = &H80003
Global Const ME_TRIG_TYPE_EDGE = &H80004
Global Const ME_TRIG_TYPE_SLOPE = &H80005
Global Const ME_TRIG_TYPE_EXT_DIGITAL = &H80006
Global Const ME_TRIG_TYPE_EXT_ANALOG = &H80007
Global Const ME_TRIG_TYPE_PATTERN = &H80008
Global Const ME_TRIG_TYPE_TIMER = &H80009
Global Const ME_TRIG_TYPE_COUNT = &H8000A
Global Const ME_TRIG_TYPE_FOLLOW = &H8000B

Global Const ME_TRIG_EDGE_ABOVE = &H90001
Global Const ME_TRIG_EDGE_BELOW = &H90002
Global Const ME_TRIG_EDGE_ENTRY = &H90003
Global Const ME_TRIG_EDGE_EXIT = &H90004
Global Const ME_TRIG_EDGE_RISING = &H90005
Global Const ME_TRIG_EDGE_FALLING = &H90006
Global Const ME_TRIG_EDGE_ANY = &H90007

Global Const ME_TIMER_ACQ_START = &HA0001
Global Const ME_TIMER_SCAN_START = &HA0002
Global Const ME_TIMER_CONV_START = &HA0003

'=================================================================
'  Defines for meIOFrequencyToTicks function
'===============================================================*/

Global Const ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS = &H0
Global Const ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE = &H1

'=================================================================
'  Defines for meIOIrqStart function
'===============================================================*/

Global Const ME_IRQ_SOURCE_DIO_PATTERN = &HB0001
Global Const ME_IRQ_SOURCE_DIO_MASK = &HB0002
Global Const ME_IRQ_SOURCE_DIO_LINE = &HB0003
Global Const ME_IRQ_SOURCE_DIO_OVER_TEMP = &HB0004

Global Const ME_IRQ_EDGE_RISING = &HC0001
Global Const ME_IRQ_EDGE_FALLING = &HC0002
Global Const ME_IRQ_EDGE_ANY = &HC0003

Global Const ME_IO_IRQ_START_NO_FLAGS = &H0
Global Const ME_IO_IRQ_START_DIO_BIT = &H1
Global Const ME_IO_IRQ_START_DIO_BYTE = &H2
Global Const ME_IO_IRQ_START_DIO_WORD = &H4
Global Const ME_IO_IRQ_START_DIO_DWORD = &H8
Global Const ME_IO_IRQ_START_PATTERN_FILTERING = &H10
Global Const ME_IO_IRQ_START_EXTENDED_STATUS = &H20

'=================================================================
'  Defines for meIOIrqWait function
'===============================================================*/

Global Const ME_IO_IRQ_WAIT_NO_FLAGS = &H0
Global Const ME_IO_IRQ_WAIT_NORMAL_STATUS = &H1
Global Const ME_IO_IRQ_WAIT_EXTENDED_STATUS = &H2

'=================================================================
'  Defines for meIOIrqStop function
'===============================================================*/

Global Const ME_IO_IRQ_STOP_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOIrqSetCallback function
'===============================================================*/

Global Const ME_IO_IRQ_SET_CALLBACK_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOResetDevice function
'===============================================================*/

Global Const ME_IO_RESET_DEVICE_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOResetSubdevice function
'===============================================================*/

Global Const ME_IO_RESET_SUBDEVICE_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOSingleConfig function
'===============================================================*/

Global Const ME_SINGLE_CONFIG_DIO_INPUT = &HD0001
Global Const ME_SINGLE_CONFIG_DIO_OUTPUT = &HD0002
Global Const ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE = &HD0003
Global Const ME_SINGLE_CONFIG_DIO_SINK = &HD0004
Global Const ME_SINGLE_CONFIG_DIO_SOURCE = &HD0005
Global Const ME_SINGLE_CONFIG_DIO_MUX32M = &HD0006
Global Const ME_SINGLE_CONFIG_DIO_DEMUX32 = &HD0007
Global Const ME_SINGLE_CONFIG_DIO_BIT_PATTERN = &HD0008

Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_0 = &HE0001
Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_1 = &HE0002
Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_2 = &HE0003
Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_3 = &HE0004
Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_4 = &HE0005
Global Const ME_SINGLE_CONFIG_CTR_8254_MODE_5 = &HE0006

Global Const ME_IO_SINGLE_CONFIG_NO_FLAGS = &H0
Global Const ME_IO_SINGLE_CONFIG_DIO_BIT = &H1
Global Const ME_IO_SINGLE_CONFIG_DIO_BYTE = &H2
Global Const ME_IO_SINGLE_CONFIG_DIO_WORD = &H4
Global Const ME_IO_SINGLE_CONFIG_DIO_DWORD = &H8
Global Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON = &H10
Global Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF = &H20
Global Const ME_IO_SINGLE_CONFIG_AI_RMS = &H40

'=================================================================
'  Defines for meIOSingle function
'===============================================================*/

Global Const ME_IO_SINGLE_NO_FLAGS = &H0

Global Const ME_DIR_INPUT = &HF0001
Global Const ME_DIR_OUTPUT = &HF0002
Global Const ME_DIR_SET_OFFSET = &HF0003

Global Const ME_IO_SINGLE_TYPE_NO_FLAGS = &H0
Global Const ME_IO_SINGLE_TYPE_DIO_BIT = &H1
Global Const ME_IO_SINGLE_TYPE_DIO_BYTE = &H2
Global Const ME_IO_SINGLE_TYPE_DIO_WORD = &H4
Global Const ME_IO_SINGLE_TYPE_DIO_DWORD = &H8
Global Const ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS = &H10
Global Const ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING = &H20

'=================================================================
'  Defines for meIOSetChannelOffset function
'===============================================================*/

Global Const ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOStreamConfig function
'===============================================================*/

Global Const ME_IO_STREAM_CONFIG_NO_FLAGS = &H0
Global Const ME_IO_STREAM_CONFIG_BIT_PATTERN = &H1
Global Const ME_IO_STREAM_CONFIG_WRAPAROUND = &H2
Global Const ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD = &H4

Global Const ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS = &H0

Global Const ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOStreamRead function
'===============================================================*/

Global Const ME_READ_MODE_BLOCKING = &H100001
Global Const ME_READ_MODE_NONBLOCKING = &H100002

Global Const ME_IO_STREAM_READ_NO_FLAGS = &H0
Global Const ME_IO_STREAM_READ_FRAMES = &H1

'=================================================================
'  Defines for meIOStreamWrite function
'===============================================================*/

Global Const ME_WRITE_MODE_BLOCKING = &H110001
Global Const ME_WRITE_MODE_NONBLOCKING = &H110002
Global Const ME_WRITE_MODE_PRELOAD = &H110003

Global Const ME_IO_STREAM_WRITE_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOStreamStart function
'===============================================================*/

Global Const ME_IO_STREAM_START_NO_FLAGS = &H0

Global Const ME_START_MODE_BLOCKING = &H120001
Global Const ME_START_MODE_NONBLOCKING = &H120002

Global Const ME_IO_STREAM_START_TYPE_NO_FLAGS = &H0
Global Const ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS = &H1

'=================================================================
'  Defines for meIOStreamStop function
'===============================================================*/

Global Const ME_IO_STREAM_STOP_NO_FLAGS = &H0

Global Const ME_STOP_MODE_IMMEDIATE = &H130001
Global Const ME_STOP_MODE_LAST_VALUE = &H130002

Global Const ME_IO_STREAM_STOP_TYPE_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOStreamStatus function
'===============================================================*/

Global Const ME_WAIT_NONE = &H140001
Global Const ME_WAIT_IDLE = &H140002

Global Const ME_STATUS_INVALID = &H0
Global Const ME_STATUS_IDLE = &H150001
Global Const ME_STATUS_BUSY = &H150002
Global Const ME_STATUS_ERROR = &H150003

Global Const ME_IO_STREAM_STATUS_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOStreamSetCallbacks function
'===============================================================*/

Global Const ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS = &H0

'=================================================================
'  Defines for meIOTimeToTicks function
'===============================================================*/

Global Const ME_IO_STREAM_TIME_TO_TICKS_NO_FLAGS = &H0
Global Const ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE = &H1

'=================================================================
'  Defines for module types
'===============================================================*/

Global Const ME_MODULE_TYPE_MULTISIG_NONE = &H0
Global Const ME_MODULE_TYPE_MULTISIG_DIFF16_10V = &H160001
Global Const ME_MODULE_TYPE_MULTISIG_DIFF16_20V = &H160002
Global Const ME_MODULE_TYPE_MULTISIG_DIFF16_50V = &H160003
Global Const ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA = &H160004
Global Const ME_MODULE_TYPE_MULTISIG_RTD8_PT100 = &H160005
Global Const ME_MODULE_TYPE_MULTISIG_RTD8_PT500 = &H160006
Global Const ME_MODULE_TYPE_MULTISIG_RTD8_PT1000 = &H160007
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B = &H160008
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E = &H160009
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J = &H16000A
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K = &H16000B
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N = &H16000C
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R = &H16000D
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S = &H16000E
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T = &H16000F
Global Const ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR = &H160010

'=================================================================
'  Defines for meQuerySubdeviceCaps function
'===============================================================*/

Global Const ME_CAPS_DIO_DIR_BIT = &H1
Global Const ME_CAPS_DIO_DIR_BYTE = &H2
Global Const ME_CAPS_DIO_DIR_WORD = &H4
Global Const ME_CAPS_DIO_DIR_DWORD = &H8
Global Const ME_CAPS_DIO_SINK_SOURCE = &H10
Global Const ME_CAPS_DIO_BIT_PATTERN_IRQ = &H20
Global Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING = &H40
Global Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING = &H80
Global Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY = &H100
Global Const ME_CAPS_DIO_OVER_TEMP_IRQ = &H200

Global Const ME_CAPS_CTR_CLK_PREVIOUS = &H1
Global Const ME_CAPS_CTR_CLK_INTERNAL_1MHZ = &H2
Global Const ME_CAPS_CTR_CLK_INTERNAL_10MHZ = &H4
Global Const ME_CAPS_CTR_CLK_EXTERNAL = &H8

Global Const ME_CAPS_AI_TRIG_SIMULTANEOUS = &H1
Global Const ME_CAPS_AI_FIFO = &H2
Global Const ME_CAPS_AI_FIFO_THRESHOLD = &H4
Global Const ME_CAPS_AI_SAMPLE_HOLD = &H8

Global Const ME_CAPS_AO_TRIG_SIMULTANEOUS = &H1
Global Const ME_CAPS_AO_FIFO = &H2
Global Const ME_CAPS_AO_FIFO_THRESHOLD = &H4

Global Const ME_CAPS_EXT_IRQ_EDGE_RISING = &H1
Global Const ME_CAPS_EXT_IRQ_EDGE_FALLING = &H2
Global Const ME_CAPS_EXT_IRQ_EDGE_ANY = &H4

'=================================================================
'  Defines for meQuerySubdeviceCapsArgs function
'===============================================================*/

Global Const ME_CAP_AI_FIFO_SIZE = &H1D0000

Global Const ME_CAP_AO_FIFO_SIZE = &H1F0000

Global Const ME_CAP_CTR_WIDTH = &H200000

'=================================================================
'  Defines common to query functions
'===============================================================*/

Global Const ME_UNIT_INVALID = &H0
Global Const ME_UNIT_VOLT = &H170001
Global Const ME_UNIT_AMPERE = &H170002
Global Const ME_UNIT_ANY = &H170003

Global Const ME_TYPE_INVALID = &H0
Global Const ME_TYPE_AO = &H180001
Global Const ME_TYPE_AI = &H180002
Global Const ME_TYPE_DIO = &H180003
Global Const ME_TYPE_DO = &H180004
Global Const ME_TYPE_DI = &H180005
Global Const ME_TYPE_CTR = &H180006
Global Const ME_TYPE_EXT_IRQ = &H180007

Global Const ME_SUBTYPE_INVALID = &H0
Global Const ME_SUBTYPE_SINGLE = &H190001
Global Const ME_SUBTYPE_STREAMING = &H190002
Global Const ME_SUBTYPE_CTR_8254 = &H190003
Global Const ME_SUBTYPE_ANY = &H190004

Global Const ME_DEVICE_DRIVER_NAME_MAX_COUNT = 64
Global Const ME_DEVICE_NAME_MAX_COUNT = 64

Global Const ME_DEVICE_DESCRIPTION_MAX_COUNT = 256

Global Const ME_BUS_TYPE_INVALID = &H0
Global Const ME_BUS_TYPE_PCI = &H1A0001
Global Const ME_BUS_TYPE_USB = &H1A0002

Global Const ME_PLUGGED_INVALID = &H0
Global Const ME_PLUGGED_IN = &H1B0001
Global Const ME_PLUGGED_OUT = &H1B0002

Global Const ME_EXTENSION_TYPE_INVALID = &H0
Global Const ME_EXTENSION_TYPE_NONE = &H1C0001
Global Const ME_EXTENSION_TYPE_MUX32M = &H1C0002
Global Const ME_EXTENSION_TYPE_DEMUX32 = &H1C0003
Global Const ME_EXTENSION_TYPE_MUX32S = &H1C0004

Global Const ME_ACCESS_TYPE_INVALID = &H0
Global Const ME_ACCESS_TYPE_LOCAL = &H1D0001
Global Const ME_ACCESS_TYPE_REMOTE = &H1D0002

Global Const ME_PWM_START_NO_FLAGS = &H0
Global Const ME_PWM_START_CONNECT_INTERNAL = &H1

'*------------------------------------------------------------------------------+
'-------------------------------------------------------------------------------|
'                                                                               |
'                             me-iDS Types                                      |
'                                                                               |
'-------------------------------------------------------------------------------|
'------------------------------------------------------------------------------*/

Type meIOSingle
    lDevice As Long
    lSubdevice As Long
    lChannel As Long
    lDir As Long
    lValue As Long
    lTimeOut As Long
    lFlags As Long
    lErrno As Long
End Type

Type meIOStreamConfig
    lChannel As Long
    lStreamConfig As Long
    lRef As Long
    lFlags As Long
End Type

Type meIOStreamTrigger
    lAcqStartTrigType As Long
    lAcqStartTrigEdge As Long
    lAcqStartTrigChan As Long
    lAcqStartTicksLow As Long
    lAcqStartTicksHigh As Long
    lAcqStartArgs(0 To 9) As Long
    lScanStartTrigType As Long
    lScanStartTicksLow As Long
    lScanStartTicksHigh As Long
    lScanStartArgs(0 To 9) As Long
    lConvStartTrigType As Long
    lConvStartTicksLow As Long
    lConvStartTicksHigh As Long
    lConvStartArgs(0 To 9) As Long
    lScanStopTrigType As Long
    lScanStopCount As Long
    lScanStopArgs(0 To 9) As Long
    lAcqStopTrigType As Long
    lAcqStopCount As Long
    lAcqStopArgs(0 To 9) As Long
    lFlags As Long
End Type

Type meIOStreamStart
    lDevice As Long
    lSubdevice As Long
    lStartMode As Long
    lTimeOut As Long
    lFlags As Long
    lErrno As Long
End Type

Type meIOStreamStop
    lDevice As Long
    lSubdevice As Long
    lStopMode As Long
    lFlags As Long
    lErrno As Long
End Type

'*------------------------------------------------------------------------------+
'-------------------------------------------------------------------------------|
'                                                                               |
'                             me-iDS Functions                                  |
'                                                                               |
'-------------------------------------------------------------------------------|
'------------------------------------------------------------------------------*/

'===========================================================================
'  Functions to access the driver system
'=========================================================================*/

Declare Function meOpen Lib "meIDSmainVB.dll" Alias "_meOpen@4" (ByVal lFlags As Long) As Long

Declare Function meClose Lib "meIDSmainVB.dll" Alias "_meClose@4" (ByVal lFlags As Long) As Long

Declare Function meLockDriver Lib "meIDSmainVB.dll" Alias "_meLockDriver@8" (ByVal lLock As Long, ByVal lFlags As Long) As Long
Declare Function meLockDevice Lib "meIDSmainVB.dll" Alias "_meLockDevice@12" (ByVal lDevice As Long, ByVal lLock As Long, ByVal lFlags As Long) As Long
Declare Function meLockSubdevice Lib "meIDSmainVB.dll" Alias "_meLockSubdevice@16" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lLock As Long, ByVal lFlags As Long) As Long

'===========================================================================
'  Error handling functions
'=========================================================================*/

Declare Function meErrorGetLast Lib "meIDSmainVB.dll" Alias "_meErrorGetLast@8" (ByRef plErrorCode As Long, ByVal lFlags As Long) As Long
Declare Function meErrorGetLastMessage Lib "meIDSmainVB.dll" Alias "_meErrorGetLastMessage@8" (ByVal pcErrorMsg As String, ByVal lCount As Long) As Long
Declare Function meErrorGetMessage Lib "meIDSmainVB.dll" Alias "_meErrorGetMessage@12" (ByVal lErrorCode As Long, ByVal pcErrorMsg As String, ByVal lCount As Long) As Long
Declare Function meErrorSetDefaultProc Lib "meIDSmainVB.dll" Alias "_meErrorSetDefaultProc@4" (ByVal lSwitch As Long) As Long
' Declare Function meErrorSetUserProc Lib "meIDSmainVB.dll" Alias "_meErrorSetUserProc@4" (meErrorCB_t pErrorProc) As Long

'===========================================================================
' Functions to perform I/O on a device
'=========================================================================*/

' Declare Function meIOIrqSetCallback Lib "meIDSmainVB.dll" Alias "_meIOIrqSetCallback@20" (ByVal lDevice As Long, ByVal lSubdevice As Long, meIOIrqCB_t pCallback, void *pCallbackContext, ByVal lFlags As Long) As Long

Declare Function meIOIrqStart Lib "meIDSmainVB.dll" Alias "_meIOIrqStart@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lChannel As Long, ByVal lIrqSource As Long, ByVal lIrqEdge As Long, ByVal lIrqArg As Long, ByVal lFlags As Long) As Long

Declare Function meIOIrqStop Lib "meIDSmainVB.dll" Alias "_meIOIrqStop@16" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lChannel As Long, ByVal lFlags As Long) As Long

Declare Function meIOIrqWait Lib "meIDSmainVB.dll" Alias "_meIOIrqWait@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lChannel As Long, ByRef plIrqCount As Long, ByRef plValue As Long, ByVal lTimeOut As Long, ByVal lFlags As Long) As Long

Declare Function meIOResetDevice Lib "meIDSmainVB.dll" Alias "_meIOResetDevice@8" (ByVal lDevice As Long, ByVal lFlags As Long) As Long

Declare Function meIOResetSubdevice Lib "meIDSmainVB.dll" Alias "_meIOResetSubdevice@12" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamFrequencyToTicks Lib "meIDSmainVB.dll" Alias "_meIOStreamFrequencyToTicks@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lTimer As Long, ByRef pdFrequency As Double, ByRef plTicksLow As Long, ByRef plTicksHigh As Long, ByVal lFlags As Long) As Long

Declare Function meIOSingleConfig Lib "meIDSmainVB.dll" Alias "_meIOSingleConfig@36" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lChannel As Long, ByVal lSingleConfig As Long, ByVal lRef As Long, ByVal lTrigChan As Long, ByVal lTrigType As Long, ByVal lTrigEdge As Long, ByVal lFlags As Long) As Long

Declare Function meIOSingle Lib "meIDSmainVB.dll" Alias "_meIOSingle@12" (ByRef pSingleList As meIOSingle, ByVal lCount As Long, ByVal lFlag As Long) As Long

Declare Function meIOSingleTimeToTicks Lib "meIDSmainVB.dll" Alias "_meIOSingleTimeToTicks@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lTimer As Long, ByRef pdTime As Double, ByRef plTicksLow As Long, ByRef plTicksHigh As Long, ByVal lFlags As Long) As Long

Declare Function meIOSingleTicksToTime Lib "meIDSmainVB.dll" Alias "_meIOSingleTicksToTime@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lTimer As Long, ByVal lTicksLow As Long, ByVal lTicksHigh As Long, ByRef pdTime As Double, ByVal lFlags As Long) As Long

Declare Function meIOSetChannelOffset Lib "meIDSmainVB.dll" Alias "_meIOSetChannelOffset@24" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lChannel As Long, ByVal lRange As Long, ByRef pdOffset As Double, ByVal lFlags As Long) As Long

Declare Function meIOStreamConfig Lib "meIDSmainVB.dll" Alias "_meIOStreamConfig@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByRef pConfigList As meIOStreamConfig, ByVal lCount As Long, ByRef pTrigger As meIOStreamTrigger, ByVal lFifoIrqThreshold As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamRead Lib "meIDSmainVB.dll" Alias "_meIOStreamRead@24" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lReadMode As Long, ByRef plValues As Long, ByRef plCount As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamWrite Lib "meIDSmainVB.dll" Alias "_meIOStreamWrite@24" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lWriteMode As Long, ByRef plValues As Long, ByRef plCount As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamStart Lib "meIDSmainVB.dll" Alias "_meIOStreamStart@12" (ByRef pStartList As meIOStreamStart, ByVal lCount As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamStop Lib "meIDSmainVB.dll" Alias "_meIOStreamStop@12" (ByRef pStopList As meIOStreamStop, ByVal lCount As Long, ByVal lFlags As Long) As Long

Declare Function meIOStreamStatus Lib "meIDSmainVB.dll" Alias "_meIOStreamStatus@24" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lWait As Long, ByRef plStatus As Long, ByRef plCount As Long, ByVal lFlags As Long) As Long

' Declare Function meIOStreamSetCallbacks Lib "meIDSmainVB.dll" Alias "_meIOStreamSetCallbacks@36" (ByVal lDevice As Long, ByVal lSubdevice As Long, meIOStreamCB_t pStartCB, void *pStartCBContext, meIOStreamCB_t pNewValuesCB, void *pNewValuesCBContext, meIOStreamCB_t pEndCB, void *pEndCBContext, ByVal lFlags) As Long

Declare Function meIOStreamTimeToTicks Lib "meIDSmainVB.dll" Alias "_meIOStreamTimeToTicks@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lTimer As Long, ByRef pdTime As Double, ByRef plTicksLow As Long, ByRef plTicksHigh As Long, ByVal lFlags As Long) As Long

'===========================================================================
'  Functions to query the driver system
'=========================================================================*/

Declare Function meQueryDescriptionDevice Lib "meIDSmainVB.dll" Alias "_meQueryDescriptionDevice@12" (ByVal lDevice As Long, ByVal pcDescription As String, ByVal lCount As Long) As Long

Declare Function meQueryInfoDevice Lib "meIDSmainVB.dll" Alias "_meQueryInfoDevice@36" (ByVal lDevice As Long, ByRef plVendorId As Long, ByRef plDeviceId As Long, ByRef plSerialNo As Long, ByRef plBusType As Long, ByRef plBusNo As Long, ByRef plDevNo As Long, ByRef plFuncNo As Long, ByRef plPlugged As Long) As Long

Declare Function meQueryNameDevice Lib "meIDSmainVB.dll" Alias "_meQueryNameDevice@12" (ByVal lDevice As Long, ByVal pcName As String, ByVal lCount As Long) As Long

Declare Function meQueryNameDeviceDriver Lib "meIDSmainVB.dll" Alias "_meQueryNameDeviceDriver@12" (ByVal lDevice As Long, ByVal pcName As String, ByVal lCount As Long) As Long

Declare Function meQueryNumberDevices Lib "meIDSmainVB.dll" Alias "_meQueryNumberDevices@4" (ByRef plNumber As Long) As Long

Declare Function meQueryNumberSubdevices Lib "meIDSmainVB.dll" Alias "_meQueryNumberSubdevices@8" (ByVal lDevice As Long, ByRef plNumber As Long) As Long

Declare Function meQueryNumberChannels Lib "meIDSmainVB.dll" Alias "_meQueryNumberChannels@12" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByRef plNumber As Long) As Long

Declare Function meQueryNumberRanges Lib "meIDSmainVB.dll" Alias "_meQueryNumberRanges@16" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lUnit As Long, ByRef plNumber As Long) As Long

Declare Function meQueryRangeByMinMax Lib "meIDSmainVB.dll" Alias "_meQueryRangeByMinMax@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lUnit As Long, ByRef pdMin As Double, ByRef pdMax As Double, ByRef plMaxData As Long, ByRef plRange As Long) As Long

Declare Function meQueryRangeInfo Lib "meIDSmainVB.dll" Alias "_meQueryRangeInfo@28" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lRange As Long, ByRef plUnit As Long, ByRef pdMin As Double, ByRef pdMax As Double, ByRef plMaxData As Long) As Long

Declare Function meQuerySubdeviceByType Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceByType@20" (ByVal lDevice As Long, ByVal lStartSubdevice As Long, ByVal lType As Long, ByVal lSubtype As Long, ByRef plSubdevice As Long) As Long

Declare Function meQuerySubdeviceType Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceType@16" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByRef plType As Long, ByRef plSubtype As Long) As Long

Declare Function meQuerySubdeviceCaps Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceCaps@12" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByRef plCaps As Long) As Long

Declare Function meQuerySubdeviceCapsArgs Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceCapsArgs@20" (ByVal lDevice As Long, ByVal lSubdevice As Long, ByVal lCap As Long, ByRef plArgs, ByVal lCount As Long) As Long

Declare Function meQueryVersionLibrary Lib "meIDSmainVB.dll" Alias "_meQueryVersionLibrary@4" (ByRef plVersion As Long) As Long

Declare Function meQueryVersionMainDriver Lib "meIDSmainVB.dll" Alias "_meQueryVersionMainDriver@4" (ByRef plVersion As Long) As Long

Declare Function meQueryVersionDeviceDriver Lib "meIDSmainVB.dll" Alias "_meQueryVersionDeviceDriver@8" (ByVal lDevice As Long, ByRef plVersion As Long) As Long

'===========================================================================
'  Common utility functions
'=========================================================================*/

Declare Function meUtilityExtractValues Lib "meIDSmainVB.dll" Alias "_meUtilityExtractValues@28" (ByVal lChannel As Long, ByRef plAIBuffer As Long, ByVal lAIBufferCount As Long, ByRef pConfigList As meIOStreamConfig, ByVal lConfigListCount As Long, ByRef plChanBuffer As Long, ByRef plChanBufferCount As Long) As Long

Declare Function meUtilityDigitalToPhysical Lib "meIDSmainVB.dll" Alias "_meUtilityDigitalToPhysical@40" (ByVal dMin As Double, ByVal dMax As Double, ByVal lMaxData As Long, ByVal lData As Long, ByVal lModuleType As Long, ByVal dRefValue As Double, ByRef pdPhysical As Double) As Long

Declare Function meUtilityDigitalToPhysicalV Lib "meIDSmainVB.dll" Alias "_meUtilityDigitalToPhysicalV@44" (ByVal dMin As Double, ByVal dMax As Double, ByVal lMaxData As Long, ByRef plDataBuffer As Long, ByVal lCount As Long, ByVal lModuleType As Long, ByVal dRefValue As Double, ByRef pdPhysicalBuffer As Long) As Long

Declare Function meUtilityPhysicalToDigital Lib "meIDSmainVB.dll" Alias "_meUtilityPhysicalToDigital@32" (ByVal dMin As Double, ByVal dMax As Double, ByVal lMaxData As Long, ByVal dPhysical As Double, ByRef plData As Long) As Long

Declare Function meUtilityPhysicalToDigitalV Lib "meIDSmainVB.dll" Alias "_meUtilityPhysicalToDigitalV@32" (ByVal dMin As Double, ByVal dMax As Double, ByVal lMaxData As Long, ByRef pdPhysicalBuffer As Double, ByVal lCount As Long, ByRef plDataBuffer As Long) As Long

Declare Function meUtilityPWMStart Lib "meIDSmainVB.dll" Alias "_meUtilityPWMStart@32" (ByVal lDevice As Long, ByVal lSubdevice1 As Long, ByVal lSubdevice2 As Long, ByVal lSubdevice3 As Long, ByVal lRef As Long, ByVal lPrescaler As Long, ByVal lDutyCycle As Long, ByVal lFlag) As Long

Declare Function meUtilityPWMStop Lib "meIDSmainVB.dll" Alias "_meUtilityPWMStop@8" (ByVal lDevice As Long, ByVal lSubdevice1) As Long
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: MS Visual Basic 2005 Interface

  • ME-iDS API

MS Visual Basic 2005 Interface

'=====================================================================
'Copyright(c), Meilhaus Electronic GmbH
'              http://www.meilhaus.de
'              support@meilhaus.de
'
'Source File : meIDS.vb
'
'              THIS FILE IS DEPRECATED.
'
'Important   : For new projects it is recommended to use the meIDS.vb
'              in the folder "MS Visual Basic 2010" of the SDK
'Description : Constants, types and function prototypes of the ME-iDS API
'              for accessing the API in Visual Basic .NET using CallingConvention.StdCall
'Note        : import library for ME-iDS API, only 32bit available: meIDSmainVB.dll
'=====================================================================
Option Strict Off
Option Explicit On

Imports System.Runtime.InteropServices

Module Module1
    '-------------------------------------------------------------------------------
    '
    ' me-iDS Constants
    '
    '-------------------------------------------------------------------------------

    '================================================================
    '  General
    '================================================================

    Public Const ME_VALUE_NOT_USED As Integer = &H0S

    Public Const ME_VALUE_DEFAULT As Integer = &H0S

    Public Const ME_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines common to access functions
    '===============================================================

    Public Const ME_LOCK_RELEASE As Integer = &H10001
    Public Const ME_LOCK_SET As Integer = &H10002
    Public Const ME_LOCK_CHECK As Integer = &H10003

    '===============================================================
    '  Defines meOpen function
    '===============================================================

    Public Const ME_OPEN_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines meClose function
    '===============================================================

    Public Const ME_CLOSE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines meLockDriver function
    '===============================================================

    Public Const ME_LOCK_DRIVER_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines meLockDevice function
    '===============================================================

    Public Const ME_LOCK_DEVICE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines meLockSubdevice function
    '===============================================================

    Public Const ME_LOCK_SUBDEVICE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines common to error functions
    '===============================================================

    Public Const ME_ERROR_MSG_MAX_COUNT As Integer = 256

    '===============================================================
    '  Defines for meErrorSetDefaultProc function
    '===============================================================

    Public Const ME_SWITCH_DISABLE As Integer = &H20001
    Public Const ME_SWITCH_ENABLE As Integer = &H20002

    '===============================================================
    '  Defines common to io functions
    '===============================================================

    Public Const ME_REF_NONE As Integer = &H0
    Public Const ME_REF_DIO_FIFO_LOW As Integer = &H30001
    Public Const ME_REF_DIO_FIFO_HIGH As Integer = &H30002

    Public Const ME_REF_CTR_PREVIOUS As Integer = &H40001
    Public Const ME_REF_CTR_INTERNAL_1MHZ As Integer = &H40002
    Public Const ME_REF_CTR_INTERNAL_10MHZ As Integer = &H40003
    Public Const ME_REF_CTR_EXTERNAL As Integer = &H40004

    Public Const ME_REF_AI_GROUND As Integer = &H50001
    Public Const ME_REF_AI_DIFFERENTIAL As Integer = &H50002

    Public Const ME_REF_AO_GROUND As Integer = &H60001
    Public Const ME_REF_AO_DIFFERENTIAL As Integer = &H60002

    Public Const ME_TRIG_CHAN_DEFAULT As Integer = &H70001
    Public Const ME_TRIG_CHAN_SYNCHRONOUS As Integer = &H70002

    Public Const ME_TRIG_TYPE_NONE As Integer = ME_VALUE_NOT_USED
    Public Const ME_TRIG_TYPE_SW As Integer = &H80001
    Public Const ME_TRIG_TYPE_THRESHOLD As Integer = &H80002
    Public Const ME_TRIG_TYPE_WINDOW As Integer = &H80003
    Public Const ME_TRIG_TYPE_EDGE As Integer = &H80004
    Public Const ME_TRIG_TYPE_SLOPE As Integer = &H80005
    Public Const ME_TRIG_TYPE_EXT_DIGITAL As Integer = &H80006
    Public Const ME_TRIG_TYPE_EXT_ANALOG As Integer = &H80007
    Public Const ME_TRIG_TYPE_PATTERN As Integer = &H80008
    Public Const ME_TRIG_TYPE_TIMER As Integer = &H80009
    Public Const ME_TRIG_TYPE_COUNT As Integer = &H8000A
    Public Const ME_TRIG_TYPE_FOLLOW As Integer = &H8000B

    Public Const ME_TRIG_EDGE_NONE As Integer = ME_VALUE_NOT_USED
    Public Const ME_TRIG_EDGE_ABOVE As Integer = &H90001
    Public Const ME_TRIG_EDGE_BELOW As Integer = &H90002
    Public Const ME_TRIG_EDGE_ENTRY As Integer = &H90003
    Public Const ME_TRIG_EDGE_EXIT As Integer = &H90004
    Public Const ME_TRIG_EDGE_RISING As Integer = &H90005
    Public Const ME_TRIG_EDGE_FALLING As Integer = &H90006
    Public Const ME_TRIG_EDGE_ANY As Integer = &H90007

    Public Const ME_TIMER_ACQ_START As Integer = &HA0001
    Public Const ME_TIMER_SCAN_START As Integer = &HA0002
    Public Const ME_TIMER_CONV_START As Integer = &HA0003
    Public Const ME_TIMER_FIO_TOTAL As Integer = &HA0004
    Public Const ME_TIMER_FIO_FIRST_PHASE As Integer = &HA0005

    '===============================================================
    '  Defines for meIOFrequencyToTicks function
    '===============================================================

    Public Const ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_FREQUENCY_TO_TICKS_NO_FLAGS = ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS
    Public Const ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE As Integer = &H1S

    '===============================================================
    '  Defines for meIOIrqStart function
    '===============================================================

    Public Const ME_IRQ_SOURCE_DIO_PATTERN As Integer = &HB0001
    Public Const ME_IRQ_SOURCE_DIO_MASK As Integer = &HB0002
    Public Const ME_IRQ_SOURCE_DIO_LINE As Integer = &HB0003
    Public Const ME_IRQ_SOURCE_DIO_OVER_TEMP As Integer = &HB0004
    Public Const ME_IRQ_SOURCE_DIO_NORMAL_TEMP As Integer = &HB0005
    Public Const ME_IRQ_SOURCE_DIO_CHANGE_TEMP As Integer = &HB0006

    Public Const ME_IRQ_EDGE_NOT_USED As Integer = ME_VALUE_NOT_USED
    Public Const ME_IRQ_EDGE_RISING As Integer = &HC0001
    Public Const ME_IRQ_EDGE_FALLING As Integer = &HC0002
    Public Const ME_IRQ_EDGE_ANY As Integer = &HC0003

    Public Const ME_IO_IRQ_START_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_IRQ_START_DIO_BIT As Integer = &H1S
    Public Const ME_IO_IRQ_START_DIO_BYTE As Integer = &H2S
    Public Const ME_IO_IRQ_START_DIO_WORD As Integer = &H4S
    Public Const ME_IO_IRQ_START_DIO_DWORD As Integer = &H8S
    Public Const ME_IO_IRQ_START_PATTERN_FILTERING As Integer = &H10S
    Public Const ME_IO_IRQ_START_EXTENDED_STATUS As Integer = &H20S
    Public Const ME_IO_IRQ_START_USE_PROPERTIES As Integer = &H40000000

    '===============================================================
    '  Defines for meIOIrqWait function
    '===============================================================

    Public Const ME_IO_IRQ_WAIT_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_IRQ_WAIT_NORMAL_STATUS As Integer = &H1S
    Public Const ME_IO_IRQ_WAIT_EXTENDED_STATUS As Integer = &H2S

    '===============================================================
    '  Defines for meIOIrqStop function
    '===============================================================

    Public Const ME_IO_IRQ_STOP_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOIrqSetCallback function
    '===============================================================

    Public Const ME_IO_IRQ_SET_CALLBACK_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOResetDevice function
    '===============================================================

    Public Const ME_IO_RESET_DEVICE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOResetSubdevice function
    '===============================================================

    Public Const ME_IO_RESET_SUBDEVICE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOSingleConfig function
    '===============================================================

    Public Const ME_SINGLE_CONFIG_DIO_INPUT As Integer = &HD0001
    Public Const ME_SINGLE_CONFIG_DIO_OUTPUT As Integer = &HD0002
    Public Const ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE As Integer = &HD0003
    Public Const ME_SINGLE_CONFIG_DIO_SINK As Integer = &HD0004
    Public Const ME_SINGLE_CONFIG_DIO_SOURCE As Integer = &HD0005
    Public Const ME_SINGLE_CONFIG_DIO_MUX32M As Integer = &HD0006
    Public Const ME_SINGLE_CONFIG_DIO_DEMUX32 As Integer = &HD0007
    Public Const ME_SINGLE_CONFIG_DIO_BIT_PATTERN As Integer = &HD0008

    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_0 As Integer = &HE0001
    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_1 As Integer = &HE0002
    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_2 As Integer = &HE0003
    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_3 As Integer = &HE0004
    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_4 As Integer = &HE0005
    Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_5 As Integer = &HE0006

    Public Const ME_IO_SINGLE_CONFIG_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_SINGLE_CONFIG_DIO_BIT As Integer = &H1S
    Public Const ME_IO_SINGLE_CONFIG_DIO_BYTE As Integer = &H2S
    Public Const ME_IO_SINGLE_CONFIG_DIO_WORD As Integer = &H4S
    Public Const ME_IO_SINGLE_CONFIG_DIO_DWORD As Integer = &H8S
    Public Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON As Integer = &H10S
    Public Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF As Integer = &H20S
    Public Const ME_IO_SINGLE_CONFIG_AI_RMS As Integer = &H40S

    '===============================================================
    '  Defines for meIOSingle function
    '===============================================================

    Public Const ME_IO_SINGLE_NO_FLAGS As Integer = &H0S

    Public Const ME_DIR_INPUT As Integer = &HF0001
    Public Const ME_DIR_OUTPUT As Integer = &HF0002
    Public Const ME_DIR_SET_OFFSET As Integer = &HF0003

    Public Const ME_IO_SINGLE_TYPE_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_SINGLE_TYPE_DIO_BIT As Integer = &H1S
    Public Const ME_IO_SINGLE_TYPE_DIO_BYTE As Integer = &H2S
    Public Const ME_IO_SINGLE_TYPE_DIO_WORD As Integer = &H4S
    Public Const ME_IO_SINGLE_TYPE_DIO_DWORD As Integer = &H8S
    Public Const ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS As Integer = &H10S
    Public Const ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING As Integer = &H20S

    Public Const ME_IO_SINGLE_TYPE_FIO_DIVIDER As Integer = &H40
    Public Const ME_IO_SINGLE_TYPE_FO_START_LOW As Integer = &H80
    Public Const ME_IO_SINGLE_TYPE_FO_START_SOFT As Integer = &H100
    Public Const ME_IO_SINGLE_TYPE_FI_LAST_VALUE As Integer = &H200
    Public Const ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY As Integer = &H200
    Public Const ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL As Integer = &H400
    Public Const ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE As Integer = &H800

    '==================================================================
    '  Defines for meIOSingleTimeToTicks function
    '==================================================================

    Public Const ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS As Integer = &H0S

    '==================================================================
    '  Defines for meIOSingleTicksToTime function
    '==================================================================

    Public Const ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOSetChannelOffset function
    '===============================================================

    Public Const ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamConfig function
    '===============================================================

    Public Const ME_IO_STREAM_CONFIG_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_CONFIG_BIT_PATTERN As Integer = &H1S
    Public Const ME_IO_STREAM_CONFIG_WRAPAROUND As Integer = &H2S
    Public Const ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD As Integer = &H4S

    Public Const ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS As Integer = &H0S

    Public Const ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamRead function
    '===============================================================

    Public Const ME_READ_MODE_BLOCKING As Integer = &H100001
    Public Const ME_READ_MODE_NONBLOCKING As Integer = &H100002

    Public Const ME_IO_STREAM_READ_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_READ_FRAMES As Integer = &H1S

    '===============================================================
    '  Defines for meIOStreamWrite function
    '===============================================================

    Public Const ME_WRITE_MODE_BLOCKING As Integer = &H110001
    Public Const ME_WRITE_MODE_NONBLOCKING As Integer = &H110002
    Public Const ME_WRITE_MODE_PRELOAD As Integer = &H110003

    Public Const ME_IO_STREAM_WRITE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamStart function
    '===============================================================

    Public Const ME_IO_STREAM_START_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_START_NONBLOCKING As Integer = &H20S

    Public Const ME_START_MODE_BLOCKING As Integer = &H120001
    Public Const ME_START_MODE_NONBLOCKING As Integer = &H120002

    Public Const ME_IO_STREAM_START_TYPE_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS As Integer = &H1S

    '===============================================================
    '  Defines for meIOStreamStop function
    '===============================================================

    Public Const ME_IO_STREAM_STOP_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_STOP_NONBLOCKING As Integer = &H20S

    Public Const ME_STOP_MODE_IMMEDIATE As Integer = &H130001
    Public Const ME_STOP_MODE_LAST_VALUE As Integer = &H130002

    Public Const ME_IO_STREAM_STOP_TYPE_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamStatus function
    '===============================================================

    Public Const ME_WAIT_NONE As Integer = &H140001
    Public Const ME_WAIT_IDLE As Integer = &H140002
    Public Const ME_WAIT_BUSY As Integer = &H140003

    Public Const ME_STATUS_INVALID As Integer = &H0S
    Public Const ME_STATUS_IDLE As Integer = &H150001
    Public Const ME_STATUS_BUSY As Integer = &H150002
    Public Const ME_STATUS_ERROR As Integer = &H150003

    Public Const ME_IO_STREAM_STATUS_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamSetCallbacks function
    '===============================================================

    Public Const ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS As Integer = &H0S

    '===============================================================
    '  Defines for meIOStreamTimeToTicks function
    '===============================================================

    Public Const ME_IO_TIME_TO_TICKS_NO_FLAGS As Integer = &H0S
    Public Const ME_IO_STREAM_TIME_TO_TICKS_NO_FLAGS = ME_IO_TIME_TO_TICKS_NO_FLAGS
    Public Const ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE As Integer = &H1S

    '===============================================================
    '  Defines for module types
    '===============================================================

    Public Const ME_MODULE_TYPE_MULTISIG_NONE As Integer = &H0S
    Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_10V As Integer = &H160001
    Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_20V As Integer = &H160002
    Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_50V As Integer = &H160003
    Public Const ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA As Integer = &H160004
    Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT100 As Integer = &H160005
    Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT500 As Integer = &H160006
    Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT1000 As Integer = &H160007
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B As Integer = &H160008
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E As Integer = &H160009
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J As Integer = &H16000A
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K As Integer = &H16000B
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N As Integer = &H16000C
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R As Integer = &H16000D
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S As Integer = &H16000E
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T As Integer = &H16000F
    Public Const ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR As Integer = &H160010

    '===============================================================
    '  Defines for meQuerySubdeviceCaps function
    '===============================================================

    Public Const ME_CAPS_DIO_DIR_BIT As Integer = &H1S
    Public Const ME_CAPS_DIO_DIR_BYTE As Integer = &H2S
    Public Const ME_CAPS_DIO_DIR_WORD As Integer = &H4S
    Public Const ME_CAPS_DIO_DIR_DWORD As Integer = &H8S
    Public Const ME_CAPS_DIO_SINK_SOURCE As Integer = &H10S
    Public Const ME_CAPS_DIO_BIT_PATTERN_IRQ As Integer = &H20S
    Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING As Integer = &H40S
    Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING As Integer = &H80S
    Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY As Integer = &H100S
    Public Const ME_CAPS_DIO_OVER_TEMP_IRQ As Integer = &H200S
    Public Const ME_CAPS_DIO_NORMAL_TEMP_IRQ As Integer = &H400S

    Public Const ME_CAPS_CTR_CLK_PREVIOUS As Integer = &H1S
    Public Const ME_CAPS_CTR_CLK_INTERNAL_1MHZ As Integer = &H2S
    Public Const ME_CAPS_CTR_CLK_INTERNAL_10MHZ As Integer = &H4S
    Public Const ME_CAPS_CTR_CLK_EXTERNAL As Integer = &H8S

    Public Const ME_CAPS_AI_TRIG_SIMULTANEOUS As Integer = &H1S
    Public Const ME_CAPS_AI_FIFO As Integer = &H2S
    Public Const ME_CAPS_AI_FIFO_THRESHOLD As Integer = &H4S
    Public Const ME_CAPS_AI_SAMPLE_HOLD As Integer = &H8S

    Public Const ME_CAPS_AO_TRIG_SIMULTANEOUS As Integer = &H1S
    Public Const ME_CAPS_AO_FIFO As Integer = &H2S
    Public Const ME_CAPS_AO_FIFO_THRESHOLD As Integer = &H4S

    Public Const ME_CAPS_FIO_SINK_SOURCE As Integer = &H1S

    Public Const ME_CAPS_EXT_IRQ_EDGE_RISING As Integer = &H1S
    Public Const ME_CAPS_EXT_IRQ_EDGE_FALLING As Integer = &H2S
    Public Const ME_CAPS_EXT_IRQ_EDGE_ANY As Integer = &H4S

    '===============================================================
    '  Defines for meQuerySubdeviceCapsArgs function
    '===============================================================

    Public Const ME_CAP_AI_FIFO_SIZE As Integer = &H1D0000
    Public Const ME_CAP_AI_BUFFER_SIZE As Integer = &H1D0001
    Public Const ME_CAP_AI_CHANNEL_LIST_SIZE As Integer = &H1D0002
    Public Const ME_CAP_AI_MAX_THRESHOLD_SIZE As Integer = &H1D0003

    Public Const ME_CAP_AO_FIFO_SIZE As Integer = &H1F0000
    Public Const ME_CAP_AO_BUFFER_SIZE As Integer = &H1F0001
    Public Const ME_CAP_AO_CHANNEL_LIST_SIZE As Integer = &H1F0002
    Public Const ME_CAP_AO_MAX_THRESHOLD_SIZE As Integer = &H1F0003

    Public Const ME_CAP_CTR_WIDTH As Integer = &H200000

    Public Const ME_CAP_FPGA_IN_BUFFER_SIZE As Integer = &H300001
    Public Const ME_CAP_FPGA_OUT_FIFO_SIZE As Integer = &H300002
    Public Const ME_CAP_FPGA_OUT_BUFFER_SIZE As Integer = &H300003

    '===============================================================
    '  Defines common to query functions
    '===============================================================

    Public Const ME_UNIT_INVALID As Integer = &H0S
    Public Const ME_UNIT_VOLT As Integer = &H170001
    Public Const ME_UNIT_AMPERE As Integer = &H170002
    Public Const ME_UNIT_ANY As Integer = &H170003
    Public Const ME_UNIT_HZ As Integer = &H170004

    Public Const ME_TYPE_INVALID As Integer = &H0S
    Public Const ME_TYPE_AO As Integer = &H180001
    Public Const ME_TYPE_AI As Integer = &H180002
    Public Const ME_TYPE_DIO As Integer = &H180003
    Public Const ME_TYPE_DO As Integer = &H180004
    Public Const ME_TYPE_DI As Integer = &H180005
    Public Const ME_TYPE_CTR As Integer = &H180006
    Public Const ME_TYPE_EXT_IRQ As Integer = &H180007
    Public Const ME_TYPE_FIO As Integer = &H180008
    Public Const ME_TYPE_FO As Integer = &H180009
    Public Const ME_TYPE_FI As Integer = &H18000A
    Public Const ME_TYPE_FPGA As Integer = &H18000B

    Public Const ME_SUBTYPE_INVALID As Integer = &H0S
    Public Const ME_SUBTYPE_SINGLE As Integer = &H190001
    Public Const ME_SUBTYPE_STREAMING As Integer = &H190002
    Public Const ME_SUBTYPE_CTR_8254 As Integer = &H190003
    Public Const ME_SUBTYPE_ANY As Integer = &H190004

    Public Const ME_DEVICE_DRIVER_NAME_MAX_COUNT As Integer = 64
    Public Const ME_DEVICE_NAME_MAX_COUNT As Integer = 64

    Public Const ME_DEVICE_DESCRIPTION_MAX_COUNT As Integer = 256

    Public Const ME_BUS_TYPE_INVALID As Integer = &H0S
    Public Const ME_BUS_TYPE_ANY As Integer = &H1A0000    'ME_BUS_TYPE_ANY only for checking bus
    Public Const ME_BUS_TYPE_PCI As Integer = &H1A0001
    Public Const ME_BUS_TYPE_USB As Integer = &H1A0002
    Public Const ME_BUS_TYPE_LAN_PCI As Integer = &H1A0101
    Public Const ME_BUS_TYPE_LAN_USB As Integer = &H1A0102

    Public Const ME_PLUGGED_INVALID As Integer = &H0S
    Public Const ME_PLUGGED_ANY As Integer = &H1B0000     'ME_PLUGGED_ANY only for checking status
    Public Const ME_PLUGGED_IN As Integer = &H1B0001
    Public Const ME_PLUGGED_OUT As Integer = &H1B0002

    Public Const ME_EXTENSION_TYPE_INVALID As Integer = &H0S
    Public Const ME_EXTENSION_TYPE_NONE As Integer = &H1C0001
    Public Const ME_EXTENSION_TYPE_MUX32M As Integer = &H1C0002
    Public Const ME_EXTENSION_TYPE_DEMUX32 As Integer = &H1C0003
    Public Const ME_EXTENSION_TYPE_MUX32S As Integer = &H1C0004
    Public Const ME_EXTENSION_TYPE_ME1001 As Integer = &H1C0005

    Public Const ME_ACCESS_TYPE_INVALID As Integer = &H0S
    Public Const ME_ACCESS_TYPE_ANY As Integer = &H1D0000
    Public Const ME_ACCESS_TYPE_LOCAL As Integer = &H1D0001
    Public Const ME_ACCESS_TYPE_REMOTE As Integer = &H1D0002

    '===============================================================
    '  Defines for ConfigLoad
    '===============================================================

    Public Const ME_CONF_LOAD_CUSTOM_DRIVER As Integer = &H1000

    '==================================================================
    '  Defines for FPGA device
    '==================================================================

    Public Const ME_FPGA_FIRMWARE As UInt32 = &HFF000001UI
    Public Const ME_FPGA_SUBDEVICE As UInt32 = &HFF000002UI

    '==================================================================
    '  Defines for meUtilityPWM
    '==================================================================

    Public Const ME_PWM_START_NO_FLAGS As Integer = &H0
    Public Const ME_PWM_START_CONNECT_INTERNAL As Integer = &H1

    '==================================================================
    '  Defines of flags for error handling
    '==================================================================

    Public Const ME_ERRNO_CLEAR_FLAGS As Integer = &H1

    '-------------------------------------------------------------------------------
    '
    '                             me-iDS Types
    '
    '-------------------------------------------------------------------------------

    Structure meIOSingle_t
        Dim iDevice As Integer
        Dim iSubdevice As Integer
        Dim iChannel As Integer
        Dim iDir As Integer
        Dim iValue As Integer
        Dim iTimeOut As Integer
        Dim iFlags As Integer
        Dim iErrno As Integer
    End Structure

    Structure meIOStreamConfig_t
        Dim iChannel As Integer
        Dim iStreamConfig As Integer
        Dim iRef As Integer
        Dim iFlags As Integer
    End Structure

    <StructLayout(LayoutKind.Sequential)> Structure meIOStreamTrigger
        Dim iAcqStartTrigType As Integer
        Dim iAcqStartTrigEdge As Integer
        Dim iAcqStartTrigChan As Integer
        Dim iAcqStartTicksLow As Integer
        Dim iAcqStartTicksHigh As Integer
        <VBFixedArray(9), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=10)> Dim iAcqStartArgs() As Integer
        Dim iScanStartTrigType As Integer
        Dim iScanStartTicksLow As Integer
        Dim iScanStartTicksHigh As Integer
        <VBFixedArray(9), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=10)> Dim iScanStartArgs() As Integer
        Dim iConvStartTrigType As Integer
        Dim iConvStartTicksLow As Integer
        Dim iConvStartTicksHigh As Integer
        <VBFixedArray(9), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=10)> Dim iConvStartArgs() As Integer
        Dim iScanStopTrigType As Integer
        Dim iScanStopCount As Integer
        <VBFixedArray(9), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=10)> Dim iScanStopArgs() As Integer
        Dim iAcqStopTrigType As Integer
        Dim iAcqStopCount As Integer
        <VBFixedArray(9), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=10)> Dim iAcqStopArgs() As Integer
        Dim iFlags As Integer

        'UPGRADE_TODO: "Initialize" must be called to initialize instances of this structure. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B4BFF9E0-8631-45CF-910E-62AB3970F27B"'
        Public Sub Initialize()
            ReDim iAcqStartArgs(9)
            ReDim iScanStartArgs(9)
            ReDim iConvStartArgs(9)
            ReDim iScanStopArgs(9)
            ReDim iAcqStopArgs(9)
        End Sub
    End Structure

    Structure meIOStreamStart_t
        Dim iDevice As Integer
        Dim iSubdevice As Integer
        Dim iStartMode As Integer
        Dim iTimeOut As Integer
        Dim iFlags As Integer
        Dim iErrno As Integer
    End Structure

    Structure meIOStreamStop_t
        Dim iDevice As Integer
        Dim iSubdevice As Integer
        Dim iStopMode As Integer
        Dim iFlags As Integer
        Dim iErrno As Integer
    End Structure

    '-------------------------------------------------------------------------------
    '
    ' ME-iDS Error Codes
    '
    '-------------------------------------------------------------------------------

    Public Const ME_ERRNO_SUCCESS As Integer = 0
    Public Const ME_ERRNO_INVALID_DEVICE As Integer = 1
    Public Const ME_ERRNO_INVALID_SUBDEVICE As Integer = 2
    Public Const ME_ERRNO_INVALID_CHANNEL As Integer = 3
    Public Const ME_ERRNO_INVALID_SINGLE_CONFIG As Integer = 4
    Public Const ME_ERRNO_INVALID_REF As Integer = 5
    Public Const ME_ERRNO_INVALID_TRIG_CHAN As Integer = 6
    Public Const ME_ERRNO_INVALID_TRIG_TYPE As Integer = 7
    Public Const ME_ERRNO_INVALID_TRIG_EDGE As Integer = 8
    Public Const ME_ERRNO_INVALID_TIMEOUT As Integer = 9
    Public Const ME_ERRNO_INVALID_FLAGS As Integer = 10
    Public Const ME_ERRNO_OPEN As Integer = 11
    Public Const ME_ERRNO_CLOSE As Integer = 12
    Public Const ME_ERRNO_NOT_OPEN As Integer = 13
    Public Const ME_ERRNO_INVALID_DIR As Integer = 14
    Public Const ME_ERRNO_PREVIOUS_CONFIG As Integer = 15
    Public Const ME_ERRNO_NOT_SUPPORTED As Integer = 16
    Public Const ME_ERRNO_SUBDEVICE_TYPE As Integer = 17
    Public Const ME_ERRNO_USER_BUFFER_SIZE As Integer = 18
    Public Const ME_ERRNO_LOCKED As Integer = 19
    Public Const ME_ERRNO_NO_MORE_SUBDEVICE_TYPE As Integer = 20
    Public Const ME_ERRNO_TIMEOUT As Integer = 21
    Public Const ME_ERRNO_SIGNAL As Integer = 22
    Public Const ME_ERRNO_INVALID_IRQ_SOURCE As Integer = 23
    Public Const ME_ERRNO_THREAD_RUNNING As Integer = 24
    Public Const ME_ERRNO_START_THREAD As Integer = 25
    Public Const ME_ERRNO_CANCEL_THREAD As Integer = 26
    Public Const ME_ERRNO_NO_CALLBACK As Integer = 27
    Public Const ME_ERRNO_USED As Integer = 28
    Public Const ME_ERRNO_INVALID_UNIT As Integer = 29
    Public Const ME_ERRNO_INVALID_MIN_MAX As Integer = 30
    Public Const ME_ERRNO_NO_RANGE As Integer = 31
    Public Const ME_ERRNO_INVALID_RANGE As Integer = 32
    Public Const ME_ERRNO_SUBDEVICE_BUSY As Integer = 33
    Public Const ME_ERRNO_INVALID_LOCK As Integer = 34
    Public Const ME_ERRNO_INVALID_SWITCH As Integer = 35
    Public Const ME_ERRNO_INVALID_ERROR_MSG_COUNT As Integer = 36
    Public Const ME_ERRNO_INVALID_STREAM_CONFIG As Integer = 37
    Public Const ME_ERRNO_INVALID_CONFIG_LIST_COUNT As Integer = 38
    Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE As Integer = 39
    Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE As Integer = 40
    Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN As Integer = 41
    Public Const ME_ERRNO_INVALID_ACQ_START_TIMEOUT As Integer = 42
    Public Const ME_ERRNO_INVALID_ACQ_START_ARG As Integer = 43
    Public Const ME_ERRNO_INVALID_SCAN_START_TRIG_TYPE As Integer = 44
    Public Const ME_ERRNO_INVALID_SCAN_START_ARG As Integer = 45
    Public Const ME_ERRNO_INVALID_CONV_START_TRIG_TYPE As Integer = 46
    Public Const ME_ERRNO_INVALID_CONV_START_ARG As Integer = 47
    Public Const ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE As Integer = 48
    Public Const ME_ERRNO_INVALID_SCAN_STOP_ARG As Integer = 49
    Public Const ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE As Integer = 50
    Public Const ME_ERRNO_INVALID_ACQ_STOP_ARG As Integer = 51
    Public Const ME_ERRNO_SUBDEVICE_NOT_RUNNING As Integer = 52
    Public Const ME_ERRNO_INVALID_READ_MODE As Integer = 53
    Public Const ME_ERRNO_INVALID_VALUE_COUNT As Integer = 54
    Public Const ME_ERRNO_INVALID_WRITE_MODE As Integer = 55
    Public Const ME_ERRNO_INVALID_TIMER As Integer = 56
    Public Const ME_ERRNO_DEVICE_UNPLUGGED As Integer = 57
    Public Const ME_ERRNO_USED_INTERNAL As Integer = 58
    Public Const ME_ERRNO_INVALID_DUTY_CYCLE As Integer = 59
    Public Const ME_ERRNO_INVALID_WAIT As Integer = 60
    Public Const ME_ERRNO_CONNECT_REMOTE As Integer = 61
    Public Const ME_ERRNO_COMMUNICATION As Integer = 62
    Public Const ME_ERRNO_INVALID_SINGLE_LIST As Integer = 63
    Public Const ME_ERRNO_INVALID_MODULE_TYPE As Integer = 64
    Public Const ME_ERRNO_INVALID_START_MODE As Integer = 65
    Public Const ME_ERRNO_INVALID_STOP_MODE As Integer = 66
    Public Const ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD As Integer = 67
    Public Const ME_ERRNO_INVALID_POINTER As Integer = 68
    Public Const ME_ERRNO_CREATE_EVENT As Integer = 69
    Public Const ME_ERRNO_LACK_OF_RESOURCES As Integer = 70
    Public Const ME_ERRNO_CANCELLED As Integer = 71
    Public Const ME_ERRNO_RING_BUFFER_OVERFLOW As Integer = 72
    Public Const ME_ERRNO_SOFTWARE_BUFFER_OVERFLOW As Integer = ME_ERRNO_RING_BUFFER_OVERFLOW
    Public Const ME_ERRNO_RING_BUFFER_UNDERFLOW As Integer = 73
    Public Const ME_ERRNO_SOFTWARE_BUFFER_UNDERFLOW As Integer = ME_ERRNO_RING_BUFFER_UNDERFLOW
    Public Const ME_ERRNO_INVALID_IRQ_EDGE As Integer = 74
    Public Const ME_ERRNO_INVALID_IRQ_ARG As Integer = 75
    Public Const ME_ERRNO_INVALID_CAP As Integer = 76
    Public Const ME_ERRNO_INVALID_CAP_ARG_COUNT As Integer = 77
    Public Const ME_ERRNO_INTERNAL As Integer = 78
    Public Const ME_ERRNO_VALUE_OUT_OF_RANGE As Integer = 79
    Public Const ME_ERRNO_HARDWARE_FIFO_OVERFLOW As Integer = 80
    Public Const ME_ERRNO_HARDWARE_BUFFER_OVERFLOW As Integer = ME_ERRNO_HARDWARE_FIFO_OVERFLOW
    Public Const ME_ERRNO_HARDWARE_FIFO_UNDERFLOW As Integer = 81
    Public Const ME_ERRNO_HARDWARE_BUFFER_UNDERFLOW As Integer = ME_ERRNO_HARDWARE_FIFO_UNDERFLOW
    Public Const ME_ERRNO_CONFIG_LOAD_FAILED As Integer = 82
    Public Const ME_ERRNO_PROPERTY_CONTAINER As Integer = 83
    Public Const ME_ERRNO_PROPERTY_NOT_A_CONTAINER As Integer = 84
    Public Const ME_ERRNO_PROPERTY_DATA_TYPE As Integer = 85
    Public Const ME_ERRNO_PROPERTY_PATH As Integer = 86
    Public Const ME_ERRNO_PROPERTY_INDEX As Integer = 87
    Public Const ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL As Integer = 88
    Public Const ME_ERRNO_PROPERTY_UNKNOWN As Integer = 89
    Public Const ME_ERRNO_PROPERTY_ATTRIBUTE_UNKNOWN As Integer = 90
    Public Const ME_ERRNO_PROPERTY_ATTRIBUTE_UNSUPPORTED As Integer = 91
    Public Const ME_ERRNO_PROPERTY_SELECTION_INVALID As Integer = 92
    Public Const ME_ERRNO_PROPERTY_VALUE_INVALID As Integer = 93
    Public Const ME_ERRNO_PROPERTY_READ_ONLY As Integer = 94

    '=======================================================================
    '  ME_ERRNO_INVALID_ERROR_NUMBER is always the error constant
    '  with the greatest number when new error codes are added
    '=======================================================================
    Public Const ME_ERRNO_INVALID_ERROR_NUMBER As Integer = 95

    '-------------------------------------------------------------------------------
    '
    '                             ME-iDS Functions
    '
    '-------------------------------------------------------------------------------

    '==================================================================
    '  Functions to access the driver system
    '==================================================================

    Declare Function meOpen Lib "meIDSmainVB.dll" Alias "_meOpen@4" (ByVal iFlags As Integer) As Integer

    Declare Function meClose Lib "meIDSmainVB.dll" Alias "_meClose@4" (ByVal iFlags As Integer) As Integer

    Declare Function meLockDriver Lib "meIDSmainVB.dll" Alias "_meLockDriver@8" (ByVal iLock As Integer, ByVal iFlags As Integer) As Integer
    Declare Function meLockDevice Lib "meIDSmainVB.dll" Alias "_meLockDevice@12" (ByVal iDevice As Integer, ByVal iLock As Integer, ByVal iFlags As Integer) As Integer
    Declare Function meLockSubdevice Lib "meIDSmainVB.dll" Alias "_meLockSubdevice@16" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iLock As Integer, ByVal iFlags As Integer) As Integer

    '==================================================================
    '  Error handling functions
    '==================================================================

    Declare Function meErrorGetLast Lib "meIDSmainVB.dll" Alias "_meErrorGetLast@8" (ByRef piErrorCode As Integer, ByVal iFlags As Integer) As Integer
    Declare Function meErrorGetLastMessage Lib "meIDSmainVB.dll" Alias "_meErrorGetLastMessage@8" (ByVal pcErrorMsg As String, ByVal iCount As Integer) As Integer
    Declare Function meErrorGetMessage Lib "meIDSmainVB.dll" Alias "_meErrorGetMessage@12" (ByVal iErrorCode As Integer, ByVal pcErrorMsg As String, ByVal iCount As Integer) As Integer
    Declare Function meErrorSetDefaultProc Lib "meIDSmainVB.dll" Alias "_meErrorSetDefaultProc@4" (ByVal iSwitch As Integer) As Integer
    ' Declare Function meErrorSetUserProc Lib "meIDSmainVB.dll" Alias "_meErrorSetUserProc@4" (meErrorCB_t pErrorProc) As Long

    '==================================================================
    ' Functions to perform I/O on a device
    '==================================================================

    ' Declare Function meIOIrqSetCallback Lib "meIDSmainVB.dll" Alias "_meIOIrqSetCallback@20" (ByVal iDevice As Long, ByVal iSubdevice As Long, meIOIrqCB_t pCallback, void *pCallbackContext, ByVal iFlags As Long) As Long

    Declare Function meIOIrqStart Lib "meIDSmainVB.dll" Alias "_meIOIrqStart@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iChannel As Integer, ByVal iIrqSource As Integer, ByVal iIrqEdge As Integer, ByVal iIrqArg As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOIrqStop Lib "meIDSmainVB.dll" Alias "_meIOIrqStop@16" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iChannel As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOIrqWait Lib "meIDSmainVB.dll" Alias "_meIOIrqWait@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iChannel As Integer, ByRef plIrqCount As Integer, ByRef plValue As Integer, ByVal iTimeOut As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOResetDevice Lib "meIDSmainVB.dll" Alias "_meIOResetDevice@8" (ByVal iDevice As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOResetSubdevice Lib "meIDSmainVB.dll" Alias "_meIOResetSubdevice@12" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOStreamFrequencyToTicks Lib "meIDSmainVB.dll" Alias "_meIOStreamFrequencyToTicks@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iTimer As Integer, ByRef pdFrequency As Double, ByRef plTicksLow As Integer, ByRef plTicksHigh As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOSingleConfig Lib "meIDSmainVB.dll" Alias "_meIOSingleConfig@36" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iChannel As Integer, ByVal iSingleConfig As Integer, ByVal iRef As Integer, ByVal iTrigChan As Integer, ByVal iTrigType As Integer, ByVal iTrigEdge As Integer, ByVal iFlags As Integer) As Integer

    'UPGRADE_WARNING: Structure meIOSingle may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    Declare Function meIOSingle Lib "meIDSmainVB.dll" Alias "_meIOSingle@12" (ByRef pSingleList As meIOSingle_t, ByVal iCount As Integer, ByVal iFlag As Integer) As Integer

    Declare Function meIOSingleTimeToTicks Lib "meIDSmainVB.dll" Alias "_meIOSingleTimeToTicks@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iTimer As Integer, ByRef pdTime As Double, ByRef piTicksLow As Integer, ByRef piTicksHigh As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOSingleTicksToTime Lib "meIDSmainVB.dll" Alias "_meIOSingleTicksToTime@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iTimer As Integer, ByVal iTicksLow As Integer, ByVal iTicksHigh As Integer, ByRef pdTime As Double, ByVal iFlags As Integer) As Integer

    Declare Function meIOSetChannelOffset Lib "meIDSmainVB.dll" Alias "_meIOSetChannelOffset@24" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iChannel As Integer, ByVal iRange As Integer, ByRef pdOffset As Double, ByVal iFlags As Integer) As Integer

    'UPGRADE_WARNING: Structure meIOStreamTrigger may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    'UPGRADE_WARNING: Structure meIOStreamConfig may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    Declare Function meIOStreamConfig Lib "meIDSmainVB.dll" Alias "_meIOStreamConfig@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByRef pConfigList As meIOStreamConfig_t, ByVal iCount As Integer, ByRef pTrigger As meIOStreamTrigger, ByVal iFifoIrqThreshold As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOStreamRead Lib "meIDSmainVB.dll" Alias "_meIOStreamRead@24" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iReadMode As Integer, ByRef plValues As Integer, ByRef plCount As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOStreamWrite Lib "meIDSmainVB.dll" Alias "_meIOStreamWrite@24" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iWriteMode As Integer, ByRef plValues As Integer, ByRef plCount As Integer, ByVal iFlags As Integer) As Integer

    'UPGRADE_WARNING: Structure meIOStreamStart may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    Declare Function meIOStreamStart Lib "meIDSmainVB.dll" Alias "_meIOStreamStart@12" (ByRef pStartList As meIOStreamStart_t, ByVal iCount As Integer, ByVal iFlags As Integer) As Integer

    'UPGRADE_WARNING: Structure meIOStreamStop may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    Declare Function meIOStreamStop Lib "meIDSmainVB.dll" Alias "_meIOStreamStop@12" (ByRef pStopList As meIOStreamStop_t, ByVal iCount As Integer, ByVal iFlags As Integer) As Integer

    Declare Function meIOStreamStatus Lib "meIDSmainVB.dll" Alias "_meIOStreamStatus@24" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iWait As Integer, ByRef plStatus As Integer, ByRef plCount As Integer, ByVal iFlags As Integer) As Integer

    ' Declare Function meIOStreamSetCallbacks Lib "meIDSmainVB.dll" Alias "_meIOStreamSetCallbacks@36" (ByVal iDevice As Long, ByVal iSubdevice As Long, meIOStreamCB_t pStartCB, void *pStartCBContext, meIOStreamCB_t pNewValuesCB, void *pNewValuesCBContext, meIOStreamCB_t pEndCB, void *pEndCBContext, ByVal iFlags) As Long

    Declare Function meIOStreamTimeToTicks Lib "meIDSmainVB.dll" Alias "_meIOStreamTimeToTicks@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iTimer As Integer, ByRef pdTime As Double, ByRef plTicksLow As Integer, ByRef plTicksHigh As Integer, ByVal iFlags As Integer) As Integer

    '==================================================================
    '  Functions to query the driver system
    '==================================================================

    Declare Function meQueryDescriptionDevice Lib "meIDSmainVB.dll" Alias "_meQueryDescriptionDevice@12" (ByVal iDevice As Integer, ByVal pcDescription As String, ByVal iCount As Integer) As Integer

    Declare Function meQueryInfoDevice Lib "meIDSmainVB.dll" Alias "_meQueryInfoDevice@36" (ByVal iDevice As Integer, ByRef plVendorId As Integer, ByRef plDeviceId As Integer, ByRef plSerialNo As Integer, ByRef plBusType As Integer, ByRef plBusNo As Integer, ByRef plDevNo As Integer, ByRef plFuncNo As Integer, ByRef plPlugged As Integer) As Integer

    Declare Function meQueryNameDevice Lib "meIDSmainVB.dll" Alias "_meQueryNameDevice@12" (ByVal iDevice As Integer, ByVal pcName As String, ByVal iCount As Integer) As Integer

    Declare Function meQueryNameDeviceDriver Lib "meIDSmainVB.dll" Alias "_meQueryNameDeviceDriver@12" (ByVal iDevice As Integer, ByVal pcName As String, ByVal iCount As Integer) As Integer

    Declare Function meQueryNumberDevices Lib "meIDSmainVB.dll" Alias "_meQueryNumberDevices@4" (ByRef plNumber As Integer) As Integer

    Declare Function meQueryNumberSubdevices Lib "meIDSmainVB.dll" Alias "_meQueryNumberSubdevices@8" (ByVal iDevice As Integer, ByRef plNumber As Integer) As Integer

    Declare Function meQueryNumberChannels Lib "meIDSmainVB.dll" Alias "_meQueryNumberChannels@12" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByRef plNumber As Integer) As Integer

    Declare Function meQueryNumberRanges Lib "meIDSmainVB.dll" Alias "_meQueryNumberRanges@16" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iUnit As Integer, ByRef plNumber As Integer) As Integer

    Declare Function meQueryRangeByMinMax Lib "meIDSmainVB.dll" Alias "_meQueryRangeByMinMax@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iUnit As Integer, ByRef pdMin As Double, ByRef pdMax As Double, ByRef plMaxData As Integer, ByRef plRange As Integer) As Integer

    Declare Function meQueryRangeInfo Lib "meIDSmainVB.dll" Alias "_meQueryRangeInfo@28" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iRange As Integer, ByRef plUnit As Integer, ByRef pdMin As Double, ByRef pdMax As Double, ByRef plMaxData As Integer) As Integer

    Declare Function meQuerySubdeviceByType Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceByType@20" (ByVal iDevice As Integer, ByVal iStartSubdevice As Integer, ByVal iType As Integer, ByVal iSubtype As Integer, ByRef plSubdevice As Integer) As Integer

    Declare Function meQuerySubdeviceType Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceType@16" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByRef plType As Integer, ByRef plSubtype As Integer) As Integer

    Declare Function meQuerySubdeviceCaps Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceCaps@12" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByRef plCaps As Integer) As Integer

    Declare Function meQuerySubdeviceCapsArgs Lib "meIDSmainVB.dll" Alias "_meQuerySubdeviceCapsArgs@20" (ByVal iDevice As Integer, ByVal iSubdevice As Integer, ByVal iCap As Integer, ByRef plArgs As Integer, ByVal iCount As Integer) As Integer

    Declare Function meQueryVersionLibrary Lib "meIDSmainVB.dll" Alias "_meQueryVersionLibrary@4" (ByRef plVersion As Integer) As Integer

    Declare Function meQueryVersionMainDriver Lib "meIDSmainVB.dll" Alias "_meQueryVersionMainDriver@4" (ByRef plVersion As Integer) As Integer

    Declare Function meQueryVersionDeviceDriver Lib "meIDSmainVB.dll" Alias "_meQueryVersionDeviceDriver@8" (ByVal iDevice As Integer, ByRef plVersion As Integer) As Integer

    '==================================================================
    '  Common utility functions
    '==================================================================

    'UPGRADE_WARNING: Structure meIOStreamConfig may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
    Declare Function meUtilityExtractValues Lib "meIDSmainVB.dll" Alias "_meUtilityExtractValues@28" (ByVal iChannel As Integer, ByRef plAIBuffer As Integer, ByVal iAIBufferCount As Integer, ByRef pConfigList As meIOStreamConfig_t, ByVal iConfigListCount As Integer, ByRef plChanBuffer As Integer, ByRef plChanBufferCount As Integer) As Integer

    Declare Function meUtilityDigitalToPhysical Lib "meIDSmainVB.dll" Alias "_meUtilityDigitalToPhysical@40" (ByVal dMin As Double, ByVal dMax As Double, ByVal iMaxData As Integer, ByVal iData As Integer, ByVal iModuleType As Integer, ByVal dRefValue As Double, ByRef pdPhysical As Double) As Integer

    Declare Function meUtilityDigitalToPhysicalV Lib "meIDSmainVB.dll" Alias "_meUtilityDigitalToPhysicalV@44" (ByVal dMin As Double, ByVal dMax As Double, ByVal iMaxData As Integer, ByRef plDataBuffer As Integer, ByVal iCount As Integer, ByVal iModuleType As Integer, ByVal dRefValue As Double, ByRef pdPhysicalBuffer As Double) As Integer

    Declare Function meUtilityPhysicalToDigital Lib "meIDSmainVB.dll" Alias "_meUtilityPhysicalToDigital@32" (ByVal dMin As Double, ByVal dMax As Double, ByVal iMaxData As Integer, ByVal dPhysical As Double, ByRef plData As Integer) As Integer

    Declare Function meUtilityPhysicalToDigitalV Lib "meIDSmainVB.dll" Alias "_meUtilityPhysicalToDigitalV@32" (ByVal dMin As Double, ByVal dMax As Double, ByVal iMaxData As Integer, ByRef pdPhysicalBuffer As Double, ByVal iCount As Integer, ByRef plDataBuffer As Integer) As Integer

    Declare Function meUtilityPWMStart Lib "meIDSmainVB.dll" Alias "_meUtilityPWMStart@32" (ByVal iDevice As Integer, ByVal iSubdevice1 As Integer, ByVal iSubdevice2 As Integer, ByVal iSubdevice3 As Integer, ByVal iRef As Integer, ByVal iPrescaler As Integer, ByVal iDutyCycle As Integer, ByVal iFlag As Integer) As Integer

    Declare Function meUtilityPWMStop Lib "meIDSmainVB.dll" Alias "_meUtilityPWMStop@8" (ByVal iDevice As Integer, ByVal iSubdevice1 As Integer) As Integer

End Module
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: MS Visual Basic .NET Interface

  • ME-iDS API

MS Visual Basic .NET Interface

'==============================================================================
'Copyright(c), Meilhaus Electronic GmbH
'              http://www.meilhaus.de
'              support@meilhaus.de
'
'Source File : meIDS.vb
'Description : Constants, types and function prototypes of the ME-iDS API
'              for accessing the API in Visual Basic .NET
'
'Important   : This file uses the CallingConvention.Cdecl of the ME-iDS API
'Note        : import library for ME-iDS API 32bit: meIDSmain.dll
'              import library for ME-iDS API 64bit: meIDSmain64.dll
'==============================================================================
Option Strict Off
Option Explicit On

Imports System.Runtime.InteropServices
Imports System.Text

Module Module1
    '---------------------------------------------------------------
    '
    ' me-iDS Constants
    '
    '---------------------------------------------------------------

    Public NotInheritable Class meIDS

#Region "Constants"
        '===============================================================
        '  General
        '===============================================================

        Public Const ME_VALUE_NOT_USED As Integer = &H0S

        Public Const ME_VALUE_DEFAULT As Integer = &H0S

        Public Const ME_NO_FLAGS As Integer = &H0S

        Public Const ME_VALUE_INVALID as Integer = -1;

        '===============================================================
        '  Defines common to access functions
        '===============================================================

        Public Const ME_LOCK_RELEASE As Integer = &H10001
        Public Const ME_LOCK_SET As Integer = &H10002
        Public Const ME_LOCK_CHECK As Integer = &H10003

        '===============================================================
        '  Defines meOpen function
        '===============================================================

        Public Const ME_OPEN_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines meClose function
        '===============================================================

        Public Const ME_CLOSE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines meLockDriver function
        '===============================================================

        Public Const ME_LOCK_DRIVER_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines meLockDevice function
        '===============================================================

        Public Const ME_LOCK_DEVICE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines meLockSubdevice function
        '===============================================================

        Public Const ME_LOCK_SUBDEVICE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines common to error functions
        '===============================================================

        Public Const ME_ERROR_MSG_MAX_COUNT As Integer = 256

        '===============================================================
        '  Defines for meErrorSetDefaultProc function
        '===============================================================

        Public Const ME_SWITCH_DISABLE As Integer = &H20001
        Public Const ME_SWITCH_ENABLE As Integer = &H20002

        '==================================================================
        '  Defines for meErrorGetLast function
        '==================================================================

        Public Const ME_ERROR_GET_LAST_NO_FLAGS As Integer = &H0
        Public Const ME_ERROR_GET_LAST_CLEAR As Integer = &H1

        '===============================================================
        '  Defines common to io functions
        '===============================================================

        Public Const ME_REF_NONE As Integer = &H0
        Public Const ME_REF_DIO_FIFO_LOW As Integer = &H30001
        Public Const ME_REF_DIO_FIFO_HIGH As Integer = &H30002

        Public Const ME_REF_CTR_PREVIOUS As Integer = &H40001
        Public Const ME_REF_CTR_INTERNAL_1MHZ As Integer = &H40002
        Public Const ME_REF_CTR_INTERNAL_10MHZ As Integer = &H40003
        Public Const ME_REF_CTR_EXTERNAL As Integer = &H40004

        Public Const ME_REF_AI_GROUND As Integer = &H50001
        Public Const ME_REF_AI_DIFFERENTIAL As Integer = &H50002

        Public Const ME_REF_AO_GROUND As Integer = &H60001
        Public Const ME_REF_AO_DIFFERENTIAL As Integer = &H60002

        Public Const ME_TRIG_CHAN_NONE As Integer = ME_VALUE_NOT_USED
        Public Const ME_TRIG_CHAN_DEFAULT As Integer = &H70001
        Public Const ME_TRIG_CHAN_SYNCHRONOUS As Integer = &H70002

        Public Const ME_TRIG_TYPE_NONE As Integer = ME_VALUE_NOT_USED
        Public Const ME_TRIG_TYPE_SW As Integer = &H80001
        Public Const ME_TRIG_TYPE_THRESHOLD As Integer = &H80002
        Public Const ME_TRIG_TYPE_WINDOW As Integer = &H80003
        Public Const ME_TRIG_TYPE_EDGE As Integer = &H80004
        Public Const ME_TRIG_TYPE_SLOPE As Integer = &H80005
        Public Const ME_TRIG_TYPE_EXT_DIGITAL As Integer = &H80006
        Public Const ME_TRIG_TYPE_EXT_ANALOG As Integer = &H80007
        Public Const ME_TRIG_TYPE_PATTERN As Integer = &H80008          ' These two defines are the same
        Public Const ME_TRIG_TYPE_PATTERN_MATCH As Integer = &H80008    ' to preserve compatibility
        Public Const ME_TRIG_TYPE_TIMER As Integer = &H80009
        Public Const ME_TRIG_TYPE_COUNT As Integer = &H8000A
        Public Const ME_TRIG_TYPE_FOLLOW As Integer = &H8000B
        Public Const ME_TRIG_TYPE_PATTERN_NO_MATCH As Integer = &H8000C
        Public Const ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT As Integer = &H8000D
        Public Const ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT As Integer = &H8000E
        Public Const ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT As Integer = &H8000F

        Public Const ME_TRIG_EDGE_NONE As Integer = ME_VALUE_NOT_USED
        Public Const ME_TRIG_EDGE_ABOVE As Integer = &H90001
        Public Const ME_TRIG_EDGE_BELOW As Integer = &H90002
        Public Const ME_TRIG_EDGE_ENTRY As Integer = &H90003
        Public Const ME_TRIG_EDGE_EXIT As Integer = &H90004
        Public Const ME_TRIG_EDGE_RISING As Integer = &H90005
        Public Const ME_TRIG_EDGE_FALLING As Integer = &H90006
        Public Const ME_TRIG_EDGE_ANY As Integer = &H90007

        Public Const ME_TIMER_ACQ_START As Integer = &HA0001
        Public Const ME_TIMER_SCAN_START As Integer = &HA0002
        Public Const ME_TIMER_CONV_START As Integer = &HA0003
        Public Const ME_TIMER_FIO_TOTAL As Integer = &HA0004
        Public Const ME_TIMER_FIO_FIRST_PHASE As Integer = &HA0005

        '===============================================================
        '  Defines for meIOFrequencyToTicks function
        '===============================================================

        Public Const ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_FREQUENCY_TO_TICKS_NO_FLAGS = ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS
        Public Const ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE As Integer = &H1S

        '===============================================================
        '  Defines for meIOIrqStart function
        '===============================================================

        Public Const ME_IRQ_SOURCE_DIO_PATTERN As Integer = &HB0001
        Public Const ME_IRQ_SOURCE_DIO_MASK As Integer = &HB0002
        Public Const ME_IRQ_SOURCE_DIO_LINE As Integer = &HB0003
        Public Const ME_IRQ_SOURCE_DIO_OVER_TEMP As Integer = &HB0004
        Public Const ME_IRQ_SOURCE_DIO_NORMAL_TEMP As Integer = &HB0005
        Public Const ME_IRQ_SOURCE_DIO_CHANGE_TEMP As Integer = &HB0006

        Public Const ME_IRQ_EDGE_NOT_USED As Integer = ME_VALUE_NOT_USED
        Public Const ME_IRQ_EDGE_RISING As Integer = &HC0001
        Public Const ME_IRQ_EDGE_FALLING As Integer = &HC0002
        Public Const ME_IRQ_EDGE_ANY As Integer = &HC0003

        Public Const ME_IO_IRQ_START_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_IRQ_START_DIO_BIT As Integer = &H1S
        Public Const ME_IO_IRQ_START_DIO_BYTE As Integer = &H2S
        Public Const ME_IO_IRQ_START_DIO_WORD As Integer = &H4S
        Public Const ME_IO_IRQ_START_DIO_DWORD As Integer = &H8S
        Public Const ME_IO_IRQ_START_PATTERN_FILTERING As Integer = &H10S
        Public Const ME_IO_IRQ_START_EXTENDED_STATUS As Integer = &H20S
        Public Const ME_IO_IRQ_START_USE_PROPERTIES As Integer = &H40000000

        '===============================================================
        '  Defines for meIOIrqWait function
        '===============================================================

        Public Const ME_IO_IRQ_WAIT_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_IRQ_WAIT_NORMAL_STATUS As Integer = &H1S
        Public Const ME_IO_IRQ_WAIT_EXTENDED_STATUS As Integer = &H2S

        '===============================================================
        '  Defines for meIOIrqStop function
        '===============================================================

        Public Const ME_IO_IRQ_STOP_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOIrqSetCallback function
        '===============================================================

        Public Const ME_IO_IRQ_SET_CALLBACK_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOResetDevice function
        '===============================================================

        Public Const ME_IO_RESET_DEVICE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOResetSubdevice function
        '===============================================================

        Public Const ME_IO_RESET_SUBDEVICE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOSingleConfig function
        '===============================================================

        Public Const ME_SINGLE_CONFIG_DIO_INPUT As Integer = &HD0001
        Public Const ME_SINGLE_CONFIG_DIO_OUTPUT As Integer = &HD0002
        Public Const ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE As Integer = &HD0003
        Public Const ME_SINGLE_CONFIG_DIO_SINK As Integer = &HD0004
        Public Const ME_SINGLE_CONFIG_DIO_SOURCE As Integer = &HD0005
        Public Const ME_SINGLE_CONFIG_DIO_MUX32M As Integer = &HD0006
        Public Const ME_SINGLE_CONFIG_DIO_DEMUX32 As Integer = &HD0007
        Public Const ME_SINGLE_CONFIG_DIO_BIT_PATTERN As Integer = &HD0008

        Public Const ME_SINGLE_CONFIG_FIO_INPUT As Integer = &H1E0001
        Public Const ME_SINGLE_CONFIG_FIO_OUTPUT As Integer = &H1E0002
        Public Const ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE As Integer = &H1E0002
        Public Const ME_SINGLE_CONFIG_FIO_SINK As Integer = &H1E0003
        Public Const ME_SINGLE_CONFIG_FIO_SOURCE As Integer = &H1E0004

        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_0 As Integer = &HE0001
        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_1 As Integer = &HE0002
        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_2 As Integer = &HE0003
        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_3 As Integer = &HE0004
        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_4 As Integer = &HE0005
        Public Const ME_SINGLE_CONFIG_CTR_8254_MODE_5 As Integer = &HE0006

        Public Const ME_IO_SINGLE_CONFIG_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_SINGLE_CONFIG_DIO_BIT As Integer = &H1S
        Public Const ME_IO_SINGLE_CONFIG_DIO_BYTE As Integer = &H2S
        Public Const ME_IO_SINGLE_CONFIG_DIO_WORD As Integer = &H4S
        Public Const ME_IO_SINGLE_CONFIG_DIO_DWORD As Integer = &H8S
        Public Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON As Integer = &H10S
        Public Const ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF As Integer = &H20S
        Public Const ME_IO_SINGLE_CONFIG_AI_RMS As Integer = &H40S

        '===============================================================
        '  Defines for meIOSingle function
        '===============================================================

        Public Const ME_IO_SINGLE_NO_FLAGS As Integer = &H0S

        Public Const ME_DIR_INPUT As Integer = &HF0001
        Public Const ME_DIR_OUTPUT As Integer = &HF0002
        Public Const ME_DIR_SET_OFFSET As Integer = &HF0003

        Public Const ME_IO_SINGLE_TYPE_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_SINGLE_TYPE_DIO_BIT As Integer = &H1S
        Public Const ME_IO_SINGLE_TYPE_DIO_BYTE As Integer = &H2S
        Public Const ME_IO_SINGLE_TYPE_DIO_WORD As Integer = &H4S
        Public Const ME_IO_SINGLE_TYPE_DIO_DWORD As Integer = &H8S
        Public Const ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS As Integer = &H10S
        Public Const ME_IO_SINGLE_TYPE_NONBLOCKING As Integer = &H20
        Public Const ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING As Integer = ME_IO_SINGLE_TYPE_NONBLOCKING
        Public Const ME_IO_SINGLE_TYPE_READ_NONBLOCKING As Integer = ME_IO_SINGLE_TYPE_NONBLOCKING

        Public Const ME_IO_SINGLE_TYPE_FIO_DIVIDER As Integer = &H40
        Public Const ME_IO_SINGLE_TYPE_FO_START_LOW As Integer = &H80
        Public Const ME_IO_SINGLE_TYPE_FO_START_SOFT As Integer = &H100
        Public Const ME_IO_SINGLE_TYPE_FI_LAST_VALUE As Integer = &H200
        Public Const ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY As Integer = &H200
        Public Const ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL As Integer = &H400
        Public Const ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE As Integer = &H800
        Public Const ME_IO_SINGLE_TYPE_FO_USE_PROPERTIES As Integer = &H40000000

        '==================================================================
        '  Defines for meIOSingleTimeToTicks function
        '==================================================================

        Public Const ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS As Integer = &H0S

        '==================================================================
        '  Defines for meIOSingleTicksToTime function
        '==================================================================

        Public Const ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOSetChannelOffset function
        '===============================================================

        Public Const ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamConfig function
        '===============================================================

        Public Const ME_IO_STREAM_CONFIG_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_CONFIG_BIT_PATTERN As Integer = &H1S
        Public Const ME_IO_STREAM_CONFIG_WRAPAROUND As Integer = &H2S
        Public Const ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD As Integer = &H4S

        Public Const ME_IO_STREAM_CONFIG_INTERNAL_COUNTER As Integer = &H80000000

        Public Const ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS As Integer = &H0S

        Public Const ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamRead function
        '===============================================================

        Public Const ME_READ_MODE_BLOCKING As Integer = &H100001
        Public Const ME_READ_MODE_NONBLOCKING As Integer = &H100002

        Public Const ME_IO_STREAM_READ_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_READ_FRAMES As Integer = &H1S

        '===============================================================
        '  Defines for meIOStreamWrite function
        '===============================================================

        Public Const ME_WRITE_MODE_BLOCKING As Integer = &H110001
        Public Const ME_WRITE_MODE_NONBLOCKING As Integer = &H110002
        Public Const ME_WRITE_MODE_PRELOAD As Integer = &H110003

        Public Const ME_IO_STREAM_WRITE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamStart function
        '===============================================================

        Public Const ME_IO_STREAM_START_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_START_NONBLOCKING As Integer = &H20S

        Public Const ME_START_MODE_BLOCKING As Integer = &H120001
        Public Const ME_START_MODE_NONBLOCKING As Integer = &H120002

        Public Const ME_IO_STREAM_START_TYPE_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS As Integer = &H1S

        '===============================================================
        '  Defines for meIOStreamStop function
        '===============================================================

        Public Const ME_IO_STREAM_STOP_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_STOP_NONBLOCKING As Integer = &H20S

        Public Const ME_STOP_MODE_IMMEDIATE As Integer = &H130001
        Public Const ME_STOP_MODE_LAST_VALUE As Integer = &H130002

        Public Const ME_IO_STREAM_STOP_TYPE_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamStatus function
        '===============================================================

        Public Const ME_WAIT_NONE As Integer = &H140001
        Public Const ME_WAIT_IDLE As Integer = &H140002
        Public Const ME_WAIT_BUSY As Integer = &H140003

        Public Const ME_STATUS_INVALID As Integer = &H0S
        Public Const ME_STATUS_IDLE As Integer = &H150001
        Public Const ME_STATUS_BUSY As Integer = &H150002
        Public Const ME_STATUS_ERROR As Integer = &H150003

        Public Const ME_IO_STREAM_STATUS_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamSetCallbacks function
        '===============================================================

        Public Const ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS As Integer = &H0S

        '===============================================================
        '  Defines for meIOStreamTimeToTicks function
        '===============================================================

        Public Const ME_IO_TIME_TO_TICKS_NO_FLAGS As Integer = &H0S
        Public Const ME_IO_STREAM_TIME_TO_TICKS_NO_FLAGS = ME_IO_TIME_TO_TICKS_NO_FLAGS
        Public Const ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE As Integer = &H1S

        '===============================================================
        '  Defines for module types
        '===============================================================

        Public Const ME_MODULE_TYPE_MULTISIG_NONE As Integer = &H0S
        Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_10V As Integer = &H160001
        Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_20V As Integer = &H160002
        Public Const ME_MODULE_TYPE_MULTISIG_DIFF16_50V As Integer = &H160003
        Public Const ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA As Integer = &H160004
        Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT100 As Integer = &H160005
        Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT500 As Integer = &H160006
        Public Const ME_MODULE_TYPE_MULTISIG_RTD8_PT1000 As Integer = &H160007
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B As Integer = &H160008
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E As Integer = &H160009
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J As Integer = &H16000A
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K As Integer = &H16000B
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N As Integer = &H16000C
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R As Integer = &H16000D
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S As Integer = &H16000E
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T As Integer = &H16000F
        Public Const ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR As Integer = &H160010

        '===============================================================
        '  Defines for meQuerySubdeviceCaps function
        '===============================================================

        Public Const ME_CAPS_DIO_DIR_BIT As Integer = &H1S
        Public Const ME_CAPS_DIO_DIR_BYTE As Integer = &H2S
        Public Const ME_CAPS_DIO_DIR_WORD As Integer = &H4S
        Public Const ME_CAPS_DIO_DIR_DWORD As Integer = &H8S
        Public Const ME_CAPS_DIO_SINK_SOURCE As Integer = &H10S
        Public Const ME_CAPS_DIO_BIT_PATTERN_IRQ As Integer = &H20S
        Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING As Integer = &H40S
        Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING As Integer = &H80S
        Public Const ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY As Integer = &H100S
        Public Const ME_CAPS_DIO_OVER_TEMP_IRQ As Integer = &H200S
        Public Const ME_CAPS_DIO_NORMAL_TEMP_IRQ As Integer = &H400S

        Public Const ME_CAPS_CTR_CLK_PREVIOUS As Integer = &H1S
        Public Const ME_CAPS_CTR_CLK_INTERNAL_1MHZ As Integer = &H2S
        Public Const ME_CAPS_CTR_CLK_INTERNAL_10MHZ As Integer = &H4S
        Public Const ME_CAPS_CTR_CLK_EXTERNAL As Integer = &H8S

        Public Const ME_CAPS_AI_TRIG_SIMULTANEOUS As Integer = &H1S
        Public Const ME_CAPS_AI_FIFO As Integer = &H2S
        Public Const ME_CAPS_AI_FIFO_THRESHOLD As Integer = &H4S
        Public Const ME_CAPS_AI_SAMPLE_HOLD As Integer = &H8S

        Public Const ME_CAPS_AO_TRIG_SIMULTANEOUS As Integer = &H1S
        Public Const ME_CAPS_AO_FIFO As Integer = &H2S
        Public Const ME_CAPS_AO_FIFO_THRESHOLD As Integer = &H4S

        Public Const ME_CAPS_FIO_SINK_SOURCE As Integer = &H10S

        Public Const ME_CAPS_EXT_IRQ_EDGE_RISING As Integer = &H1S
        Public Const ME_CAPS_EXT_IRQ_EDGE_FALLING As Integer = &H2S
        Public Const ME_CAPS_EXT_IRQ_EDGE_ANY As Integer = &H4S

        '===============================================================
        '  Defines for meQuerySubdeviceCapsArgs function
        '===============================================================

        Public Const ME_CAP_AI_FIFO_SIZE As Integer = &H1D0000
        Public Const ME_CAP_AI_BUFFER_SIZE As Integer = &H1D0001
        Public Const ME_CAP_AI_CHANNEL_LIST_SIZE As Integer = &H1D0002
        Public Const ME_CAP_AI_MAX_THRESHOLD_SIZE As Integer = &H1D0003

        Public Const ME_CAP_AO_FIFO_SIZE As Integer = &H1F0000
        Public Const ME_CAP_AO_BUFFER_SIZE As Integer = &H1F0001
        Public Const ME_CAP_AO_CHANNEL_LIST_SIZE As Integer = &H1F0002
        Public Const ME_CAP_AO_MAX_THRESHOLD_SIZE As Integer = &H1F0003

        Public Const ME_CAP_CTR_WIDTH As Integer = &H200000

        Public Const ME_CAP_FPGA_IN_FIFO_SIZE As Integer = &H300000
        Public Const ME_CAP_FPGA_IN_BUFFER_SIZE As Integer = &H300001
        Public Const ME_CAP_FPGA_OUT_FIFO_SIZE As Integer = &H300002
        Public Const ME_CAP_FPGA_OUT_BUFFER_SIZE As Integer = &H300003

        '===============================================================
        '  Defines common to query functions
        '===============================================================

        Public Const ME_UNIT_INVALID As Integer = &H0S
        Public Const ME_UNIT_VOLT As Integer = &H170001
        Public Const ME_UNIT_AMPERE As Integer = &H170002
        Public Const ME_UNIT_ANY As Integer = &H170003
        Public Const ME_UNIT_HZ As Integer = &H170004

        Public Const ME_TYPE_INVALID As Integer = &H0S
        Public Const ME_TYPE_AO As Integer = &H180001
        Public Const ME_TYPE_AI As Integer = &H180002
        Public Const ME_TYPE_DIO As Integer = &H180003
        Public Const ME_TYPE_DO As Integer = &H180004
        Public Const ME_TYPE_DI As Integer = &H180005
        Public Const ME_TYPE_CTR As Integer = &H180006
        Public Const ME_TYPE_EXT_IRQ As Integer = &H180007
        Public Const ME_TYPE_FIO As Integer = &H180008
        Public Const ME_TYPE_FO As Integer = &H180009
        Public Const ME_TYPE_FI As Integer = &H18000A
        Public Const ME_TYPE_FPGA As Integer = &H18000B

        Public Const ME_SUBTYPE_INVALID As Integer = &H0S
        Public Const ME_SUBTYPE_SINGLE As Integer = &H190001
        Public Const ME_SUBTYPE_STREAMING As Integer = &H190002
        Public Const ME_SUBTYPE_CTR_8254 As Integer = &H190003
        Public Const ME_SUBTYPE_ANY As Integer = &H190004
        Public Const ME_SUBTYPE_CTR As Integer = &H190006

        Public Const ME_DEVICE_DRIVER_NAME_MAX_COUNT As Integer = 64
        Public Const ME_DEVICE_NAME_MAX_COUNT As Integer = 64

        Public Const ME_DEVICE_DESCRIPTION_MAX_COUNT As Integer = 256

        Public Const ME_BUS_TYPE_INVALID As Integer = &H0S
        Public Const ME_BUS_TYPE_ANY As Integer = &H1A0000    'ME_BUS_TYPE_ANY only for checking bus
        Public Const ME_BUS_TYPE_PCI As Integer = &H1A0001
        Public Const ME_BUS_TYPE_USB As Integer = &H1A0002
        Public Const ME_BUS_TYPE_LAN_PCI As Integer = &H1A0101
        Public Const ME_BUS_TYPE_LAN_USB As Integer = &H1A0102

        Public Const ME_PLUGGED_INVALID As Integer = &H0S
        Public Const ME_PLUGGED_ANY As Integer = &H1B0000     'ME_PLUGGED_ANY only for checking status
        Public Const ME_PLUGGED_IN As Integer = &H1B0001
        Public Const ME_PLUGGED_OUT As Integer = &H1B0002

        Public Const ME_EXTENSION_TYPE_INVALID As Integer = &H0S
        Public Const ME_EXTENSION_TYPE_NONE As Integer = &H1C0001
        Public Const ME_EXTENSION_TYPE_MUX32M As Integer = &H1C0002
        Public Const ME_EXTENSION_TYPE_DEMUX32 As Integer = &H1C0003
        Public Const ME_EXTENSION_TYPE_MUX32S As Integer = &H1C0004
        Public Const ME_EXTENSION_TYPE_ME1001 As Integer = &H1C0005

        Public Const ME_ACCESS_TYPE_INVALID As Integer = &H0S
        Public Const ME_ACCESS_TYPE_ANY As Integer = &H1D0000
        Public Const ME_ACCESS_TYPE_LOCAL As Integer = &H1D0001
        Public Const ME_ACCESS_TYPE_REMOTE As Integer = &H1D0002

        '===============================================================
        '  Defines for ConfigLoad
        '===============================================================

        Public Const ME_CONF_LOAD_CUSTOM_DRIVER As Integer = &H1000

        '==================================================================
        '  Defines for FPGA device
        '==================================================================

        Public Const ME_FPGA_FIRMWARE As UInt32 = &HFF000001UI
        Public Const ME_FPGA_SUBDEVICE As UInt32 = &HFF000002UI

        '==================================================================
        '  Defines for meUtilityPWM
        '==================================================================

        Public Const ME_PWM_START_NO_FLAGS As Integer = &H0
        Public Const ME_PWM_START_CONNECT_INTERNAL As Integer = &H1

        '==================================================================
        '  Defines of flags for error handling
        '==================================================================

        Public Const ME_ERRNO_CLEAR_FLAGS As Integer = &H1

        '==================================================================
        '  Defines of flags for device settings, used with property functions
        '==================================================================

        Public Const ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS As Integer = &H0
        Public Const ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS As Integer = &H1

        '==================================================================
        '  Defines of flags for property functions
        '==================================================================

        Public Const ME_PROPERTY_TYPE_INVALID As Integer = &H0
        Public Const ME_PROPERTY_TYPE_CONTAINER As Integer = &H1
        Public Const ME_PROPERTY_TYPE_BOOL As Integer = &H2
        Public Const ME_PROPERTY_TYPE_INT As Integer = &H3
        Public Const ME_PROPERTY_TYPE_DOUBLE As Integer = &H4
        Public Const ME_PROPERTY_TYPE_STRING As Integer = &H5
        Public Const ME_PROPERTY_TYPE_DEFINE As Integer = &H6

        Public Const ME_PROPERTY_ACCESS_READ_ONLY As Integer = &H0
        Public Const ME_PROPERTY_ACCESS_READ_WRITE As Integer = &H1

        Public Const ME_PROPERTY_BOOLEAN_FALSE As Integer = &H0
        Public Const ME_PROPERTY_BOOLEAN_TRUE As Integer = &H1

        Public Const ME_CALIBRATION_TYPE_FACTORY As Integer = &H1E0000
        Public Const ME_CALIBRATION_TYPE_USER_1 As Integer = &H1E0001

#End Region

#Region "PropertyConstants"

        '-------------------------------------------------------------------
        '
        '  me-iDS System properties
        '
        '-------------------------------------------------------------------
        Public Const ME_CONTAINER_NAME_ROOT As String = "\\"  ' Root container (system container)

        Public Const ME_ATTRIBUTE_NAME_NUMBER_OF_ELEMENTS As String = "NumberOfElements"
        Public Const ME_ATTRIBUTE_NAME_PROPERTY_NAME As String = "PropertyName"
        Public Const ME_ATTRIBUTE_NAME_PROPERTY_TYPE As String = "PropertyType"
        Public Const ME_ATTRIBUTE_NAME_PROPERTY_ACCESS As String = "PropertyAccess"
        Public Const ME_ATTRIBUTE_NAME_PROPERTY_DESCRIPTION As String = "PropertyDescription"
        Public Const ME_ATTRIBUTE_NAME_MIN_VALUE As String = "MinValue"
        Public Const ME_ATTRIBUTE_NAME_MAX_VALUE As String = "MaxValue"
        Public Const ME_ATTRIBUTE_NAME_LENGTH As String = "Length"
        Public Const ME_ATTRIBUTE_NAME_MAX_LENGTH As String = "MaxLength"
        Public Const ME_ATTRIBUTE_NAME_NUMBER_OF_SELECTIONS As String = "NumberOfSelections"
        Public Const ME_ATTRIBUTE_NAME_PREFIX_SELECTION As String = "Selection"    ' The selection with index # is "Selection#"

        '==================================================================
        '  System properties and containers
        '==================================================================

        Public Const ME_PROPERTY_NAME_LIBRARY_VERSION As String = "LibraryVersion"
        Public Const ME_PROPERTY_NAME_MAIN_DRIVER_VERSION As String = "MainDriverVersion"
        Public Const ME_PROPERTY_NAME_NUMBER_OF_DEVICES As String = "NumberOfDevices"
        Public Const ME_CONTAINER_NAME_DEVICES As String = "Devices"

        '==================================================================
        '  General device properties and containers - not device specific
        '==================================================================

        Public Const ME_CONTAINER_NAME_PREFIX_DEVICE As String = "Device"    ' The container name for the device with index # is "Device#"
        Public Const ME_PROPERTY_NAME_NAME As String = "Name"
        Public Const ME_PROPERTY_NAME_DRIVER_NAME As String = "DriverName"
        Public Const ME_PROPERTY_NAME_DRIVER_VERSION As String = "DriverVersion"
        Public Const ME_PROPERTY_NAME_DESCRIPTION As String = "Description"
        Public Const ME_PROPERTY_NAME_SERIAL_NUMBER As String = "SerialNumber"
        Public Const ME_PROPERTY_NAME_BUS_TYPE As String = "BusType"
        Public Const ME_PROPERTY_NAME_ACCESS_TYPE As String = "AccessType"
        Public Const ME_PROPERTY_NAME_PLUGGED As String = "Plugged"
        Public Const ME_PROPERTY_NAME_FIRMWARE_SELECTABLE As String = "FirmwareSelectable"
        Public Const ME_PROPERTY_NAME_CURRENT_FIRMWARE_ID As String = "CurrentFirmwareID"
        Public Const ME_PROPERTY_NAME_NUMBER_OF_SUBDEVICES As String = "NumberOfSubdevices"
        Public Const ME_CONTAINER_NAME_SUBDEVICES As String = "Subdevices"

        '==================================================================
        ' Additional properties for PCI devices
        '==================================================================

        Public Const ME_PROPERTY_NAME_PCI_VENDOR_ID As String = "PCIVendorID"
        Public Const ME_PROPERTY_NAME_PCI_DEVICE_ID As String = "PCIDeviceID"
        Public Const ME_PROPERTY_NAME_PCI_BUS_NUMBER As String = "PCIBusNumber"
        Public Const ME_PROPERTY_NAME_PCI_SLOT_NUMBER As String = "PCISlotNumber"
        Public Const ME_PROPERTY_NAME_PCI_FUNCTION_NUMBER As String = "PCIFunctionNumber"

        '==================================================================
        ' General sub-device properties and containers - not sub-device specific
        '==================================================================

        Public Const ME_CONTAINER_NAME_PREFIX_SUBDEVICE As String = "Subdevice"    ' The container name for the sub-device with index # is "Subdevice#"
        Public Const ME_PROPERTY_NAME_TYPE As String = "Type"
        Public Const ME_PROPERTY_NAME_SUBTYPE As String = "Subtype"
        Public Const ME_PROPERTY_NAME_NUMBER_OF_CHANNELS As String = "NumberOfChannels"
        Public Const ME_PROPERTY_NAME_CONFIGURABLE As String = "Configurable"
        Public Const ME_PROPERTY_NAME_NUMBER_OF_CONFIGURATIONS As String = "NumberOfConfigurations"
        Public Const ME_PROPERTY_NAME_CURRENT_CONFIGURATION As String = "CurrentConfiguration"
        Public Const ME_CONTAINER_NAME_CHANNELS As String = "Channels"
        Public Const ME_CONTAINER_NAME_PREFIX_CHANNEL As String = "Channel" ' The container name for the channel with index # is "Channel#"
        Public Const ME_CONTAINER_NAME_CONFIGURATIONS As String = "Configurations"
        Public Const ME_CONTAINER_NAME_PREFIX_CONFIGURATION As String = "Configuration"    ' The container name for the configuration with index # is "Configuration#"

        '==================================================================
        ' Configuration properties
        '==================================================================

        Public Const ME_PROPERTY_NAME_SUBDEVICE_TYPE As String = "SubdeviceType"
        Public Const ME_PROPERTY_NAME_SUBDEVICE_SUBTYPE As String = "SubdeviceSubtype"
        Public Const ME_PROPERTY_NAME_SUBDEVICE_NUMBER_OF_CHANNELS As String = "SubdeviceNumberOfChannels"

        '==================================================================
        ' ME-5100 and ME-5001 - additional device properties
        '==================================================================

        Public Const ME_PROPERTY_NAME_IO_PIN_VOLTAGE_LEVEL As String = "IOPinVoltageLevel"
        Public Const ME_PROPERTY_NAME_SUBDEVICES_0_AND_1_TERMINATED As String = "Subdevice0And1Terminated"
        Public Const ME_PROPERTY_NAME_SUBDEVICES_2_AND_3_TERMINATED As String = "Subdevice2And3Terminated"

        '==================================================================
        ' Additional sub-device properties for various sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_TERMINATED As String = "Terminated"
        Public Const ME_PROPERTY_NAME_SYSTEM_CLOCK_FREQUENCY As String = "SystemClockFrequency"

        '==================================================================
        ' Additional sub-device properties and containers for DI and DO sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_TRIGGER_TYPE As String = "TriggerType"
        Public Const ME_PROPERTY_NAME_PREFIX_RISING_EDGE_BIT As String = "RisingEdgeBit"    ' The name for the trigger condition on bit # is "RisingEdgeBit#"
        Public Const ME_PROPERTY_NAME_PREFIX_FALLING_EDGE_BIT As String = "FallingEdgeBit"    ' The name for the trigger condition on bit # is "FallngEdgeBit#"
        Public Const ME_PROPERTY_NAME_INTERNAL_BUFFER_SIZE As String = "InternalBufferSize"
        Public Const ME_PROPERTY_NAME_SAMPLE_FREQUENCY As String = "SampleFrequency"
        Public Const ME_PROPERTY_NAME_SAMPLE_TIME As String = "SampleTime"
        Public Const ME_PROPERTY_NAME_START_TRIGGER_TYPE As String = "StartTriggerType"
        Public Const ME_PROPERTY_NAME_CONV_TRIGGER_TYPE As String = "ConvTriggerType"
        Public Const ME_PROPERTY_NAME_STOP_TRIGGER_TYPE As String = "StopTriggerType"
        Public Const ME_PROPERTY_NAME_START_STOP_PATTERN As String = "StartStopPattern"
        Public Const ME_PROPERTY_NAME_STOP_ON_COUNT As String = "StopOnCount"
        Public Const ME_PROPERTY_NAME_STOP_COUNT As String = "StopCount"
        Public Const ME_CONTAINER_NAME_INTERRUPT_CONDITION As String = "InterruptCondition"
        Public Const ME_CONTAINER_NAME_SINGLE_CONFIGURATION As String = "SingleConfiguration"
        Public Const ME_CONTAINER_NAME_EXT_DIGITAL_TRIGGER_CONDITION As String = "ExtDigitalTriggerCondition"
        Public Const ME_CONTAINER_NAME_STREAMING_CONFIGURATION As String = "StreamingConfiguration"
        Public Const ME_CONTAINER_NAME_START_AND_CONV_TRIGGER_CONDITION As String = "StartAndConvTriggerCondition"
        Public Const ME_CONTAINER_NAME_STOP_TRIGGER_CONDITION As String = "StopTriggerCondition"
        Public Const ME_CONTAINER_NAME_IRQ_CONFIGURATION As String = "IRQConfiguration"

        '==================================================================
        ' Additional sub-device properties for AI sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_CALIBRATION             As String = "Calibration"
        Public Const ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A1  As String = "RisingEdgeTriggerA1"
        Public Const ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A1 As String = "FallingEdgeTriggerA1"
        Public Const ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A2  As String = "RisingEdgeTriggerA2"
        Public Const ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A2 As String = "FallingEdgeTriggerA2"
        Public Const ME_PROPERTY_NAME_ACQUIRE_CHANNEL         As String = "AcquireChannel"

        '==================================================================
        ' Additional sub-device properties and containers for DI sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A As String   = "RisingEdgeTriggerA"
        Public Const ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A As String  = "FallingEdgeTriggerA"
        Public Const ME_PROPERTY_NAME_USE_INTERNAL_TEST_COUNTER As String = "UseInternalTestCounter"
        Public Const ME_PROPERTY_NAME_TRANSFER_SIZE As String = "TransferSize"
        Public Const ME_PROPERTY_NAME_IRQ_SOURCE As String = "IRQSource"
        Public Const ME_PROPERTY_NAME_BIT_PATTERN As String = "BitPattern"
        Public Const ME_PROPERTY_NAME_BIT_PATTERN_FILTERING As String = "BitPatternFiltering"
        Public Const ME_PROPERTY_CONTAINER_BIT_MASK As String = "BitMask"

        '==================================================================
        ' Additional sub-device properties and containers for DO sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_B As String  = "RisingEdgeTriggerB"
        Public Const ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_B As String = "FallingEdgeTriggerB"
        Public Const ME_PROPERTY_NAME_IRQ_ON_EXCESS_TEMPERATURE As String = "IRQOnExcessTemperature"
        Public Const ME_PROPERTY_NAME_IRQ_ON_NORMAL_TEMPERATURE As String = "IRQOnNormalTemperature"
        Public Const ME_PROPERTY_NAME_STOP_PATTERN As String = "StopPattern"
        Public Const ME_PROPERTY_NAME_WRAPAROUND As String = "Wraparound"
        Public Const ME_PROPERTY_NAME_WRAPAROUND_LOOPS As String = "WraparoundLoops"

        '==================================================================
        ' Additional sub-device properties and containers for DO and FO sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_OUTPUT_MODE As String = "OutputMode"

        '==================================================================
        ' Additional sub-device properties and containers for DIO sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_DIRECTION As String = "Direction"

        '==================================================================
        ' Additional sub-device properties FI sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TICKS As String = "MinMeasurableTotalTicks"
        Public Const ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TICK As String = "MaxMeasurableTotalTicks"
        Public Const ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TICKS As String = "MinMeasurableFirstPhaseTicks"
        Public Const ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TICKS As String = "MaxMeasurableFirstPhaseTicks"
        Public Const ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TIME As String = "MinMeasurableTotalTime"
        Public Const ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TIME As String = "MaxMeasurableTotalTime"
        Public Const ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TIME As String = "MinMeasurableFirstPhaseTime"
        Public Const ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TIME As String = "MaxMeasurableFirstPhaseTime"

        '==================================================================
        ' Additional sub-device properties for FO sub-device types
        '==================================================================

        Public Const ME_PROPERTY_NAME_MIN_TOTAL_TICKS As String = "MinTotalTicks"
        Public Const ME_PROPERTY_NAME_MAX_TOTAL_TICK As String = "MaxTotalTicks"
        Public Const ME_PROPERTY_NAME_MIN_FIRST_PHASE_TICKS As String = "MinFirstPhaseTicks"
        Public Const ME_PROPERTY_NAME_MAX_FIRST_PHASE_TICKS As String = "MaxFirstPhaseTicks"
        Public Const ME_PROPERTY_NAME_MIN_TOTAL_TIME As String = "MinTotalTime"
        Public Const ME_PROPERTY_NAME_MAX_TOTAL_TIME As String = "MaxTotalTime"
        Public Const ME_PROPERTY_NAME_MIN_FIRST_PHASE_TIME As String = "MinFirstPhaseTime"
        Public Const ME_PROPERTY_NAME_MAX_FIRST_PHASE_TIME As String = "MaxFirstPhaseTime"

        '==================================================================
        ' FO sub-device channel properties
        '==================================================================

        Public Const ME_PROPERTY_NAME_INVERTED As String = "Inverted"
        Public Const ME_PROPERTY_NAME_SYNCHRONOUS_START As String = "SynchronousStart"
        Public Const ME_PROPERTY_NAME_SOFT_START As String = "SoftStart"

        '==================================================================
        ' Counter sub-devices - additional sub-device properties
        '==================================================================

        Public Const ME_PROPERTY_NAME_WIDTH_IN_BITS As String = "WidthInBits"
        Public Const ME_PROPERTY_NAME_CLOCK_SOURCE As String = "ClockSource"
        Public Const ME_PROPERTY_NAME_COUNTER_MODE As String = "CounterMode"

#End Region

#Region "ErrorCodes"
        Public Const ME_ERRNO_SUCCESS As Integer = 0
        Public Const ME_ERRNO_INVALID_DEVICE As Integer = 1
        Public Const ME_ERRNO_INVALID_SUBDEVICE As Integer = 2
        Public Const ME_ERRNO_INVALID_CHANNEL As Integer = 3
        Public Const ME_ERRNO_INVALID_SINGLE_CONFIG As Integer = 4
        Public Const ME_ERRNO_INVALID_REF As Integer = 5
        Public Const ME_ERRNO_INVALID_TRIG_CHAN As Integer = 6
        Public Const ME_ERRNO_INVALID_TRIG_TYPE As Integer = 7
        Public Const ME_ERRNO_INVALID_TRIG_EDGE As Integer = 8
        Public Const ME_ERRNO_INVALID_TIMEOUT As Integer = 9
        Public Const ME_ERRNO_INVALID_FLAGS As Integer = 10
        Public Const ME_ERRNO_OPEN As Integer = 11
        Public Const ME_ERRNO_CLOSE As Integer = 12
        Public Const ME_ERRNO_NOT_OPEN As Integer = 13
        Public Const ME_ERRNO_INVALID_DIR As Integer = 14
        Public Const ME_ERRNO_PREVIOUS_CONFIG As Integer = 15
        Public Const ME_ERRNO_NOT_SUPPORTED As Integer = 16
        Public Const ME_ERRNO_SUBDEVICE_TYPE As Integer = 17
        Public Const ME_ERRNO_USER_BUFFER_SIZE As Integer = 18
        Public Const ME_ERRNO_LOCKED As Integer = 19
        Public Const ME_ERRNO_NO_MORE_SUBDEVICE_TYPE As Integer = 20
        Public Const ME_ERRNO_TIMEOUT As Integer = 21
        Public Const ME_ERRNO_SIGNAL As Integer = 22
        Public Const ME_ERRNO_INVALID_IRQ_SOURCE As Integer = 23
        Public Const ME_ERRNO_THREAD_RUNNING As Integer = 24
        Public Const ME_ERRNO_START_THREAD As Integer = 25
        Public Const ME_ERRNO_CANCEL_THREAD As Integer = 26
        Public Const ME_ERRNO_NO_CALLBACK As Integer = 27
        Public Const ME_ERRNO_USED As Integer = 28
        Public Const ME_ERRNO_INVALID_UNIT As Integer = 29
        Public Const ME_ERRNO_INVALID_MIN_MAX As Integer = 30
        Public Const ME_ERRNO_NO_RANGE As Integer = 31
        Public Const ME_ERRNO_INVALID_RANGE As Integer = 32
        Public Const ME_ERRNO_SUBDEVICE_BUSY As Integer = 33
        Public Const ME_ERRNO_INVALID_LOCK As Integer = 34
        Public Const ME_ERRNO_INVALID_SWITCH As Integer = 35
        Public Const ME_ERRNO_INVALID_ERROR_MSG_COUNT As Integer = 36
        Public Const ME_ERRNO_INVALID_STREAM_CONFIG As Integer = 37
        Public Const ME_ERRNO_INVALID_CONFIG_LIST_COUNT As Integer = 38
        Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE As Integer = 39
        Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE As Integer = 40
        Public Const ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN As Integer = 41
        Public Const ME_ERRNO_INVALID_ACQ_START_TIMEOUT As Integer = 42
        Public Const ME_ERRNO_INVALID_ACQ_START_ARG As Integer = 43
        Public Const ME_ERRNO_INVALID_SCAN_START_TRIG_TYPE As Integer = 44
        Public Const ME_ERRNO_INVALID_SCAN_START_ARG As Integer = 45
        Public Const ME_ERRNO_INVALID_CONV_START_TRIG_TYPE As Integer = 46
        Public Const ME_ERRNO_INVALID_CONV_START_ARG As Integer = 47
        Public Const ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE As Integer = 48
        Public Const ME_ERRNO_INVALID_SCAN_STOP_ARG As Integer = 49
        Public Const ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE As Integer = 50
        Public Const ME_ERRNO_INVALID_ACQ_STOP_ARG As Integer = 51
        Public Const ME_ERRNO_SUBDEVICE_NOT_RUNNING As Integer = 52
        Public Const ME_ERRNO_INVALID_READ_MODE As Integer = 53
        Public Const ME_ERRNO_INVALID_VALUE_COUNT As Integer = 54
        Public Const ME_ERRNO_INVALID_WRITE_MODE As Integer = 55
        Public Const ME_ERRNO_INVALID_TIMER As Integer = 56
        Public Const ME_ERRNO_DEVICE_UNPLUGGED As Integer = 57
        Public Const ME_ERRNO_USED_INTERNAL As Integer = 58
        Public Const ME_ERRNO_INVALID_DUTY_CYCLE As Integer = 59
        Public Const ME_ERRNO_INVALID_WAIT As Integer = 60
        Public Const ME_ERRNO_CONNECT_REMOTE As Integer = 61
        Public Const ME_ERRNO_COMMUNICATION As Integer = 62
        Public Const ME_ERRNO_INVALID_SINGLE_LIST As Integer = 63
        Public Const ME_ERRNO_INVALID_MODULE_TYPE As Integer = 64
        Public Const ME_ERRNO_INVALID_START_MODE As Integer = 65
        Public Const ME_ERRNO_INVALID_STOP_MODE As Integer = 66
        Public Const ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD As Integer = 67
        Public Const ME_ERRNO_INVALID_POINTER As Integer = 68
        Public Const ME_ERRNO_CREATE_EVENT As Integer = 69
        Public Const ME_ERRNO_LACK_OF_RESOURCES As Integer = 70
        Public Const ME_ERRNO_CANCELLED As Integer = 71
        Public Const ME_ERRNO_RING_BUFFER_OVERFLOW As Integer = 72
        Public Const ME_ERRNO_SOFTWARE_BUFFER_OVERFLOW As Integer = ME_ERRNO_RING_BUFFER_OVERFLOW
        Public Const ME_ERRNO_RING_BUFFER_UNDERFLOW As Integer = 73
        Public Const ME_ERRNO_SOFTWARE_BUFFER_UNDERFLOW As Integer = ME_ERRNO_RING_BUFFER_UNDERFLOW
        Public Const ME_ERRNO_INVALID_IRQ_EDGE As Integer = 74
        Public Const ME_ERRNO_INVALID_IRQ_ARG As Integer = 75
        Public Const ME_ERRNO_INVALID_CAP As Integer = 76
        Public Const ME_ERRNO_INVALID_CAP_ARG_COUNT As Integer = 77
        Public Const ME_ERRNO_INTERNAL As Integer = 78
        Public Const ME_ERRNO_VALUE_OUT_OF_RANGE As Integer = 79
        Public Const ME_ERRNO_HARDWARE_FIFO_OVERFLOW As Integer = 80
        Public Const ME_ERRNO_HARDWARE_BUFFER_OVERFLOW As Integer = ME_ERRNO_HARDWARE_FIFO_OVERFLOW
        Public Const ME_ERRNO_HARDWARE_FIFO_UNDERFLOW As Integer = 81
        Public Const ME_ERRNO_HARDWARE_BUFFER_UNDERFLOW As Integer = ME_ERRNO_HARDWARE_FIFO_UNDERFLOW
        Public Const ME_ERRNO_CONFIG_LOAD_FAILED As Integer = 82
        Public Const ME_ERRNO_PROPERTY_CONTAINER As Integer = 83
        Public Const ME_ERRNO_PROPERTY_NOT_A_CONTAINER As Integer = 84
        Public Const ME_ERRNO_PROPERTY_DATA_TYPE As Integer = 85
        Public Const ME_ERRNO_PROPERTY_PATH As Integer = 86
        Public Const ME_ERRNO_PROPERTY_INDEX As Integer = 87
        Public Const ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL As Integer = 88
        Public Const ME_ERRNO_PROPERTY_UNKNOWN As Integer = 89
        Public Const ME_ERRNO_PROPERTY_ATTRIBUTE_UNKNOWN As Integer = 90
        Public Const ME_ERRNO_PROPERTY_ATTRIBUTE_UNSUPPORTED As Integer = 91
        Public Const ME_ERRNO_PROPERTY_SELECTION_INVALID As Integer = 92
        Public Const ME_ERRNO_PROPERTY_VALUE_INVALID As Integer = 93
        Public Const ME_ERRNO_PROPERTY_READ_ONLY As Integer = 94

        '==============================================================================
        '  ME_ERRNO_INVALID_ERROR_NUMBER is always the error constant
        '  with the greatest number when new error codes are added
        '==============================================================================
        Public Const ME_ERRNO_INVALID_ERROR_NUMBER As Integer = 95

#End Region

#Region "MEiDSTypes"
#Region "IOSingle"
        '-------------------------------------------------------------------
        '
        '  me-iDS Types
        '  Declares a managed structure for each unmanaged structure.
        '-------------------------------------------------------------------
        ''' <summary>
        ''' Contains the parameters to read a single value from
        ''' or to write a single value to a subdevice.
        ''' Used with function meIOSingle()
        ''' </summary>
        <StructLayout(LayoutKind.Sequential)> _
        Public Structure meIOSingle_t
            ''' <summary>
            '''    Index of the device to be accessed.
            ''' </summary>
            Public iDevice As Integer
            ''' <summary>
            '''    Index of the sub-device to be accessed.
            ''' </summary>
            Public iSubdevice As Integer
            ''' <summary>
            '''    Channel index resp. index of the group
            ''' </summary>
            Public iChannel As Integer
            ''' <summary>
            '''    Direction of the single operation
            ''' </summary>
            ''' <remarks>
            ''' ME_DIR_INPUT, ME_DIR_OUTPUT, ME_DIR_SET_OFFSET
            ''' </remarks>
            Public iDir As Integer
            ''' <summary>
            ''' Read resp. output a 32 bit digital value. ME_DIR_INPUT, ME_DIR_OUTPUT, ME_DIR_SET_OFFSET
            ''' </summary>
            Public iValue As Integer
            ''' <summary>
            ''' Time-out value in milliseconds. If no external trigger is being used or no time-out value is used, pass 0
            ''' </summary>
            Public iTimeOut As Integer
            ''' <summary>
            ''' Extended settings depending on the operation
            ''' </summary>
            Public iFlags As Integer
            ''' <summary>
            ''' Error code returned by the particular entry
            ''' </summary>
            Public iErrno As Integer
        End Structure
#End Region

#Region "IOStream"
        ''' <summary>
        ''' Channel-list for analog and digital (bit pattern output) streaming operations
        ''' </summary>
        <StructLayout(LayoutKind.Sequential)> _
        Public Structure meIOStreamConfig_t
            ''' <summary>
            ''' Channel index. Depending on sub-device this can be analog inputs or outputs as well as a group of digital I/Os
            ''' </summary>
            Public iChannel As Integer
            ''' <summary>
            ''' Index of analog input or analog output range
            ''' </summary>
            Public iStreamConfig As Integer
            ''' <summary>
            ''' Defines the ground reference for analog inputs and outputs, ME_REF_NONE, ME_REF_AI_GROUND, ME_REF_AI_DIFFERENTIAL, ME_REF_AO_GROUND, ME_REF_AO_DIFFERENTIAL
            ''' </summary>
            Public iRef As Integer
            ''' <summary>
            ''' Extended settings, if no extended options available, use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS
            ''' </summary>
            Public iFlags As Integer
        End Structure

        ''' <summary>
        ''' Defines parameters to start and stop streaming operations.
        ''' </summary>
        <StructLayout(LayoutKind.Sequential, Pack:=4)> _
        Public Structure meIOStreamTrigger_t
            ''' <summary>
            ''' defines the trigger type for start of the whole operation (ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_ANALOG, ME_TRIG_TYPE_THRESHOLD...)
            ''' </summary>
            Public iAcqStartTrigType As Integer
            ''' <summary>
            ''' defines the trigger edge for start of a single conversion (ME_TRIG_EDGE_NONE, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING...)
            ''' </summary>
            Public iAcqStartTrigEdge As Integer
            ''' <summary>
            ''' choose whether triggering should be done separatly for each channel (standard) or if a channel should be started synchronously with other channels
            ''' </summary>
            Public iAcqStartTrigChan As Integer
            ''' <summary>
            ''' Offset time in number of ticks between "start" of the measurement and the first conversion.
            ''' </summary>
            Public iAcqStartTicksLow As Integer
            ''' <summary>
            ''' Higher significant part of the offset time (bits 63...32)
            ''' </summary>
            Public iAcqStartTicksHigh As Integer
            ''' <summary>
            ''' List of Start Arguments (threshold value in [µV], slew rate in [µV/Sample], lower threshold value of the window in [µV])
            ''' </summary>
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public iAcqStartArgs As Integer()
            ''' <summary>
            ''' defines the trigger type for start of a scan (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_FOLLOW, ME_TRIG_TYPE_EXT_DIGITAL...)
            ''' </summary>
            Public iScanStartTrigType As Integer
            ''' <summary>
            ''' Time interval in ticks between the start of two consecutive scans
            ''' </summary>
            Public iScanStartTicksLow As Integer
            ''' <summary>
            ''' Higher significant part of the scan-time (bits 63...32)
            ''' </summary>
            Public iScanStartTicksHigh As Integer
            ''' <summary>
            ''' reserved
            ''' </summary>
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public iScanStartArgs As Integer()
            ''' <summary>
            ''' defines the trigger type for start of a single conversion (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_EXT_ANALOG)
            ''' </summary>
            Public iConvStartTrigType As Integer
            ''' <summary>
            ''' Chan interval in number of ticks between two conversions (Sample resp. output rate)
            ''' </summary>
            Public iConvStartTicksLow As Integer
            ''' <summary>
            ''' Higher significant part of the chan interval (bits 63...32)
            ''' </summary>
            Public iConvStartTicksHigh As Integer
            ''' <summary>
            ''' reserved
            ''' </summary>
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public iConvStartArgs As Integer()
            ''' <summary>
            ''' defines the trigger type for ending the scan (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT)
            ''' </summary>
            Public iScanStopTrigType As Integer
            ''' <summary>
            ''' Total number of conversions after which the scans will be ended and at the same time the measurement as a whole.
            ''' </summary>
            Public iScanStopCount As Integer
            ''' <summary>
            ''' MEphisto Scope in oscilloscope mode: trigger point in percent between 0%...100%
            ''' </summary>
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public iScanStopArgs As Integer()
            ''' <summary>
            ''' defines the trigger type for ending the whole operation (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT, ME_TRIG_TYPE_FOLLOW)
            ''' </summary>
            Public iAcqStopTrigType As Integer
            ''' <summary>
            ''' Number of scans (channel-list processings) after which the complete operation should be ended
            ''' </summary>
            Public iAcqStopCount As Integer
            ''' <summary>
            ''' reserved
            ''' </summary>
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public iAcqStopArgs As Integer()
            ''' <summary>
            ''' ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS (default) (no flags available)
            ''' </summary>
            Public iFlags As Integer
        End Structure

        ''' <summary>
        ''' StartList, defines parameters for the start of streaming operations
        ''' </summary>
        <StructLayout(LayoutKind.Sequential)> _
        Public Structure meIOStreamStart_t
            ''' <summary>
            ''' Index of the device to be accessed
            ''' </summary>
            Public iDevice As Integer
            ''' <summary>
            ''' Index of the sub-device to be accessed
            ''' </summary>
            Public iSubdevice As Integer
            ''' <summary>
            ''' Blocking or Nonblocking start mode of the streaming operation
            ''' </summary>
            ''' <remarks>
            ''' ME_START_MODE_BLOCKING (waits until the proper trigger signal occurs), ME_START_MODE_NONBLOCKING (Function returns immediately)
            ''' </remarks>
            Public iStartMode As Integer
            ''' <summary>
            ''' Time interval in milliseconds within the first trigger pulse must occur
            ''' </summary>
            Public iTimeOut As Integer
            ''' <summary>
            ''' Extended settings, Start particular subdevice only or several subdevices synchronously
            ''' </summary>
            ''' <remarks>
            ''' ME_IO_STREAM_START_TYPE_NO_FLAGS default setting, ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for Synchronous start
            ''' </remarks>
            Public iFlags As Integer
            ''' <summary>
            ''' If an error occurs, an error code will be set.
            ''' </summary>
            Public iErrno As Integer
        End Structure

        ''' <summary>
        ''' StopList, defines end of input/output streaming operations
        ''' </summary>
        <StructLayout(LayoutKind.Sequential)> _
        Public Structure meIOStreamStop_t
            ''' <summary>
            ''' Index of the device to be accessed.
            ''' </summary>
            Public iDevice As Integer
            ''' <summary>
            ''' Index of the sub-device to be accessed.
            ''' </summary>
            Public iSubdevice As Integer
            ''' <summary>
            ''' Stop mode of the streaming operation
            ''' </summary>
            ''' <remarks>
            ''' <see cref="ME_STOP_MODE_IMMEDIATE"/>: Streaming operation is stopped at once.
            ''' In case of an analog output 0V is attached to the pin.
            ''' <see cref="ME_STOP_MODE_LAST_VALUE"/>: Output sub-device: operation is stopped on the last entry
            ''' in the DA-FIFO which is a defined value.
            ''' Input sub-device: operation is stopped on the last entry from the channel-list.
            ''' </remarks>
            Public iStopMode As Integer
            ''' <summary>
            ''' <see cref="ME_IO_STREAM_STOP_TYPE_NO_FLAGS"/>: Default settings.
            ''' </summary>
            ''' <remarks>
            ''' Output sub-device: all buffers are cleared.
            ''' Input sub-device: Hardware buffer is cleared. No synchronization at all.
            ''' In mode <see cref="ME_STOP_MODE_IMMEDIATE"/> some data can be lost.
            ''' </remarks>
            Public iFlags As Integer
            ''' <summary>
            ''' If an error occurs, an error code will be set.
            ''' </summary>
            Public iErrno As Integer
        End Structure
#End Region

#End Region '"MEiDSTypes"

#Region "Delegates"

        ''' <summary>
        ''' Delegate type to be used for <see cref="meErrorSetUserProc"/>.
        ''' </summary>
        ''' <param name="functionName">
        ''' String with the name of the faulty function where the error was detected.
        ''' </param>
        ''' <param name="errorCode">
        ''' The error code.
        ''' </param>
        ''' <returns>
        ''' No error possible. Return "0".
        ''' </returns>
        Public Delegate Function meErrorCB_t(ByVal functionName As String, ByVal errorCode As Integer) As Integer

        ''' <summary>
        ''' Delegate type to be used for <see cref="meIOStreamSetCallbacks"/>.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the interrupt sub-device.
        ''' </param>
        ''' <param name="count">
        ''' Input sub-device: number of values, which can be read
        ''' Output sub-device: Free memory in the output buffer.
        ''' </param>
        ''' <param name="context">
        ''' User-defined pointer.
        ''' </param>
        ''' <param name="errorCode">
        ''' If an error occurs an error code will be returned.
        ''' </param>
        ''' <returns>
        ''' Return the errorCode if the operation should stop when an error occured, otherwise return "0"
        ''' </returns>
        Public Delegate Function meIOStreamCB_t(ByVal device As Integer, ByVal subdevice As Integer, ByVal count As Integer, ByVal context As IntPtr, ByVal errorCode As Integer) As Integer

        ''' <summary>
        ''' Delegate type to be used for <see cref="meIOIrqSetCallback"/>.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the interrupt sub-device.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the interrupt channel within the sub-device
        ''' </param>
        ''' <param name="irqCount">
        ''' Number of interrupts from the specified channel since starting.
        ''' </param>
        ''' <param name="value">
        ''' Parameter returns the interrupt status.
        ''' </param>
        ''' <param name="context">
        ''' User-defined pointer.
        ''' </param>
        ''' <param name="errorCode">
        ''' Error code: see error reported by <see cref="meIOIrqWait"/>.
        ''' </param>
        ''' <returns>
        ''' Return the errorCode if the operation should stop when an error occured, otherwise return "0"
        ''' </returns>
        Public Delegate Function meIOIrqCB_t(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByVal irqCount As Integer, ByVal value As Integer, ByVal context As IntPtr, ByVal errorCode As Integer) As Integer

#End Region

#Region "MEiDSFunctions"
        '-------------------------------------------------------------------
        '
        '  ME-iDS Functions
        '  Functions to access the driver system
        '  CallingConvention.Cdecl must be used since the stack is cleaned up by the caller.
        '-------------------------------------------------------------------

#Region "meOpen"

        ''' <summary>
        ''' Initializes the function library.
        ''' </summary>
        ''' <param name="flags">Use <see cref="ME_OPEN_NO_FLAGS"/>.</param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_OPEN"/>: ME-iDS can not be properly opened. Usually driver is not loaded.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' Before the ME-iDS driver functions can be used this function must be called.
        ''' Otherwise the function calls will fail.
        ''' In case of an error <see cref="meClose"/> doesn't have to be called.
        ''' </remarks>
        ''' <seealso cref="meClose"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meOpen(ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meClose"

        ''' <summary>
        ''' This function closes the connection to the function library.
        ''' </summary>
        ''' <param name="flags">
        ''' Use <see cref="ME_CLOSE_NO_FLAGS"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_CLOSE"/>: ME-iDS can not be properly closed.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' Call this function to release resources and to disconnect from the ME-iDS driver.
        ''' </remarks>
        ''' <seealso cref="meOpen"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meClose(ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meLockDriver"
        ''' <summary>
        ''' Locks or unlocks the entire ME-iDS driver system.
        ''' </summary>
        ''' <param name="lockMode">
        ''' The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        ''' </param>
        ''' <param name="flags">
        ''' Use <see cref="ME_LOCK_DRIVER_NO_FLAGS"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        ''' <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' If another thread wants access to the driver system an error message is returned.
        ''' </remarks>
        ''' <seealso cref="meLockDevice"/>
        ''' <seealso cref="meLockSubdevice"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meLockDriver(ByVal lockMode As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meLockDevice"
        ''' <summary>
        ''' Locks or unlocks a ME-iDS device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="lockMode">
        ''' The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        ''' </param>
        ''' <param name="flags">
        ''' Use <see cref="ME_LOCK_DEVICE_NO_FLAGS"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        ''' <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' If another thread wants to access to a locked device an error message is returned.
        ''' </remarks>
        ''' <seealso cref="meLockDriver"/>
        ''' <seealso cref="meLockSubdevice"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meLockDevice(ByVal device As Integer, ByVal lockMode As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meLockDevice"
        ''' <summary>
        ''' Locks or unlocks a sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="lockMode">
        ''' The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        ''' </param>
        ''' <param name="flags">
        ''' Use <see cref="ME_LOCK_SUBDEVICE_NO_FLAGS"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        ''' <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' If another thread wants to access to a locked sub-device an error message is returned.
        ''' </remarks>
        ''' <seealso cref="meLockDevice"/>
        ''' <seealso cref="meLockDriver"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meLockSubdevice(ByVal device As Integer, ByVal subdevice As Integer, ByVal lockMode As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meErrorGetLast"
        ''' <summary>
        ''' Returns the last error code.
        ''' </summary>
        ''' <param name="errorCode">
        ''' Variable that receives the error code.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_NO_FLAGS"/>: Default setting.
        ''' <see cref="ME_ERRNO_CLEAR_FLAGS"/>: Do not report this error again.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <seealso cref="meErrorGetLastMessage"/>
        ''' <seealso cref="meErrorGetMessage"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meErrorGetLast(ByRef errorCode As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meErrorGetLastMessage"

        ''' <summary>
        ''' Returns the last error caused by an API function.
        ''' </summary>
        ''' <param name="buffer">
        ''' Buffer to hold the error description text.
        ''' </param>
        ''' <param name="count">
        ''' Buffer size in bytes for the error description text. Use the constant <see cref="ME_ERROR_MSG_MAX_COUNT"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_ERROR_MSG_COUNT"/>: reserved buffer is too small for description.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <seealso cref="meErrorGetMessage"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meErrorGetLastMessage(buffer As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meErrorGetMessage"
        ''' <summary>
        ''' Converts an error code returned from an API function to plain text.
        ''' </summary>
        ''' <param name="errorCode">
        ''' The error code from the API function.
        ''' </param>
        ''' <param name="msg">
        ''' Buffer to hold the error description text.
        ''' </param>
        ''' <param name="count">
        ''' Buffer size in bytes for the error description text. Use the constant ME_ERROR_MSG_MAX_COUNT.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_ERROR_NUMBER"/>: provided error code is not valid in ME-iDS.
        ''' <see cref="ME_ERRNO_INVALID_ERROR_MSG_COUNT"/>: reserved buffer is too small for description.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <seealso cref="meErrorGetLastMessage"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meErrorGetMessage(ByVal errorCode As Integer, msg As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meErrorSetDefaultProc"
        ''' <summary>
        ''' Installs a predefined global error logging routine for the entire ME-iDS.
        ''' </summary>
        ''' <param name="switch">
        ''' <see cref="ME_SWITCH_ENABLE"/>Installing the predefined error routine for global error logging.
        ''' <see cref="ME_SWITCH_DISABLE"/>Uninstall the predefined error routine.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_SWITCH"/>: passed action code is not supported.
        ''' </returns>
        ''' <remarks>
        ''' This global error routine is automatically called if any function call returns an error.
        ''' Only one global error routine can be installed.
        ''' The following infos are returned:
        ''' -Name of the function causing the error
        ''' -Short error description
        ''' -Error code
        ''' </remarks>
        ''' <seealso cref="meErrorSetUserProc"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meErrorSetDefaultProc(ByVal switch As Integer) As Integer
        End Function
#End Region

#Region "meErrorSetUserProc"
        ''' <summary>
        ''' Installs a global user-defined error logging routine for the ME-iDS.
        ''' </summary>
        ''' <param name="errorProc">
        ''' Delegate to the user-defined error logging routine.
        ''' See <see cref="meErrorCB_t"/>
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' </returns>
        ''' <remarks>
        ''' This function is automatically called if any function call returns an error.
        ''' Passing a NULL will uninstall a previously installed error routine.
        ''' The following infos are returned:
        ''' -Name of the function causing the error
        ''' -Error code
        ''' </remarks>
        ''' <seealso cref="meErrorSetDefaultProc"/>
        ''' <seealso cref="meErrorGetMessage"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meErrorSetUserProc(errorProc As meErrorCB_t) As Integer
        End Function
#End Region

#Region "meIOIrqSetCallback"
        ''' <summary>
        ''' Installs a callback function which waits for an interrupt in the background.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="callback">
        ''' Delegate to the user-defined callback function.
        ''' See <see cref="meIOIrqCB_t"/>
        ''' </param>
        ''' <param name="callbackContext">
        ''' User-defined pointer passed to the callback function.
        ''' Can be used to pass a reference of the own instance through the callback routine
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_IRQ_SET_CALLBACK_NO_FLAGS"/>: No flags in use.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Linux only)
        ''' <see cref="ME_ERRNO_THREAD_RUNNING"/>: callback thread is already running. (Windows only)
        ''' </returns>
        ''' <remarks>
        ''' To deinstall/cancel the callback function (all registered instances)
        ''' for the selected sub-device call meIOIrqSetCallback() and pass null in
        ''' <paramref name="callback"/>.
        ''' </remarks>
        ''' <example>
        ''' See also (<a href="http://msdn.microsoft.com/en-gb/magazine/cc301501.aspx">Call Unmanaged DLLs from C#, Killing Processes Cleanly</a>).
        ''' <code>
        ''' // the form contains a TextBox to display the values given by the callback function
        ''' public partial class Form1 : Form
        ''' {
        '''     meIDS.meIOIrqCB_t IrqCallback = new meIDS.meIOIrqCB_t(meIOIrqCB);   'create a delegate for Callback function
        '''     GCHandle objectHandle = new GCHandle();                             'global variable
        '''
        '''     private void MyStartIrqFunction(int deviceIndex, int subdeviceIndex)
        '''     {
        '''         objectHandle = GCHandle.Alloc(this);
        '''
        '''         int meError = meIDS.meIOIrqSetCallback(deviceIndex,             'Device index
        '''                                                subdeviceIndex,          'Subdevice index
        '''                                                IrqCallback,             'Callback routine
        '''                                                (IntPtr)objectHandle,    'Callback context, GCHandle used to wrap instance of Form
        '''                                                meIDS.ME_IO_IRQ_SET_CALLBACK_NO_FLAGS); 'No flags in use
        '''
        '''         if (meError == meIDS.ME_ERRNO_SUCCESS)
        '''         {
        '''             //callback function is armed, meIDS.meIOIrqStart() may be called
        '''             meError = meIDS.meIOIrqStart(deviceIndex,                   'Device index
        '''                                          subdeviceIndex,                'Subdevice index
        '''                                          ...
        '''                                         );
        '''             ...
        '''         }
        '''     }
        '''
        '''     private static int meIOIrqCB(int idxDevice, int idxSubdevice, int idxChannel,
        '''                                         int irqCount, int value, IntPtr pContext, int errorCode)
        '''     {
        '''         if (errorCode == meIDS.ME_ERRNO_SUCCESS)
        '''         {
        '''             GCHandle objectHandle = GCHandle.FromIntPtr(pContext);          'get objectHandle of our instance
        '''             Form1 frm = (Form1)objectHandle.Target;
        '''             frm.DisplayValues(idxDevice, idxSubdevice, idxChannel, irqCount, value, pContext, errorCode);  'display values in textBox1
        '''         }
        '''         return (0);
        '''     }
        '''
        '''     // This delegate enables asynchronous calls for setting the text in a textBox1
        '''     private delegate void DisplayValuesDelegate(int idxDevice, int idxSubdevice, int idxChannel,
        '''                                    int irqCount, int value, IntPtr context, int errorCode);
        '''
        '''     // This method demonstrates a pattern for making thread-safe calls on a Windows Forms control.
        '''     private void DisplayValues(int idxDevice, int idxSubdevice, int idxChannel,
        '''                                    int irqCount, int value, IntPtr context, int errorCode)
        '''     {
        '''         // InvokeRequired compares the thread ID of the calling thread to the thread ID of the creating thread.
        '''         // If these threads are different, it returns true.
        '''         if (textBox1.InvokeRequired)
        '''         {
        '''             //The calling thread is different from the thread that created the TextBox.
        '''             //The method creates a SetTextCallback and calls itself asynchronously using the Invoke method.
        '''             DisplayValuesDelegate dispDelegate = new DisplayValuesDelegate(DisplayValues);
        '''             this.Invoke(dispDelegate, new object[] {idxDevice,  idxSubdevice, idxChannel, irqCount, value, context, errorCode});
        '''         }
        '''         else
        '''         {
        '''             //The calling thread is the same as the thread that created the TextBox
        '''             //The Text property is set directly.
        '''             textBox1.AppendText("Device index: " + idxDevice.ToString()
        '''                        + ",  Subdevice index: " + idxSubdevice.ToString()
        '''                        + String.Format(",  Value hex: 0x{0:X}", value)      'display value in hexadecimal
        '''                        + ",  dec: " + value.ToString()                      'display value in decimal
        '''                        + Environment.NewLine);
        '''         }
        '''     }
        '''
        '''     private void MyStopIrqFunction(int deviceIndex, int subdeviceIndex)
        '''     {
        '''         //disable generating IRQs
        '''         meIDS.meIOIrqStop(deviceIndex,
        '''                           subdevIndex,
        '''                           0,
        '''                           meIDS.ME_IO_IRQ_STOP_NO_FLAGS);
        '''
        '''         //Don't forget to call Free for objectHandle
        '''         if (objectHandle.IsAllocated)
        '''         {
        '''             objectHandle.Free();                        ' do this when callback cannot be called anymore
        '''         }
        '''     }
        ''' }
        ''' </code>
        ''' </example>
        ''' <seealso cref="meIOIrqWait"/>
        ''' <seealso cref="meIOIrqStart"/>
        ''' <seealso cref="meIOIrqStop"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOIrqSetCallback(ByVal device As Integer, ByVal subdevice As Integer, callback As meIOIrqCB_t, ByVal callbackContext As IntPtr, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOIrqStart"
        ''' <summary>
        ''' Starts the interrupt handler for the given interrupt sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the interrupt channel within the selected sub-device.
        ''' </param>
        ''' <param name="irqSource">
        ''' Selection of interrupt source
        ''' <see cref="ME_IRQ_SOURCE_DIO_LINE"/>: Interrupt source is a dedicated external interrupt input.
        ''' <see cref="ME_IRQ_SOURCE_DIO_PATTERN"/>: Operation mode "Bit Pattern Match".
        ''' When the current bit pattern at the digital port matches the reference bit pattern to be passed in <paramref name="irqArg"/> an interrupt is triggered.
        ''' <see cref="ME_IRQ_SOURCE_DIO_MASK"/>: Operation mode "Bit Pattern Change".
        ''' On change of at least one bit, masked as "sensitive" an interrupt is triggered.
        ''' <see cref="ME_IRQ_SOURCE_DIO_OVER_TEMP"/>: On overheating of the driver circuit an interrupt is triggered.
        ''' </param>
        ''' <param name="irqEdge">
        ''' Selection of the edge on which an interrupt should be triggered.
        ''' <see cref="ME_IRQ_EDGE_NOT_USED"/>: Choosing an edge is not supported
        ''' <see cref="ME_IRQ_EDGE_RISING"/>: Interrupt on rising edge
        ''' <see cref="ME_IRQ_EDGE_FALLING"/>: Interrupt on falling edge
        ''' <see cref="ME_IRQ_EDGE_ANY"/>: Interrupt on rising or falling edge
        ''' </param>
        ''' <param name="irqArg">
        ''' Argument to configure the modes "Bit Pattern Match" and "Bit Pattern Change"
        ''' In other cases pass the value "0" here.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_IRQ_START_NO_FLAGS"/>: No flags in use. Default settings will be used.
        ''' <see cref="ME_IO_IRQ_START_DIO_BIT"/>: The reference bit pattern is one bit wide.
        ''' <see cref="ME_IO_IRQ_START_DIO_BYTE"/>: The reference bit pattern is one byte wide (8 bit).
        ''' <see cref="ME_IO_IRQ_START_DIO_WORD"/>: The reference bit pattern is one word wide (16 bit).
        ''' <see cref="ME_IO_IRQ_START_DIO_DWORD"/>: The reference bit pattern is one double-word wide (32 bit).
        ''' <see cref="ME_IO_IRQ_START_PATTERN_FILTERING"/>: (for "Bit Pattern Match" only): Enables filtering of the result.
        ''' <see cref="ME_IO_IRQ_START_EXTENDED_STATUS"/>: (for "Bit Pattern Change" only): Set extended IRQ status format as default.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_INVALID_IRQ_SOURCE"/>: wrong mode or not supported by sub-device.
        ''' <see cref="ME_ERRNO_INVALID_IRQ_EDGE"/>: set edge not supported.
        ''' <see cref="ME_ERRNO_INVALID_IRQ_ARG"/>: wrong configuration argument / argument not supported.
        ''' <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Linux only)
        ''' </returns>
        ''' <remarks>
        ''' On demand an user-defined callback function can be installed by the function <see cref="meIOIrqSetCallback"/>() which is then called on each interrupt.
        ''' </remarks>
        ''' <seealso cref="meIOIrqSetCallback"/>
        ''' <seealso cref="meIOIrqWait"/>
        ''' <seealso cref="meIOIrqStop"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOIrqStart(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByVal irqSource As Integer, ByVal irqEdge As Integer, ByVal irqArg As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOIrqStop"
        ''' <summary>
        ''' Stops a previously started interrupt handler
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the interrupt channel within the selected sub-device.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_IRQ_STOP_NO_FLAGS"/>: No flags in use. Default settings will be used.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' </returns>
        ''' <seealso cref="meIOIrqStart"/>
        ''' <seealso cref="meIOIrqSetCallback"/>
        ''' <seealso cref="meIOIrqWait"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOIrqStop(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOIrqWait"
        ''' <summary>
        ''' Waits as long as an interrupt occurs.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the interrupt channel within the selected sub-device.
        ''' </param>
        ''' <param name="irqCount">
        ''' Returns the number of interrupts from the specified channel since starting.
        ''' </param>
        ''' <param name="value">
        ''' Returns the interrupt status. "Simple format": One status bit per IRQ line. "Extended format": Two status bits per IRQ line.
        ''' </param>
        ''' <param name="timeout">
        ''' Time-out value in milliseconds. If 0 is passed the function will wait indefinitely.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_IRQ_WAIT_NO_FLAGS"/>: No flags in use. Default settings will be used.
        ''' <see cref="ME_IO_IRQ_WAIT_NORMAL_STATUS"/>: Use "simple format" for interrupt status, see <paramref name="value"/>.
        ''' <see cref="ME_IO_IRQ_WAIT_EXTENDED_STATUS"/>: Use "extended format" for interrupt status, see <paramref name="value"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_CANCELLED"/>: Sub-device was reset.
        ''' <see cref="ME_ERRNO_SIGNAL"/>: Driver was unloaded.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: Sub-device wrongly configured.
        ''' </returns>
        ''' <remarks>
        ''' This function is completely independent from <seealso cref="meIOIrqStart"/>.
        ''' In multi-threading applications there is no need for synchronization.
        ''' meIOIrqWait() can be called before or after <seealso cref="meIOIrqStart"/> and waits for the first interrupt event.
        ''' If an interrupt occurs before meIOIrqWait() is called the function returns immediately and reports it.
        ''' You must decide whether you want to install a callback function by <seealso cref="meIOIrqSetCallback"/>.
        ''' before calling the function <seealso cref="meIOIrqStart"/>.
        ''' </remarks>
        ''' <seealso cref="meIOIrqStart"/>
        ''' <seealso cref="meIOIrqSetCallback"/>
        ''' <seealso cref="meIOIrqStop"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOIrqWait(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByRef irqCount As Integer, ByRef value As Integer, ByVal timeOut As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOResetDevice"
        ''' <summary>
        ''' The device will be reset.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be reset.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_RESET_DEVICE_NO_FLAGS"/>: no flags available
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' All currently executed operations of the specific device are cancelled:
        ''' - All hardware actions are stopped
        ''' - Hardware is set to default (idle) state
        ''' - Internal states are cleared
        ''' - Buffers are flushed (emptied)
        ''' - Interrupt counters are set to zero
        ''' </remarks>
        ''' <seealso cref="meIOResetSubdevice"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOResetDevice(ByVal device As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOResetSubdevice"
        ''' <summary>
        ''' The sub-device will be reset.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be reset.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_RESET_SUBDEVICE_NO_FLAGS"/>: no flags available
        ''' verfügbar.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' All currently executed operations of the specific sub-device are cancelled:
        ''' - All hardware actions are stopped
        ''' - Hardware is set to default (idle) state
        ''' - Internal states are cleared
        ''' - Buffers are flushed (emptied)
        ''' - Interrupt counters are set to zero
        ''' </remarks>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOResetSubdevice(ByVal device As Integer, ByVal subdevice As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOSingleConfig"
        ''' <summary>
        ''' Prepares a sub-device for a "single operation".
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the channel within the selected sub-device.
        ''' </param>
        ''' <param name="singleConfig">
        ''' Configuration of measurement ranges, digital ports and counters.
        ''' </param>
        ''' <param name="reference">
        ''' Depending on the subdevice type it can be a ground reference,
        ''' the clock source of the counters or <see cref="ME_REF_NONE"/>
        ''' for standard digital I/O and frequency I/O.
        ''' </param>
        ''' <param name="trigChan">
        ''' Trigger channel, if supported by the sub-device.
        ''' </param>
        ''' <param name="trigType">
        ''' Trigger type for starting of input/output
        ''' </param>
        ''' <param name="trigEdge">
        ''' Choose the appropriate trigger edge
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_SINGLE_CONFIG_NO_FLAGS"/>: No flags used. Default settings.
        ''' <see cref="ME_IO_SINGLE_CONFIG_DIO_BIT"/>: Digital input/output operation by bit.
        ''' <see cref="ME_IO_SINGLE_CONFIG_DIO_BYTE"/>: Digital input/output operation by byte (8 bit).
        ''' <see cref="ME_IO_SINGLE_CONFIG_DIO_WORD"/>: Digital input/output operation by word (16 bit).
        ''' <see cref="ME_IO_SINGLE_CONFIG_DIO_DWORD"/>: Digital input/output operation by double-word (32 bit).
        ''' for the channel passed in parameter <paramref name="channel"/> and all channels beyond.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_REF"/>: parameter <paramref name="reference"/> is not correct.
        ''' <see cref="ME_ERRNO_INVALID_TRIG_CHAN"/>: parameter <paramref name="trigChan"/> is not correct.
        ''' <see cref="ME_ERRNO_INVALID_TRIG_TYPE"/>: parameter <paramref name="trigType"/> is not correct.
        ''' <see cref="ME_ERRNO_INVALID_TRIG_EDGE"/>: parameter <paramref name="trigEdge"/> is not correct.
        ''' <see cref="ME_ERRNO_INVALID_SINGLE_CONFIG"/>: parameter <paramref name="singleConfig"/> is not correct.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' Basically the operation starts after calling the function <seealso cref="meIOSingle"/>
        ''' corresponding to the trigger conditions described here.
        ''' </remarks>
        ''' <seealso cref="meIOSingle"/>
        ''' <seealso cref="meIOStreamConfig"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOSingleConfig(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByVal singleConfig As Integer, ByVal reference As Integer, ByVal trigChan As Integer, ByVal trigType As Integer, ByVal trigEdge As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOSingle"
        ''' <summary>
        ''' Read/write operations can be processed.
        ''' </summary>
        ''' <param name="singleList">
        ''' Reference to a list of type <see cref="meIOSingle_t"/>.
        ''' </param>
        ''' <param name="count">
        ''' Number of entries in <paramref name="singleList"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_SINGLE_NO_FLAGS"/> No extended options. Default settings.
        ''' Execution is stopped on first error.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_TIMEOUT"/>: timeout condition occurred.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device was not configured for required operation.
        ''' <see cref="ME_ERRNO_SUBDEVICE_BUSY"/>: sub-device is performing other operation.
        ''' </returns>
        ''' <remarks>
        ''' If for one or more list entries an external trigger source has been selected,
        ''' the function waits until the appropriate trigger signal occurs.
        ''' I. e. if operation 1 with external trigger is executed in blocking mode,
        ''' operation 2 waits until the external trigger pulse of operation 1 occurs.
        ''' </remarks>
        ''' <seealso cref="meIOSingleConfig"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOSingle(ByRef singleList As meIOSingle_t, ByVal count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOSingleTicksToTime"
        ''' <summary>
        ''' Converts the number of ticks into the desired time, e. g. period [s] for e. g. frequency measurement.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="timer">
        ''' Ticks will be calculated in dependency of the sub-device type and the
        ''' timer specified here.
        ''' <see cref="ME_TIMER_FIO_TOTAL"/>: The period is converted into seconds.
        ''' <see cref="ME_TIMER_FIO_FIRST_PHASE"/>: The duration of the first phase of the period is converted into seconds.
        ''' </param>
        ''' <param name="ticksLow">
        ''' The number of ticks (lower significant part, bits 31...0) from parameter
        ''' value of the function <see cref="meIOSingle"/> are passed here.
        ''' </param>
        ''' <param name="ticksHigh">
        ''' The number of ticks (higher significant part, bits 63...32) from parameter
        ''' value of the function <see cref="meIOSingle"/> are passed here. This
        ''' parameter is resevered for future enhancements.
        ''' </param>
        ''' <param name="time">
        ''' Pointer to a double value, which returns the calculated time in seconds, e. g. period [s].
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS"/>: (default)
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported
        ''' </returns>
        ''' <remarks>
        ''' The conversion and the allowed value range depend on each sub-device and
        ''' their properties. If hardware limits are exceeded, always the limit values are returned.
        ''' If you need the dimensions frequency and duty-cycle you can calculate
        ''' them easily by the return values from <paramref name="time"/>. It applies:
        ''' Frequency [Hz] = 1/period [s]
        ''' Duty-cycle [%] = ("Duration of the first phase of the period" [s] / period [s]) * 100
        ''' </remarks>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOSingleTicksToTime(ByVal device As Integer, ByVal subdevice As Integer, ByVal timer As Integer, ByVal ticksLow As Integer, ByVal ticksHigh As Integer, ByRef time As Double, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOSingleTimeToTicks"
        ''' <summary>
        ''' Converts a given time period [s] into the number of "ticks" to be passed to the
        ''' timer in the function meIOSingleConfig.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="timer">
        ''' Ticks will be calculated in dependency of the sub-device type and the
        ''' timer specified here. The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>
        ''' can be passed to the parameter value of the function <see cref="meIOSingle"/>.
        ''' <see cref="ME_TIMER_FIO_TOTAL"/>: The period is converted into ticks.
        ''' <see cref="ME_TIMER_FIO_FIRST_PHASE"/>: The duration of the first phase of the period is converted into ticks.
        ''' </param>
        ''' <param name="time">
        ''' (in) Pointer to a double value, passing the asked time in seconds, e. g. the period [s]
        ''' to be converted into ticks. If you pass invalid values a corresponding error code will be returned.
        ''' (out) If the asked time cannot be realized exactly by the hardware the
        ''' value next lower to it will be returned here. The corresponding ticks are
        ''' returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        ''' </param>
        ''' <param name="ticksLow">
        ''' Pointer to an integer value, which contains the lower significant 32 bits
        ''' (31...0) of the calculated ticks. To be passed to the parameter
        ''' value of the function <see cref="meIOSingle"/>.
        ''' </param>
        ''' <param name="ticksHigh">
        ''' Pointer to an integer value, which contains the higher significant 32 bits
        ''' (63...32) of the calculated ticks. This parameter is resevered for future enhancements.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS"/>: (default)
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported
        ''' </returns>
        ''' <remarks>
        ''' The conversion and the allowed value range depend on each sub-device and
        ''' their properties. If hardware limits are exceeded, an error message is returned.
        ''' </remarks>
        ''' <seealso cref="meIOSingle"/>
        ''' <seealso cref="meIOSingleTicksToTime"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOSingleTimeToTicks(ByVal device As Integer, ByVal subdevice As Integer, ByVal timer As Integer, ByRef time As Double, ByRef ticksLow As Integer, ByRef ticksHigh As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOSetChannelOffset"
        ''' <summary>
        ''' The anlog input ranges can be adjusted.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="channel">
        ''' Index of the channel whose offset should be adjusted.
        ''' </param>
        ''' <param name="range">
        ''' Index of the measurement range to be used for the measurement.
        ''' </param>
        ''' <param name="offset">
        ''' (in) Reference to a double value, passing the asked offset
        ''' (out) If the asked offset value cannot be realized exactly
        ''' by the hardware the currently adjusted value will be returned.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS"/>: No flags used. Default settings.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' </returns>
        ''' <seealso cref="meQueryNumberRanges"/>
        ''' <seealso cref="meQueryRangeByMinMax"/>
        ''' <seealso cref="meQueryRangeInfo"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOSetChannelOffset(ByVal device As Integer, ByVal subdevice As Integer, ByVal channel As Integer, ByVal range As Integer, ByRef offset As Double, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamConfig"
        ''' <summary>
        ''' Configures the hardware for a timer-controlled streaming operation.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="configList">
        ''' Reference to a list of type <see cref="meIOStreamConfig_t"/>.
        ''' </param>
        ''' <param name="count">
        ''' Number of entries in <paramref name="configList"/>.
        ''' </param>
        ''' <param name="trigger">
        ''' Pointer to a structure of type <see cref="meIOStreamTrigger_t"/>.
        ''' </param>
        ''' <param name="fifoIrqThreshold">
        ''' Number of values to be read or written (reloaded) in one package.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_CONFIG_NO_FLAGS"/>: Flag for continuous mode (default setting).
        ''' MEphisto Scope: analog acquisition
        ''' <see cref="ME_IO_STREAM_CONFIG_BIT_PATTERN"/>: Bit pattern output and FIFO redirection.
        ''' MEphisto Scope: Digital acquisition.
        ''' <see cref="ME_IO_STREAM_CONFIG_WRAPAROUND"/>: Flag for wraparound mode (periodical output).
        ''' Disables software buffer. Used only in combination with ME_IO_STREAM_CONFIG_WRAPAROUND flag.
        ''' <see cref="ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD"/>: Enables "Sample Hold" feature.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        ''' <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_REF"/>: parameter <see cref="meIOStreamConfig_t"/>.iRef is not correct.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigChan is not correct.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigEdge is not correct.
        ''' <see cref="ME_ERRNO_INVALID_STREAM_CONFIG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iStreamConfig is not correct.
        ''' <see cref="ME_ERRNO_TIMEOUT"/>: timeout condition occurred.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device was not configured for required operation.
        ''' <see cref="ME_ERRNO_SUBDEVICE_BUSY"/>: sub-device is performing other operation.
        ''' <see cref="ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD"/>: parameter <paramref name="iFifoIrqThreshold"/> is not valid (too big).
        ''' <see cref="ME_ERRNO_INVALID_CONFIG_LIST_COUNT"/>: Wrong iCount of configuration list.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigType is not correct.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iAcqStartTicks is not correct.
        ''' <see cref="ME_ERRNO_INVALID_SCAN_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iScanStartTicks is not correct.
        ''' <see cref="ME_ERRNO_INVALID_CONV_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iConvStartTicks is not correct.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iConvStartTrigType is not correct.
        ''' <see cref="ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iConvStartTrigType is not correct.
        ''' <see cref="ME_ERRNO_INVALID_ACQ_STOP_ARG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStopCount is not correct.
        ''' <see cref="ME_ERRNO_INVALID_SCAN_STOP_ARG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iScanStopCount is not correct
        ''' </returns>
        ''' <remarks>
        ''' For periodic bit pattern output and for periodic DEMUX operation
        ''' the constant ME_IO_STREAM_CONFIG_WRAPAROUND must be ORed
        ''' with the constant ME_IO_STREAM_CONFIG_ BIT_PATTERN.
        ''' For analog and digital (bit pattern output) streaming operations
        ''' a channel-list must be created, which contains an entry for
        ''' each channel (channel index, measurement range...) of type meIOStreamConfig_t.
        ''' Additionally a trigger structure (meIOStreamTrigger_t) is required,
        ''' which defines numerous settings like start/stop conditions, timer settings,
        ''' trigger sources and trigger edges valid for the whole operation.
        ''' The operation is always started by the function meIOStreamStart()
        ''' either at once (software start) or in accordance with the start
        ''' conditions defined in the function meIOStreamConfig().
        ''' Stop the operation either according to the stop conditions
        ''' defined in the trigger structure or by calling the function meIOStreamStop().
        ''' </remarks>
        ''' <seealso cref="meIOStreamFrequencyToTicks"/>
        ''' <seealso cref="meIOStreamFrequencyToTicks"/>
        ''' <seealso cref="meIOStreamStart"/>
        ''' <seealso cref="meIOStreamStop"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamConfig(ByVal device As Integer, ByVal subdevice As Integer, ByRef configList As meIOStreamConfig_t, ByVal count As Integer, ByRef trigger As meIOStreamTrigger_t, ByVal fifoIrqThreshold As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamRead"
        ''' <summary>
        ''' Reads values from the data buffer during a timer-controlled acquisition.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="readMode">
        ''' <see cref="ME_READ_MODE_BLOCKING"/>: (BLOCKING mode) The function waits until the number of
        ''' measurement values specified in parameter <paramref name="count"/> has been acquired.
        ''' Important: Call can block for ever!
        ''' <see cref="ME_READ_MODE_NONBLOCKING"/>: (NONBLOCKING mode) The function returns immediately
        ''' either with the number of measurement values available when calling
        ''' the function or with the number specified in <paramref name="count"/>.
        ''' Each time the lower value is valid.
        ''' </param>
        ''' <param name="values">
        ''' Reference to a data buffer to be filled up.
        ''' </param>
        ''' <param name="count">
        ''' (in) Size of the data buffer to be read in number of measurement values.
        ''' (out) The pointer returns the number of values actually read from the data buffer.
        ''' If in BLOCKING mode the acquisition has been cancelled, the return value can also be less than the value passed.
        ''' BLOCKING mode:
        ''' Number of values to be read – as a rule a multiple of the channel-list length,
        ''' but this is not necessary (see also meUtilityExtractValues() on page 169).
        ''' NONBLOCKING mode:
        ''' Number of values to be read – if you want to read a multiple of channel-list
        ''' length use the constant ME_IO_STREAM_ READ_FRAMES in the parameter <paramref name="flags"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_READ_NO_FLAGS"/>: Default settings.
        ''' <see cref="ME_IO_STREAM_READ_FRAMES"/>: Reading a multiple of channel-list length in NONBLOCKING mode.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_VALUE_COUNT"/>: <paramref name="count"/> is lower than zero.
        ''' <see cref="ME_ERRNO_INVALID_READ_MODE"/>: not supported read mode detected.
        ''' <see cref="ME_ERRNO_SUBDEVICE_NOT_RUNNING"/>: buffer is empty and sub-device is not running a streaming operation.
        ''' </returns>
        ''' <remarks>
        ''' The user has to allocate a data buffer, to which the measurement values are written to.
        ''' Using the execution mode BLOCKING the function meIOStreamRead() returns when the last
        ''' value has been read. In NONBLOCKING mode the function returns at once
        ''' with the available measurement values. For reading the data a callback function can also be used.
        ''' </remarks>
        ''' <seealso cref="meIOStreamStatus"/>
        ''' <seealso cref="meIOStreamSetCallbacks"/>
        ''' <seealso cref="meUtilityDigitalToPhysical"/>
        ''' <seealso cref="meUtilityExtractValues"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamRead(ByVal device As Integer, ByVal subdevice As Integer, ByVal readMode As Integer, ByRef values As Integer, ByRef count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamWrite"
        ''' <summary>
        ''' Writes data to a buffer for timer-controlled analog resp. digital output.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="writeMode">
        ''' <see cref="ME_WRITE_MODE_BLOCKING"/>: The function waits until the number of values specified
        ''' in parameter <paramref name="count"/> can be written to the internal buffer.
        ''' Important: Call can block for ever!
        ''' <see cref="ME_WRITE_MODE_NONBLOCKING"/>: With this option the function writes as many values
        ''' to the internal buffer as there is space at the moment the function was called
        ''' (max. number specified in <paramref name="count"/>).
        ''' <see cref="ME_WRITE_MODE_PRELOAD"/>: Pre-loading the data buffer for the first time.
        ''' Data will be written directly to the hardware buffer.
        ''' If there are more data as there is space in the FIFO the rest is stored in an internal buffer.
        ''' Note: This is non-blocking writing.
        ''' </param>
        ''' <param name="values">
        ''' Pointer to a data buffer (data stream) with the values resp. bit patterns to be output.
        ''' Use the function <seealso cref="meUtilityPhysicalToDigital"/> for easy conversion of physical
        ''' values (e. g. voltage) into digital values.
        ''' </param>
        ''' <param name="count">
        ''' (in): Number of values to be loaded into the data buffer.
        ''' (out): The pointer returns the number of values which could be written into the data buffer actually.
        ''' The number will never be greater, but can also be less,
        ''' if there is less memory for the number of values passed.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_WRITE_NO_FLAGS"/>: Default settings – no flags available
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_VALUE_COUNT"/>: <paramref name="count"/> is lower than zero.
        ''' Note: When <paramref name="count"/> is set to zero ME_ERRNO_SUCCESS is returned.
        ''' <see cref="ME_ERRNO_INVALID_WRITE_MODE"/>: not supported write mode detected.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: device is configured to work in single mode.
        ''' <see cref="ME_ERRNO_SUBDEVICE_NOT_RUNNING"/>: The internal hardware state machine is stopped but
        ''' logical status show that should be working. No data in FIFO but software buffer is not empty
        ''' </returns>
        ''' <remarks>
        ''' For the values to be output allocate a data buffer of defined size for each sub-device to be used.
        ''' </remarks>
        ''' <seealso cref="meIOStreamRead"/>
        ''' <seealso cref="meUtilityPhysicalToDigital"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamWrite(ByVal device As Integer, ByVal subdevice As Integer, ByVal writeMode As Integer, ByRef values As Integer, ByRef count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamSetCallbacks"
        ''' <summary>
        ''' Installs different callback functions that wait for an event on a streaming sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="startCB">
        ''' Delegate to an user-defined function. This function is called when streaming operation starts.
        ''' If the function exits with a return value different than <see cref="ME_ERRNO_SUCCESS"/>
        ''' streaming is instantly stopped, <seealso cref="meIOStreamStop"/> is executed.
        ''' </param>
        ''' <param name="startCBContext">
        ''' User-defined pointer passed to start callback function.
        ''' This parameter is optional. If you don't want to use this functionality pass NULL.
        '''  </param>
        ''' <param name="newValuesCB">
        ''' Pointer to an user-defined function. This function is called when the buffer status is changing.
        ''' If the function exits with a return value different than <see cref="ME_ERRNO_SUCCESS"/>
        ''' streaming is instantly stopped, <seealso cref="meIOStreamStop"/> is executed.
        ''' </param>
        ''' <param name="newValuesCBContext">
        ''' User-defined pointer passed to new values callback function. This parameter is optional.
        ''' If you don't want to use this functionality pass NULL
        ''' </param>
        ''' <param name="endCB">
        ''' Pointer to an user-defined function. This function is called when streaming operation stops.
        ''' </param>
        ''' <param name="endCBContext">
        ''' User-defined pointer passed to stop callback function. This parameter is optional.
        ''' If you don't want to use this functionality pass NULL.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS"/>: (no flags available)
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' To deinstall/cancel all registered callback instances for the selected sub-device call
        ''' meIOStreamSetCallbacks() with all callback pointers
        ''' (<paramref name="startCB"/>, <paramref name="newValuesCB"/> and <paramref name="endCB"/>) set to NULL.
        ''' </remarks>
        ''' <seealso cref="meIOStreamStart"/>
        ''' <seealso cref="meIOStreamStop"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamSetCallbacks(ByVal device As Integer, ByVal subdevice As Integer, ByRef startCB As meIOStreamCB_t, ByVal startCBContext As IntPtr, ByVal newValuesCB As meIOStreamCB_t, ByVal newValuesCBContext As IntPtr, endCB As meIOStreamCB_t, ByVal endCBContext As IntPtr, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamStart"
        ''' <summary>
        ''' Starts streaming operations.
        ''' </summary>
        ''' <param name="startList">
        ''' Pointer to a list of type meIOStreamStart_t, by which one or more streaming operations can be started.
        ''' The start is done immediately after calling the function corresponding to the start conditions.
        ''' If for one or more list entries the <see cref="meIOStreamStart_t"/>.iStartMode
        ''' </param>
        ''' <param name="count">
        ''' Number of meIOStreamStart_t entries in <paramref name="startList"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_START_NO_FLAGS"/>: Default settings. Execute list up to the first error.
        ''' Returned value corresponds with the first non-zero <see cref="meIOStreamStart_t"/>.iErrno field.
        ''' <see cref="ME_IO_STREAM_START_NONBLOCKING"/>: (Linux only) Execute whole start list.
        ''' When this flag is set execution is processed although an error occured for some entries.
        ''' The function returns ME_ERRNO_SUCCESS when no global error was detected.
        ''' <see cref="meIOStreamStart_t"/>.iErrno fields have to be checked.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        ''' <see cref="ME_ERRNO_INVALID_TIMEOUT"/>: timeout lower than 0.
        ''' <see cref="ME_ERRNO_INVALID_START_MODE"/>: not supported start mode detected.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device is not configured correctly to proceed streaming operation.
        ''' <see cref="ME_STATUS_ERROR"/>: previous operation ended with an error. Reset has to be called to clear this state.
        ''' <see cref="ME_ERRNO_LACK_OF_RESOURCES"/>: (output only) operation can not be proceed. Buffers are empty. (Linux only)
        ''' <see cref="ME_ERRNO_TIMEOUT"/>: Operation didn't start on time.
        ''' <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Windows only)
        ''' </returns>
        ''' <remarks>
        ''' Returning of the function depends on the <see cref="meIOStreamStart_t"/>.iStartMode
        ''' (BLOCKING or NONBLOCKING) and trigger conditions defined in the function <see cref="meIOStreamConfig"/>.
        ''' </remarks>
        ''' <seealso cref="meIOStreamStart_t"/>
        ''' <seealso cref="meIOStreamConfig"/>
        ''' <seealso cref="meIOStreamStop"/>
        ''' <seealso cref="meIOResetDevice"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamStart(ByRef startList As meIOStreamStart_t, ByVal count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamStatus"
        ''' <summary>
        ''' Checks the status of streaming operation.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="wait">
        ''' Behaviour of return of this function:
        ''' <see cref="ME_WAIT_NONE"/>: Check current status.
        ''' Function returns the current state of operation immediately in parameter <paramref name="status"/>.
        ''' <see cref="ME_WAIT_IDLE"/>: In case of an output operation the function waits until all values have been output.
        ''' The function returns with <see cref="ME_STATUS_IDLE"/> in parameter <paramref name="status"/>.
        ''' Important: Call can block for ever!
        ''' <see cref="ME_WAIT_BUSY"/>: (Linux only)
        ''' The function blocks while the status is <see cref="ME_STATUS_BUSY"/>
        ''' Important: Call can block for ever!
        ''' </param>
        ''' <param name="status">
        ''' Pointer which returns the current state of operation of the specified sub-device.
        ''' <see cref="ME_STATUS_IDLE"/>: Streaming operation has finished.
        ''' <see cref="ME_STATUS_BUSY"/>: Streaming operation is still running.
        ''' <see cref="ME_STATUS_ERROR"/>: Error occured, e. g. data stream was interrupted.
        ''' </param>
        ''' <param name="count">
        ''' Input sub-device: Number of values which can be read
        ''' Output sub-device: Free memory in the output buffer (in number of values)
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_STATUS_NO_FLAGS"/>: Default settings – no flags available
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: unsupported flag detected.
        ''' <see cref="ME_ERRNO_INVALID_WAIT"/>: not supported wait mode detected.
        ''' </returns>
        ''' <remarks>
        ''' Depending on input or output operation this function is used to check whether
        ''' all measurement values have been acquired or whether an output operation is still running.
        ''' With the parameter <paramref name="wait"/> you can control, whether the function
        ''' should return the current state at once, or whether you want to wait
        ''' until the input resp. output operation has been ended.
        ''' </remarks>
        ''' <seealso cref="meIOStreamRead"/>
        ''' <seealso cref="meIOStreamWrite"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamStatus(ByVal device As Integer, ByVal subdevice As Integer, ByVal wait As Integer, ByRef status As Integer, ByRef count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamStop"
        ''' <summary>
        ''' An "infinite" operation can be cancelled at once or stopped in a defined way.
        ''' </summary>
        ''' <param name="stopList">
        ''' Pointer to a list of type <see cref="meIOStreamStop_t"/> to end one or several input/output operations.
        ''' Stopping is done in accordance to parameter <see cref="meIOStreamStop_t"/>.iStopMode.
        ''' </param>
        ''' <param name="count">
        ''' Number of <see cref="meIOStreamStop_t"/> entries in <paramref name="stopList"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_STREAM_STOP_NO_FLAGS"/>: Default settings.
        ''' Execute list up to the first error.
        ''' Returned value corresponds with the first non-zero <see cref="meIOStreamStop_t"/>.iErrno field.
        ''' <see cref="ME_IO_STREAM_STOP_NONBLOCKING"/>: (Linux only)
        ''' Execute whole stop list one by one. When this flag is set execution is processed
        ''' although an error occured for some entries. The function returns ME_SUCCESS
        ''' when no global error was detected. <see cref="meIOStreamStop_t"/>.iErrno fields have to be checked.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: unsupported flag detected.
        ''' <see cref="ME_ERRNO_INVALID_STOP_MODE"/>: not supported stop mode detected.
        ''' <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device is not configured correctly to proceed streaming operation.
        ''' <see cref="ME_STATUS_ERROR"/>: previous operation ended with an error. Reset has to be called to clear this state.
        ''' </returns>
        ''' <remarks>
        ''' With meIOStreamStop you have the possibility to stop an output operation by the last entry
        ''' in the FIFO which is a known value.
        ''' If in the parameters iAcqStopCount resp. iScanStopCount of the function meIOStreamConfig()
        ''' stop conditions have been defined, calling the function meIOStreamStop() is not necessary.
        ''' Configuration of the sub-device remains preserved (channel-list, timer...)
        ''' so that a restart with the function <see cref="meIOStreamStart"/> is possible without new configuration.
        ''' In opposite to this using the function <see cref="meIOResetDevice"/> deletes the whole configuration of the device.
        ''' </remarks>
        ''' <seealso cref="meIOStreamStop_t"/>
        ''' <seealso cref="meIOResetDevice"/>
        ''' <seealso cref="meIOStreamStart"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamStop(ByRef stopList As meIOStreamStop_t, ByVal count As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamFrequencyToTicks"
        ''' <summary>
        ''' Converts a given frequency [Hz] into the number of "ticks"
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="timer">
        ''' Ticks will be calculated in dependency of the sub-device to which the specified timer belongs to.
        ''' The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> are passed
        ''' in the trigger structure of the function <see cref="meIOStreamConfig"/>
        ''' <see cref="ME_TIMER_ACQ_START"/>: <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' <see cref="ME_TIMER_SCAN_START"/>: <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' <see cref="ME_TIMER_CONV_START"/>: <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' </param>
        ''' <param name="frequency">
        ''' Pointer to a double value, passing the asked frequency [Hz] to be converted into ticks.
        ''' If you pass „0“ the maximum frequency will be returned.
        ''' If the asked frequency cannot be realized exactly by the hardware the frequency next higher
        ''' to it will be returned as an approximation.
        ''' The corresponding ticks are returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        ''' </param>
        ''' <param name="ticksLow">
        ''' Pointer to an integer value, which contains the lower significant 32 bits (31...0) of the calculated ticks.
        ''' Will be passed to the appropriate parameter startTicksLow of the function <see cref="meIOStreamConfig"/>.
        ''' </param>
        ''' <param name="ticksHigh">
        ''' Pointer to an integer value, which contains the higher significant 32 bits (63...32) of the calculated ticks.
        ''' Will be passed to the appropriate parameter startTicksHigh of the function <see cref="meIOStreamConfig"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS"/>: (default) MEphisto Scope: data-logging mode
        ''' <see cref="ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE"/>: MEphisto Scope: oscilloscope mode
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' The conversion and the allowed value range depend on each sub-device and their timers.
        ''' If hardware limits are exceeded, always the limit values are returned.
        ''' Tip: Passing "0" in parameter <paramref name="frequency"/> of this function returns the maximum frequency allowed.
        ''' In dependency of parameter <paramref name="timer"/> of this function the return values of
        ''' <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> can be passed to the corresponding parameters
        ''' <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks, <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        ''' and <see cref="meIOStreamTrigger_t"/>.iScanStartTicks in the trigger structure of function <see cref="meIOStreamConfig"/>.
        ''' </remarks>
        ''' <seealso cref="meIOStreamTimeToTicks"/>
        ''' <seealso cref="meIOStreamConfig"/>
        ''' <seealso cref="meIOStreamTrigger_t"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamFrequencyToTicks(ByVal device As Integer, ByVal subdevice As Integer, ByVal timer As Integer, ByRef frequency As Double, ByRef ticksLow As Integer, ByRef ticksHigh As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meIOStreamTimeToTicks"
        ''' <summary>
        ''' Converts a given time period [s] into the number of "ticks".
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="timer">
        ''' Ticks will be calculated in dependency of the sub-device to which the specified timer belongs to.
        ''' The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> are passed
        ''' in the trigger structure of the function <see cref="meIOStreamConfig"/>
        ''' <see cref="ME_TIMER_ACQ_START"/>: <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' <see cref="ME_TIMER_SCAN_START"/>: <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' <see cref="ME_TIMER_CONV_START"/>: <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        ''' should be calculated for passing to the parameter of the same name.
        ''' </param>
        ''' <param name="time">
        ''' (in): Pointer to a double value, passing the asked period [s] to be converted into ticks.
        ''' If you pass "0" the minimum period will be returned.
        ''' (out): If the asked period cannot be realized exactly by the hardware the
        ''' period next lower to it will be returned as an approximation. The corresponding ticks
        ''' are returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        ''' </param>
        ''' <param name="ticksLow">
        ''' Pointer to an integer value, which contains the lower significant 32 bits (31...0) of the calculated ticks.
        ''' Will be passed to the appropriate parameter startTicksLow of the function <see cref="meIOStreamConfig"/>.
        ''' </param>
        ''' <param name="ticksHigh">
        ''' Pointer to an integer value, which contains the higher significant 32 bits (63...32) of the calculated ticks.
        ''' Will be passed to the appropriate parameter startTicksHigh of the function <see cref="meIOStreamConfig"/>.
        ''' </param>
        ''' <param name="flags">
        ''' <see cref="ME_IO_TIME_TO_TICKS_NO_FLAGS"/>: (default) MEphisto Scope: data-logging mode
        ''' <see cref="ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE"/>: MEphisto Scope: oscilloscope mode
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        ''' </returns>
        ''' <remarks>
        ''' The conversion and the allowed value range depend on each sub-device and their timers.
        ''' If hardware limits are exceeded, always the limit values are returned.
        ''' Tip: Passing "0" in parameter <paramref name="time"/> of this function returns the
        ''' minimum frequency allowed. In dependency of parameter <paramref name="timer"/> of
        ''' this function the return values of <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>
        ''' can be passed to the corresponding parameters <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks,
        ''' <see cref="meIOStreamTrigger_t"/>.iConvStartTicks and <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        ''' in the trigger structure of function <see cref="meIOStreamConfig"/>.
        ''' </remarks>
        ''' <seealso cref="meIOStreamFrequencyToTicks"/>
        ''' <seealso cref="meIOStreamConfig"/>
        ''' <seealso cref="meIOStreamTrigger_t"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meIOStreamTimeToTicks(ByVal device As Integer, ByVal subdevice As Integer, ByVal timer As Integer, ByRef time As Double, ByRef ticksLow As Integer, ByRef ticksHigh As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meQueryDescriptionDevice"
        ''' <summary>
        ''' Determines the device description.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="description">
        ''' Buffer to hold the device description.
        ''' </param>
        ''' <param name="count">
        ''' Buffer size in bytes for device description.
        ''' Recommended: <see cref="ME_DEVICE_DESCRIPTION_MAX_COUNT"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        ''' </returns>
        ''' <seealso cref="meQueryInfoDevice"/>
        ''' <seealso cref="meQueryNameDevice"/>
        ''' <seealso cref="meQueryNumberDevices"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function meQueryDescriptionDevice(ByVal device As Integer, description As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meQueryInfoDevice"
        ''' <summary>
        ''' Determines detailed information of the device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="vendorId">
        ''' Pointer returns vendor ID of the device.
        ''' 0x1402 for Meilhaus PCI boards, 0x1B04 for USB devices like e. g. ME-1 (ME-Synapse USB).
        ''' </param>
        ''' <param name="deviceId">
        ''' Pointer returns the device ID.
        ''' </param>
        ''' <param name="serialNo">
        ''' Pointer returns the serial number of the device.
        ''' </param>
        ''' <param name="busType">
        ''' Pointer returns the bus type by which the device is connected with the PC (PCI/cPCI, USB).
        ''' </param>
        ''' <param name="busNo">
        ''' PCI only: Pointer returns the PCI bus number, if several PCI buses are available in your system (if one bus it is always "0")
        ''' </param>
        ''' <param name="slot">
        ''' PCI only: Slot number of the board to be accessed.
        ''' </param>
        ''' <param name="funcNo">
        ''' PCI: Function number.
        ''' </param>
        ''' <param name="plugged">
        ''' Pointer indicates whether a device is physically available.
        ''' <see cref="ME_PLUGGED_IN"/>: Device physically available.
        ''' <see cref="ME_PLUGGED_OUT"/>: Device registered with the ME-iDC (ME-Config-Tool) but not connected with the PC.
        ''' <see cref="ME_PLUGGED_INVALID"/>: invalid return value
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' </returns>
        ''' <remarks>
        ''' This is a PCI orientated function and some parameters have no meaning for
        ''' ME-Synapse USB or ME-Synapse LAN.
        ''' </remarks>
        ''' <seealso cref="meQueryDescriptionDevice"/>
        ''' <seealso cref="meQueryNameDevice"/>
        ''' <seealso cref="meQueryNumberDevices"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryInfoDevice(ByVal device As Integer, ByRef vendorId As Integer, ByRef deviceId As Integer, ByRef serialNo As Integer, ByRef busType As Integer, ByRef busNo As Integer, ByRef slot As Integer, ByRef funcNo As Integer, ByRef plugged As Integer) As Integer
        End Function
#End Region

#Region "meQueryNameDevice"
        ''' <summary>
        ''' Determines the device name.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="name">
        ''' Buffer for the device name.
        ''' </param>
        ''' <param name="count">
        ''' Buffer size in bytes for device name. Recommended: <see cref="ME_DEVICE_NAME_MAX_COUNT"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        ''' </returns>
        ''' <seealso cref="meQueryInfoDevice"/>
        ''' <seealso cref="meQueryDescriptionDevice"/>
        ''' <seealso cref="meQueryNumberDevices"/>
        ''' <seealso cref="meQueryNameDeviceDriver"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function meQueryNameDevice(ByVal device As Integer, name As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meQueryNameDeviceDriver"
        ''' <summary>
        ''' Determines the name of the device specific driver module.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="name">
        ''' Pointer to a buffer for the driver module.
        ''' </param>
        ''' <param name="count">
        ''' Buffer size in bytes for the driver module.
        ''' Recommended: <see cref="ME_DEVICE_DRIVER_NAME_MAX_COUNT"/>.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        ''' </returns>
        ''' <seealso cref="meQueryVersionDeviceDriver"/>
        ''' <seealso cref="meQueryVersionMainDriver"/>
        ''' <seealso cref="meQueryVersionLibrary"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function meQueryNameDeviceDriver(ByVal device As Integer, name As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meQueryNumberDevices"
        ''' <summary>
        ''' Determines the number of devices recognized by the ME-iDS.
        ''' </summary>
        ''' <param name="count">
        ''' Contains the number of recognized devices after the function returned.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <remarks>
        ''' Not all devices have to be physically present.
        ''' This can be tested with the function <see cref="meQueryInfoDevice"/>.
        ''' </remarks>
        ''' <seealso cref="meQueryInfoDevice"/>
        ''' <seealso cref="meQueryNumberSubdevices"/>
        ''' <seealso cref="meQueryNumberChannels"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryNumberDevices(ByRef count As Integer) As Integer
        End Function
#End Region

#Region "meQueryNumberSubdevices"
        ''' <summary>
        ''' Determines the number of sub-devices on a queried device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="count">
        ''' Number of sub-devices on the device.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' </returns>
        ''' <seealso cref="meQueryNumberDevices"/>
        ''' <seealso cref="meQueryNumberChannels"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryNumberSubdevices(ByVal device As Integer, ByRef count As Integer) As Integer
        End Function
#End Region

#Region "meQueryNumberChannels"
        ''' <summary>
        ''' Determines the number of channels of a sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="count">
        ''' Returns the number of channels of the specified sub-device.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' </returns>
        ''' <seealso cref="meQueryNumberDevices"/>
        ''' <seealso cref="meQueryNumberSubdevices"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryNumberChannels(ByVal device As Integer, ByVal subdevice As Integer, ByRef count As Integer) As Integer
        End Function
#End Region

#Region "meQueryNumberChannels"
        ''' <summary>
        ''' Determines the number of ranges which support the specified measurement range(s).
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="unit">
        ''' Restrict the query to the specified measurement range(s).
        ''' <see cref="ME_UNIT_ANY"/>: Query for all ranges
        ''' <see cref="ME_UNIT_VOLT"/>: Query only for voltage ranges
        ''' <see cref="ME_UNIT_AMPERE"/>: Query only for current ranges
        ''' </param>
        ''' <param name="count">
        ''' Returns the number of ranges which support the specified measurement range(s).
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_NOT_SUPPORTED"/>: function is not supported by sub-device.
        ''' </returns>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meQueryRangeByMinMax"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryNumberRanges(ByVal device As Integer, ByVal subdevice As Integer, ByVal unit As Integer, ByRef count As Integer) As Integer
        End Function
#End Region

#Region "meQueryRangeByMinMax"
        ''' <summary>
        ''' Determines the appropriate measurement range by given limits
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device to be accessed.
        ''' </param>
        ''' <param name="unit">
        ''' Restrict the query to the specified measurement range(s).
        ''' <see cref="ME_UNIT_ANY"/>: Query for all ranges
        ''' <see cref="ME_UNIT_VOLT"/>: Query only for voltage ranges
        ''' <see cref="ME_UNIT_AMPERE"/>: Query only for current ranges
        ''' </param>
        ''' <param name="min">
        ''' (in) Passing the lower limit of the searched range.
        ''' (out) Returns the lower limit for the range determined.
        ''' </param>
        ''' <param name="max">
        ''' (in) Passing the upper limit of the searched range.
        ''' (out) Returns the upper limit for the range determined.
        ''' </param>
        ''' <param name="maxData">
        ''' Returns the maximum resolution for the range determined (e. g. 65535 (0xFFFF) for 16 bit resolution).
        ''' </param>
        ''' <param name="rangeIndex">
        ''' The index of the best fitting measurement range is returned.
        ''' Always the smallest range is chosen, which includes the range limits searched for.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_UNIT"/>: unit's type not supported on sub-device.
        ''' <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: lower limit is higher than upper.
        ''' <see cref="ME_ERRNO_NO_RANGE"/>: fitted range not found.
        ''' </returns>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meQueryNumberRanges"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryRangeByMinMax(ByVal device As Integer, ByVal subdevice As Integer, ByVal unit As Integer, ByRef min As Double, ByRef max As Double, ByRef maxData As Integer, ByRef rangeIndex As Integer) As Integer
        End Function
#End Region

#Region "meQueryRangeInfo"
        ''' <summary>
        ''' Determines details of the specified measurement range.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device that is queried.
        ''' </param>
        ''' <param name="range">
        ''' Index of measurement range that is queried.
        ''' </param>
        ''' <param name="unit">
        ''' Pointer, which returns the physical unit of the specified measurement range.
        ''' <see cref="ME_UNIT_INVALID"/>: Invalid return value
        ''' <see cref="ME_UNIT_VOLT"/>: Voltage range
        ''' <see cref="ME_UNIT_AMPERE"/>: Current range
        ''' </param>
        ''' <param name="min">
        ''' Reference to the lower limit of the requested range.
        ''' It applies to the physical unit specified in parameter <paramref name="unit"/>.
        ''' </param>
        ''' <param name="max">
        ''' Reference to the upper limit of the requested range.
        ''' It applies to the physical unit specified in parameter <paramref name="unit"/>.
        ''' </param>
        ''' <param name="maxData">
        ''' Returns the maximum resolution of the measurement range (e. g. for 16 bit resolution the value 65535 (0xFFFF) is returned).
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' </returns>
        ''' <seealso cref="meQueryNumberRanges"/>
        ''' <seealso cref="meQueryRangeByMinMax"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryRangeInfo(ByVal device As Integer, ByVal subdevice As Integer, ByVal range As Integer, ByRef unit As Integer, ByRef min As Double, ByRef max As Double, ByRef maxData As Integer) As Integer
        End Function
#End Region

#Region "meQuerySubdeviceByType"
        ''' <summary>
        ''' Determines the index of the first available sub-device which matches the features searching for.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="startSubdevice">
        ''' Index of the sub-device the query starts with.
        ''' </param>
        ''' <param name="type">
        ''' Type of the sub-device searched for:
        ''' <see cref="ME_TYPE_AI"/> Analog acquisition
        ''' <see cref="ME_TYPE_AO"/>: Analog output
        ''' <see cref="ME_TYPE_DIO"/>: Digital input/output (bi-directional)
        ''' <see cref="ME_TYPE_DO"/>: Digital output
        ''' <see cref="ME_TYPE_DI"/>: Digital input
        ''' <see cref="ME_TYPE_FIO"/>: Frequency input/output (bi-directional)
        ''' <see cref="ME_TYPE_FO"/>: Frequency output
        ''' <see cref="ME_TYPE_FI"/>: Frequency input
        ''' <see cref="ME_TYPE_CTR"/>: Counter
        ''' <see cref="ME_TYPE_EXT_IRQ"/>: External interrupt
        ''' </param>
        ''' <param name="subType">
        ''' The capabilities of the sub-device searched for can be specified more detailed if necessary:
        ''' <see cref="ME_SUBTYPE_ANY"/>: Sub-type doesn't matter.
        ''' <see cref="ME_SUBTYPE_SINGLE"/>: Acquisition resp. output of a single value.
        ''' <see cref="ME_SUBTYPE_STREAMING"/>: Continuous acquisition resp. output by using special hardware capabilities (e. g. FIFOs).
        ''' <see cref="ME_SUBTYPE_CTR_8254"/>: Sub-device with a counter of type 8254
        ''' </param>
        ''' <param name="subdevice">
        ''' Reference to the index of the first matching sub-device.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_NO_MORE_SUBDEVICE_TYPE"/>: Matching sub-device not found.
        ''' </returns>
        ''' <seealso cref="meQuerySubdeviceType"/>
        ''' <seealso cref="meQuerySubdeviceCaps"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQuerySubdeviceByType(ByVal device As Integer, ByVal startSubdevice As Integer, ByVal type As Integer, ByVal subtype As Integer, ByRef subdevice As Integer) As Integer
        End Function
#End Region

#Region "meQuerySubdeviceType"
        ''' <summary>
        ''' Determines the type and subtype of the specified sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device that is queried.
        ''' </param>
        ''' <param name="type">
        ''' Reference to the sub-device type:
        ''' <see cref="ME_TYPE_AO"/>: Analog output
        ''' <see cref="ME_TYPE_AI"/> Analog input
        ''' <see cref="ME_TYPE_DIO"/>: Digital input/output (bi-directional)
        ''' <see cref="ME_TYPE_DO"/>: Digital output
        ''' <see cref="ME_TYPE_DI"/>: Digital input
        ''' <see cref="ME_TYPE_FIO"/>: Frequency input/output (bi-directional)
        ''' <see cref="ME_TYPE_FO"/>: Frequency output
        ''' <see cref="ME_TYPE_FI"/>: Frequency input
        ''' <see cref="ME_TYPE_CTR"/>: Counter
        ''' <see cref="ME_TYPE_EXT_IRQ"/>: External interrupt
        ''' </param>
        ''' <param name="subType">
        ''' Returns the subtype of the sub-device:
        ''' <see cref="ME_SUBTYPE_SINGLE"/>: Sub-device is able to acquire resp. output single values.
        ''' <see cref="ME_SUBTYPE_STREAMING"/>: The sub-device can acquire values continuously resp. output a data stream.
        ''' <see cref="ME_SUBTYPE_CTR_8254"/>: Sub-device with a counter of type 8254
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' </returns>
        ''' <seealso cref="meQueryInfoDevice"/>
        ''' <seealso cref="meQuerySubdeviceByType"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQuerySubdeviceType(ByVal device As Integer, ByVal subdevice As Integer, ByRef type As Integer, ByRef subtype As Integer) As Integer
        End Function
#End Region

#Region "meQuerySubdeviceCaps"
        ''' <summary>
        ''' Determines the special capabilities of a sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device that is queried.
        ''' </param>
        ''' <param name="caps">
        ''' Reference to a bit-coded integer value which returns the special capabilities of the specified sub-device.
        ''' If several capabilities apply, the values are ORed bitwise.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' </returns>
        ''' <seealso cref="meQuerySubdeviceCapsArgs"/>
        ''' <seealso cref="meQuerySubdeviceType"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQuerySubdeviceCaps(ByVal device As Integer, ByVal subdevice As Integer, ByRef caps As Integer) As Integer
        End Function
#End Region

#Region "meQuerySubdeviceCapsArgs"
        ''' <summary>
        ''' Determines detailed information of a specific capability of a sub-device.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice">
        ''' Index of the sub-device that is queried.
        ''' </param>
        ''' <param name="cap">
        ''' The capability to be queried.
        ''' </param>
        ''' <param name="args">
        ''' Reference to an array of type integer, which returns the queried values.
        ''' </param>
        ''' <param name="count">
        ''' Number of values in parameter <paramref name="args"/>.
        ''' As a rule "1", if the returned values fit into an integer.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_CAP"/>: Passed code is invalid or not supported on sub-device.
        ''' <see cref="ME_ERRNO_INVALID_CAP_ARG_COUNT"/>: Parameter <paramref name="count"/> doesn't fit for queried capability code.
        ''' </returns>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQuerySubdeviceCapsArgs(ByVal device As Integer, ByVal subdevice As Integer, ByVal cap As Integer, ByRef args As Integer, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "meQueryVersionLibrary"
        ''' <summary>
        ''' Determines the version number of the library.
        ''' </summary>
        ''' <param name="version">
        ''' Reference to the version number of the library.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <remarks>
        ''' Can be called before calling <see cref="meOpen"/>.
        ''' </remarks>
        ''' <seealso cref="meQueryVersionDeviceDriver"/>
        ''' <seealso cref="meQueryVersionMainDriver"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryVersionLibrary(ByRef version As Integer) As Integer
        End Function
#End Region

#Region "meQueryVersionMainDriver"
        ''' <summary>
        ''' Determines the version number of the main driver.
        ''' </summary>
        ''' <param name="version">
        ''' Reference to the version number of the main driver.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <remarks>
        ''' The two higher significant bytes (main version, sub version) must be the same one as the
        ''' version number of the device specific driver module. <see cref="meQueryVersionDeviceDriver"/>
        ''' The lower significant bytes (build number) can differ.
        ''' </remarks>
        ''' <seealso cref="meQueryVersionDeviceDriver"/>
        ''' <seealso cref="meQueryVersionLibrary"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryVersionMainDriver(ByRef version As Integer) As Integer
        End Function
#End Region

#Region "meQueryVersionDeviceDriver"
        ''' <summary>
        ''' Determines the version number of the device specific driver module.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="version">
        ''' Reference to the version number of the main driver.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' </returns>
        ''' <remarks>
        ''' The version number must be the same one as the version number of the main driver.
        '''  <see cref="meQueryVersionMainDriver"/>
        ''' </remarks>
        ''' <seealso cref="meQueryVersionLibrary"/>
        ''' <seealso cref="meQueryVersionMainDriver"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meQueryVersionDeviceDriver(ByVal device As Integer, ByRef version As Integer) As Integer
        End Function
#End Region

#Region "meUtilityExtractValues"
        ''' <summary>
        ''' Extracts the values of the specified channel from an array of values taking the channel-list into account.
        ''' </summary>
        ''' <param name="channel">
        ''' Channel index whose values should be extracted.
        ''' </param>
        ''' <param name="dataBuffer">
        ''' Reference to the data buffer allocated for the function <see cref="meIOStreamRead"/>.
        ''' </param>
        ''' <param name="dataCount">
        ''' Number of measurement values in data buffer <paramref name="dataBuffer"/>.
        ''' </param>
        ''' <param name="configList">
        ''' Pointer to the channel-list, which was passed to the function <see cref="meIOStreamConfig"/>.
        ''' </param>
        ''' <param name="configListCount">
        ''' Number of channel-list entries in <paramref name="configList"/>.
        ''' </param>
        ''' <param name="chanBuffer">
        ''' Pointer to an array with the extracted values of the specified channel.
        ''' </param>
        ''' <param name="chanBufferCount">
        ''' (in) Passing the size of the array <paramref name="chanBuffer"/> in number of values.
        ''' (out) The function returns the number values actually written to <paramref name="chanBuffer"/>.
        ''' Feld <paramref name="chanBuffer"/> channBuffer kopiert.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <remarks>
        ''' To extract the channels for several channels the function must be called separately.
        ''' Note: If channel is not on list the function returns ME_ERRNO_SUCCESS
        ''' and <paramref name="chanBufferCount"/> is set to "0".
        ''' </remarks>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityExtractValues(ByVal channel As Integer, ByRef dataBuffer As Integer, ByVal dataCount As Integer, ByRef configList As meIOStreamConfig_t, ByVal configListCount As Integer, ByRef chanBuffer As Integer, ByRef chanBufferCount As Integer) As Integer
        End Function
#End Region

#Region "meUtilityDigitalToPhysical"
        ''' <summary>
        ''' Conversion of the standardized digital values into the appropriate physical unit.
        ''' </summary>
        ''' <param name="min">
        ''' The lower limit of the range e. g. -10[V].
        ''' </param>
        ''' <param name="max">
        ''' The upper limit of the range e. g. +10[V].
        ''' </param>
        ''' <param name="maxData">
        ''' The maximum resolution of the range e. g. 65536 at 16 bit resolution.
        ''' </param>
        ''' <param name="data">
        ''' Digital value (0...65535) to be converted.
        ''' </param>
        ''' <param name="moduleType">
        ''' Support for ME-MultiSig module.
        ''' If for the current calculation no plug-on module must be taken into account,
        ''' pass the constant: <see cref="ME_MODULE_TYPE_MULTISIG_NONE"/>
        ''' No plug-on module used (standard)
        ''' </param>
        ''' <param name="refValue">
        ''' For a RTD module or a thermo-couple module. Otherwise use: ME_VALUE_NOT_USED.
        ''' </param>
        ''' <param name="physical">
        ''' Result in the corresponding physical unit [V], [A], [°C].
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than "0" or bigger than <paramref name="maxData"/>.
        ''' <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        ''' <see cref="ME_ERRNO_INVALID_MODULE_TYPE"/>: passed module type is not supported.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <remarks>
        ''' If you read data from an input sub-device in streaming mode, you should
        ''' apply the function <see cref="meUtilityExtractValues"/> to the array of values before
        ''' calling this function. Only by that way it is guarenteed, that different gain
        ''' factors and the usage of different plug-on modules in combination with the
        ''' ME-MultiSig system can be taken into account when calculating.
        ''' If you want to apply the function to a whole array of values we recommend
        ''' the function <see cref="meUtilityDigitalToPhysicalV"/>.
        ''' The parameters <paramref name="min"/> and <paramref name="max"/> must correspond with the limits of
        ''' the measurement range choosen in the functions <see cref="meIOSingleConfig"/>
        ''' resp. <see cref="meIOStreamConfig"/>.
        ''' The parameters <paramref name="min"/>, <paramref name="max"/> and <paramref name="physical"/> must be given
        ''' always in the same decimal power of the respective base unit (e. g. either "mV" or "V").
        ''' The physical unit is not relevant for calculation.
        ''' </remarks>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meUtilityExtractValues"/>
        ''' <seealso cref="meUtilityDigitalToPhysicalV"/>
        ''' <seealso cref="meIOSingleConfig"/>
        ''' <seealso cref="meIOStreamConfig"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityDigitalToPhysical(ByVal min As Double, ByVal max As Double, ByVal maxData As Integer, ByVal data As Integer, ByVal moduleType As Integer, ByVal refValue As Double, ByRef physical As Double) As Integer
        End Function
#End Region

#Region "meUtilityDigitalToPhysicalV"
        ''' <summary>
        ''' Conversion of a whole array of standardized digital values into the appropriate physical unit.
        ''' </summary>
        ''' <param name="min">
        ''' The lower limit of the range.
        ''' </param>
        ''' <param name="max">
        ''' The upper limit of the range.
        ''' </param>
        ''' <param name="maxData">
        ''' The maximum resolution of the range.
        ''' </param>
        ''' <param name="dataBuffer">
        ''' Pointer to an array of digital values to be converted.
        ''' </param>
        ''' <param name="dataCount">
        ''' Number of values in the array.
        ''' </param>
        ''' <param name="moduleType">
        ''' Support for ME-MultiSig module.
        ''' If for the current calculation no plug-on module must be taken into account,
        ''' pass the constant: <see cref="ME_MODULE_TYPE_MULTISIG_NONE"/>
        ''' No plug-on module used (standard)
        ''' </param>
        ''' <param name="refValue">
        ''' For a RTD module or a thermo-couple module. Otherwise use: ME_VALUE_NOT_USED.
        ''' </param>
        ''' <param name="physicalBuffer">
        ''' Pointer to an array for the results in the appropriate physical unit [V],
        ''' [A], [°C]. Has to be able to store <paramref name="dataCount"/> values.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than "0" or bigger than <paramref name="maxData"/>.
        ''' <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        ''' <see cref="ME_ERRNO_INVALID_MODULE_TYPE"/>: passed module type is not supported.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meUtilityDigitalToPhysical"/>
        ''' <seealso cref="meIOSingleConfig"/>
        ''' <seealso cref="meIOStreamConfig"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityDigitalToPhysicalV(ByVal min As Double, ByVal max As Double, ByVal maxData As Integer, ByRef dataBuffer As Integer, ByVal dataCount As Integer, ByVal moduleType As Integer, ByVal refValue As Double, ByRef physicalBuffer As Double) As Integer
        End Function
#End Region

#Region "meUtilityPhysicalToDigital"
        ''' <summary>
        ''' Conversion of values to be output in standardized digital values which are appropriate for the converter.
        ''' </summary>
        ''' <param name="min">
        ''' The lower limit of the range, e. g. -10[V].
        ''' </param>
        ''' <param name="max">
        ''' The upper limit of the range, e. g. +9.999695[V].
        ''' </param>
        ''' <param name="maxData">
        ''' The maximum resolution of the range, e. g. 65536 at 16 bit resolution.
        ''' </param>
        ''' <param name="physical">
        ''' Voltage or current value to be converted, e. g. +0.75[V].
        ''' </param>
        ''' <param name="data">
        ''' Result as a digital value to be output.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than <paramref name="min"/> or bigger than <paramref name="max"/>.
        ''' <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        ''' </returns>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meUtilityPhysicalToDigitalV"/>
        ''' <seealso cref="meUtilityDigitalToPhysical"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityPhysicalToDigital(ByVal min As Double, ByVal max As Double, ByVal maxData As Integer, ByVal physical As Double, ByRef data As Integer) As Integer
        End Function
#End Region

#Region "meUtilityPhysicalToDigitalV"
        ''' <summary>
        ''' Conversion of a whole array of values to be output in standardized digital values.
        ''' </summary>
        ''' <param name="min">
        ''' The lower limit of the range, e. g. -10[V].
        ''' </param>
        ''' <param name="max">
        ''' The upper limit of the range, e. g. +9.999695[V].
        ''' </param>
        ''' <param name="maxData">
        ''' The maximum resolution of the range, e. g. 65536 at 16 bit resolution.
        ''' </param>
        ''' <param name="physicalBuffer">
        ''' Pointer to an array with the voltage or current values to be converted.
        ''' </param>
        ''' <param name="physicalCount">
        ''' Number of values in the array.
        ''' </param>
        ''' <param name="dataBuffer">
        ''' Pointer to an array with the digital values to be output. Has to be able to store <paramref name="physicalCount"/> values.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than <paramref name="min"/> or bigger than <paramref name="max"/>.
        ''' <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        ''' <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        ''' </returns>
        ''' <seealso cref="meQueryRangeInfo"/>
        ''' <seealso cref="meUtilityPhysicalToDigital"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityPhysicalToDigitalV(ByVal min As Double, ByVal max As Double, ByVal maxData As Integer, ByRef physicalBuffer As Double, ByVal physicalCount As Integer, ByRef dataBuffer As Integer) As Integer
        End Function
#End Region

#Region "meUtilityPWMStart"
        ''' <summary>
        ''' configures the counter device 8254 for the operation mode "pulse width modulation" and starts the operation.
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed.
        ''' </param>
        ''' <param name="subdevice1">
        ''' Index of the sub-device counter 0 (used as prescaler).
        ''' </param>
        ''' <param name="subdevice2">
        ''' Index of the sub-device counter 1.
        ''' </param>
        ''' <param name="subdevice3">
        ''' Index of the sub-device counter 2.
        ''' </param>
        ''' <param name="reference">
        ''' Defines the clock source for counter 0 (CLK_0)
        ''' <see cref="ME_REF_CTR_INTERNAL_1MHZ"/>: Clock source is the internal 1 MHz crystal oszillator.
        ''' <see cref="ME_REF_CTR_INTERNAL_10MHZ"/>: Clock source is the internal 10 MHz crystal oszillator.
        ''' <see cref="ME_REF_CTR_EXTERNAL"/>: Clock source is an external oszillator.
        ''' </param>
        ''' <param name="prescaler">
        ''' Value for the prescaler (counter 0) in the range 2...65535.
        ''' </param>
        ''' <param name="dutyCycle">
        ''' TDuty cycle of the output signal from 1% –99% adjustable in steps of 1%.
        ''' </param>
        ''' <param name="flags">
        ''' Flag for extended options:
        ''' <see cref="ME_PWM_START_NO_FLAGS"/>: default settings
        ''' <see cref="ME_PWM_START_CONNECT_INTERNAL"/>: If supported by hardware (e. g. ME-1400 series),
        ''' connect OUT_1 with GATE_2 internally. This reduces the number of external connections.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_FLAGS"/>: not supported flag detected.
        ''' <see cref="ME_ERRNO_INVALID_REF"/>: used signal source not available.
        ''' <see cref="ME_ERRNO_INVALID_DUTY_CYCLE"/>: value outside of supported range.
        ''' <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is not a counter or internal connection can not be done
        ''' </returns>
        ''' <remarks>
        ''' A further usage of the counters 0...2 is not possible in this operation mode.
        ''' The signal is available at OUT_2 of the specified counter device.
        ''' Depending on device type the base clock (max. 10 MHz) must be provided externally
        ''' or (if supported by the hardware) an on-board crystal oszillator can be used.
        ''' Counter 0 is used as a prescaler. The frequency of the output signal is max. 50 kHz
        ''' and can be calculated as follows:
        ''' <code>fOut_2 = baseClock / prescaler * 100;  //with prescaler = 2Exp(16-1)</code>
        ''' The duty cycle can be set between 1...99% in steps of 1%
        ''' </remarks>
        ''' <seealso cref="meUtilityPWMStop"/>
        ''' <seealso cref="meUtilityPWMRestart"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityPWMStart(ByVal device As Integer, ByVal subdevice1 As Integer, ByVal subdevice2 As Integer, ByVal subdevice3 As Integer, ByVal reference As Integer, ByVal prescaler As Integer, ByVal dutyCycle As Integer, ByVal flags As Integer) As Integer
        End Function
#End Region

#Region "meUtilityPWMRestart"
        ''' <summary>
        ''' Restarts a PWM operation stopped by the function meUtilityPWMStop()
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed
        ''' </param>
        ''' <param name="subdevice1">
        ''' Index of the sub-device counter 0 used as prescaler
        ''' </param>
        ''' <param name="reference">
        ''' Defines the clock source for counter 0 (CLK_0)
        ''' <see cref="ME_REF_CTR_INTERNAL_1MHZ"/>: Clock source is the internal 1 MHz crystal oszillator.
        ''' <see cref="ME_REF_CTR_INTERNAL_10MHZ"/>: Clock source is the internal 10 MHz crystal oszillator.
        ''' <see cref="ME_REF_CTR_EXTERNAL"/>: Clock source is an external oszillator.
        ''' </param>
        ''' <param name="prescaler">
        ''' Value for the prescaler (counter 0) in the range 2...65535.
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_REF"/>: used signal source not available.
        ''' <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is no counter.
        ''' </returns>
        ''' <seealso cref="meUtilityPWMStop"/>
        ''' <seealso cref="meUtilityPWMStart"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityPWMRestart(ByVal device As Integer, ByVal subdevice1 As Integer, ByVal reference As Integer, ByVal prescaler As Integer) As Integer
        End Function
#End Region

#Region "meUtilityPWMStop"
        ''' <summary>
        ''' Stops a PWM operation started by the function <see cref="meUtilityPWMStart"/>
        ''' </summary>
        ''' <param name="device">
        ''' Index of the device to be accessed
        ''' </param>
        ''' <param name="subdevice1">
        ''' Index of the sub-device counter 0 used as prescaler
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        ''' <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        ''' <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        ''' <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is no counter.
        ''' </returns>
        ''' <seealso cref="meUtilityPWMStart"/>
        ''' <seealso cref="meUtilityPWMRestart"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl)> _
        Overloads Shared Function meUtilityPWMStop(ByVal device As Integer, ByVal subdevice1 As Integer) As Integer
        End Function
#End Region

#Region "mePropertyGetIntA"
        ''' <summary>
        ''' Read an integer value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the integer value
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertyGetIntA is the ANSI character version of mePropertyGetIntW
        ''' </remarks>
        ''' <seealso cref="mePropertyGetIntW"/>
        ''' <seealso cref="mePropertySetIntA"/>
        ''' <seealso cref="mePropertySetIntW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertyGetIntA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, ByRef propertyValue As Integer) As Integer
        End Function
#End Region

#Region "mePropertyGetIntW"
        ''' <summary>
        ''' Read an integer value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the integer value
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertyGetIntW is the wide character version of mePropertyGetIntA
        ''' </remarks>
        ''' <seealso cref="mePropertyGetIntA"/>
        ''' <seealso cref="mePropertySetIntA"/>
        ''' <seealso cref="mePropertySetIntW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertyGetIntW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, ByRef propertyValue As Integer) As Integer
        End Function
#End Region

#Region "mePropertyGetDoubleA"
        ''' <summary>
        ''' Read a double value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the double value
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertyGetDoubleA is the ANSI character version of mePropertyGetDoubleW
        ''' </remarks>
        ''' <seealso cref="mePropertyGetDoubleW"/>
        ''' <seealso cref="mePropertySetDoubleA"/>
        ''' <seealso cref="mePropertySetDoubleW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertyGetDoubleA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, ByRef propertyValue As Double) As Integer
        End Function
#End Region

#Region "mePropertyGetDoubleW"
        ''' <summary>
        ''' Read a double value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the double value
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertyGetDoubleW is the wide character version of mePropertyGetDoubleA
        ''' </remarks>
        ''' <seealso cref="mePropertyGetDoubleA"/>
        ''' <seealso cref="mePropertySetDoubleA"/>
        ''' <seealso cref="mePropertySetDoubleW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertyGetDoubleW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, ByRef propertyValue As Double) As Integer
        End Function
#End Region

#Region "mePropertyGetStringA"
        ''' <summary>
        ''' Read a string value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the ANSI-string value
        ''' </param>
        ''' <param name="count">
        ''' Buffer length in characters including the terminating null character
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL"/>: the buffer is not large enough to hold the string
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertyGetStringA is the ANSI character version of mePropertyGetStringW
        ''' The required buffer length can be determined with the property attribute "Length"
        ''' </remarks>
        ''' <seealso cref="mePropertyGetStringW"/>
        ''' <seealso cref="mePropertySetStringA"/>
        ''' <seealso cref="mePropertySetStringW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertyGetStringA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, propertyValue As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "mePropertyGetStringW"
        ''' <summary>
        ''' Read a string value from the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' Variable that receives the UTF-16 Unicode-string value
        ''' </param>
        ''' <param name="count">
        ''' Buffer length in characters, not bytes, including the terminating null character
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' <see cref="ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL"/>: the buffer is not large enough to hold the string
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' The required buffer length can be determined with the property attribute "Length"
        ''' mePropertyGetStringW is the wide character version of mePropertyGetStringA
        ''' </remarks>
        ''' <seealso cref="mePropertyGetStringA"/>
        ''' <seealso cref="mePropertySetStringA"/>
        ''' <seealso cref="mePropertySetStringW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertyGetStringW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, propertyValue As StringBuilder, ByVal count As Integer) As Integer
        End Function
#End Region

#Region "mePropertySetIntA"
        ''' <summary>
        ''' Set an integer value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The integer value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetIntA is the ANSI character version of mePropertySetIntW
        ''' </remarks>
        ''' <seealso cref="mePropertySetIntW"/>
        ''' <seealso cref="mePropertyGetIntA"/>
        ''' <seealso cref="mePropertyGetIntW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertySetIntA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, propertyValue As Integer)
        End Function
#End Region

#Region "mePropertySetIntW"
        ''' <summary>
        ''' Set an integer value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The integer value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetIntW is the wide character version of mePropertySetIntA
        ''' </remarks>
        ''' <seealso cref="mePropertySetIntA"/>
        ''' <seealso cref="mePropertyGetIntA"/>
        ''' <seealso cref="mePropertyGetIntW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertySetIntW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, propertyValue As Integer) As Integer
        End Function
#End Region

#Region "mePropertySetDoubleA"
        ''' <summary>
        ''' Set a double value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The double value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetIntA is the ANSI character version of mePropertySetDoubleW
        ''' </remarks>
        ''' <seealso cref="mePropertySetDoubleW"/>
        ''' <seealso cref="mePropertyGetDoubleA"/>
        ''' <seealso cref="mePropertyGetDoubleW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertySetDoubleA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, propertyValue As Double) As Integer
        End Function
#End Region

#Region "mePropertySetDoubleW"
        ''' <summary>
        ''' Set a double value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The double value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetDoubleW is the wide character version of mePropertySetDoubleA
        ''' </remarks>
        ''' <seealso cref="mePropertySetDoubleA"/>
        ''' <seealso cref="mePropertyGetDoubleA"/>
        ''' <seealso cref="mePropertyGetDoubleW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertySetDoubleW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, propertyValue As Double) As Integer
        End Function
#End Region

#Region "mePropertySetStringA"
        ''' <summary>
        ''' Set a string value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as ANSI-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The ANSI-string value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetStringA is the ANSI character version of mePropertyGetStringW
        ''' </remarks>
        ''' <seealso cref="mePropertySetStringW"/>
        ''' <seealso cref="mePropertyGetStringA"/>
        ''' <seealso cref="mePropertyGetStringW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
        Overloads Shared Function mePropertySetStringA(<MarshalAs(UnmanagedType.LPStr)> propertyPath As String, <MarshalAs(UnmanagedType.LPStr)> propertyValue As String) As Integer
        End Function
#End Region

#Region "mePropertySetStringW"
        ''' <summary>
        ''' Set a string value of the given property
        ''' </summary>
        ''' <param name="propertyPath">
        ''' Property path as UTF-16 Unicode-string
        ''' </param>
        ''' <param name="propertyValue">
        ''' The UTF-16 Unicode-string value to be set
        ''' </param>
        ''' <returns>
        ''' <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        ''' The return value is an error code if there is a failure.
        ''' </returns>
        ''' <remarks>
        ''' mePropertySetStringW is the wide character version of mePropertySetStringA
        ''' </remarks>
        ''' <seealso cref="mePropertySetStringA"/>
        ''' <seealso cref="mePropertyGetStringA"/>
        ''' <seealso cref="mePropertyGetStringW"/>
        <DllImport("meIDSmain.dll", CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Unicode)> _
        Overloads Shared Function mePropertySetStringW(<MarshalAs(UnmanagedType.LPWStr)> propertyPath As String, <MarshalAs(UnmanagedType.LPWStr)> propertyValue As String) As Integer
        End Function
#End Region

#End Region "MEiDSFunctions"

    End Class

End Module
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: MS Visual C-Sharp Interface

  • ME-iDS API

MS Visual C-Sharp Interface

//==============================================================================
//Copyright(c), Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : meIDS.cs
//Description : Constants, types and function prototypes of the ME-iDS API
//              for accessing the API in C#
//Note:         32bit library: meIDSmain.dll
//              64bit library: meIDSmain64.dll
//==============================================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace meIDS_CS
{
    /// <summary>
    /// Defines all constants, types, structures and methods to access the
    /// ME-iDS driver system.
    /// </summary>
    public sealed class meIDS
    {
        #region Constants

        //==================================================================
        //  General
        //==================================================================

        public const int ME_VALUE_NOT_USED                          = 0x0;

        public const int ME_VALUE_DEFAULT                           = 0x0;

        public const int ME_NO_FLAGS                                = 0x0;

        //==================================================================
        //  Defines common to access functions
        //==================================================================

        public const int ME_LOCK_RELEASE                            = 0x00010001;
        public const int ME_LOCK_SET                                = 0x00010002;
        public const int ME_LOCK_CHECK                              = 0x00010003;

        //==================================================================
        //  Defines meOpen function
        //==================================================================

        public const int ME_OPEN_NO_FLAGS                           = 0x0;

        //==================================================================
        //  Defines meClose function
        //==================================================================

        public const int ME_CLOSE_NO_FLAGS                          = 0x0;

        //==================================================================
        //  Defines meLockDriver function
        //==================================================================

        public const int ME_LOCK_DRIVER_NO_FLAGS                    = 0x0;

        //==================================================================
        //  Defines meLockDevice function
        //==================================================================

        public const int ME_LOCK_DEVICE_NO_FLAGS                    = 0x0;

        //==================================================================
        //  Defines meLockSubdevice function
        //==================================================================

        public const int ME_LOCK_SUBDEVICE_NO_FLAGS                 = 0x0;

        //==================================================================
        //  Defines common to error functions
        //==================================================================

        public const int ME_ERROR_MSG_MAX_COUNT                     = 256;

        //==================================================================
        //  Defines for meErrorSetDefaultProc function
        //==================================================================

        public const int ME_SWITCH_DISABLE                          = 0x00020001;
        public const int ME_SWITCH_ENABLE                           = 0x00020002;

        //==================================================================
        //Defines for meErrorGetLast function
        //==================================================================

        public const int ME_ERROR_GET_LAST_NO_FLAGS	                = 0x0;
        public const int ME_ERROR_GET_LAST_CLEAR                    = 0x1;

        //==================================================================
        //  Defines common to io functions
        //==================================================================

        public const int ME_REF_NONE                                = 0x0;
        public const int ME_REF_DIO_FIFO_LOW                        = 0x00030001;
        public const int ME_REF_DIO_FIFO_HIGH                       = 0x00030002;

        public const int ME_REF_CTR_PREVIOUS                        = 0x00040001;
        public const int ME_REF_CTR_INTERNAL_1MHZ                   = 0x00040002;
        public const int ME_REF_CTR_INTERNAL_10MHZ                  = 0x00040003;
        public const int ME_REF_CTR_EXTERNAL                        = 0x00040004;

        public const int ME_REF_AI_GROUND                           = 0x00050001;
        public const int ME_REF_AI_DIFFERENTIAL                     = 0x00050002;

        public const int ME_REF_AO_GROUND                           = 0x00060001;
        public const int ME_REF_AO_DIFFERENTIAL                     = 0x00060002;

        public const int ME_TRIG_CHAN_NONE                          = ME_VALUE_NOT_USED;
        public const int ME_TRIG_CHAN_DEFAULT                       = 0x00070001;
        public const int ME_TRIG_CHAN_SYNCHRONOUS                   = 0x00070002;

        public const int ME_TRIG_TYPE_NONE                          = ME_VALUE_NOT_USED;
        public const int ME_TRIG_TYPE_SW                            = 0x00080001;
        public const int ME_TRIG_TYPE_THRESHOLD                     = 0x00080002;
        public const int ME_TRIG_TYPE_WINDOW                        = 0x00080003;
        public const int ME_TRIG_TYPE_EDGE                          = 0x00080004;
        public const int ME_TRIG_TYPE_SLOPE                         = 0x00080005;
        public const int ME_TRIG_TYPE_EXT_DIGITAL                   = 0x00080006;
        public const int ME_TRIG_TYPE_EXT_ANALOG                    = 0x00080007;
        public const int ME_TRIG_TYPE_PATTERN                       = 0x00080008; // These two defines are the same
        public const int ME_TRIG_TYPE_PATTERN_MATCH                 = 0x00080008; // to preserve compatibility
        public const int ME_TRIG_TYPE_TIMER                         = 0x00080009;
        public const int ME_TRIG_TYPE_COUNT                         = 0x0008000A;
        public const int ME_TRIG_TYPE_FOLLOW                        = 0x0008000B;
        public const int ME_TRIG_TYPE_PATTERN_NO_MATCH              = 0x0008000C;
        public const int ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT          = 0x0008000D;
        public const int ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT        = 0x0008000E;
        public const int ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT     = 0x0008000F;

        public const int ME_TRIG_EDGE_NONE                          = ME_VALUE_NOT_USED;
        public const int ME_TRIG_EDGE_ABOVE                         = 0x00090001;
        public const int ME_TRIG_EDGE_BELOW                         = 0x00090002;
        public const int ME_TRIG_EDGE_ENTRY                         = 0x00090003;
        public const int ME_TRIG_EDGE_EXIT                          = 0x00090004;
        public const int ME_TRIG_EDGE_RISING                        = 0x00090005;
        public const int ME_TRIG_EDGE_FALLING                       = 0x00090006;
        public const int ME_TRIG_EDGE_ANY                           = 0x00090007;

        public const int ME_TIMER_ACQ_START                         = 0x000A0001;
        public const int ME_TIMER_SCAN_START                        = 0x000A0002;
        public const int ME_TIMER_CONV_START                        = 0x000A0003;
        public const int ME_TIMER_FIO_TOTAL                         = 0x000A0004;
        public const int ME_TIMER_FIO_FIRST_PHASE                   = 0x000A0005;

        //==================================================================
        //  Defines for meIOFrequencyToTicks function
        //==================================================================

        public const int ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS          = 0x0;
        public const int ME_IO_STREAM_FREQUENCY_TO_TICKS_NO_FLAGS   = ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS;
        public const int ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE = 0x1;

        //==================================================================
        //  Defines for meIOIrqStart function
        //==================================================================

        public const int ME_IRQ_SOURCE_DIO_PATTERN                  = 0x000B0001;
        public const int ME_IRQ_SOURCE_DIO_MASK                     = 0x000B0002;
        public const int ME_IRQ_SOURCE_DIO_LINE                     = 0x000B0003;
        public const int ME_IRQ_SOURCE_DIO_OVER_TEMP                = 0x000B0004;
        public const int ME_IRQ_SOURCE_DIO_NORMAL_TEMP              = 0x000B0005;
        public const int ME_IRQ_SOURCE_DIO_CHANGE_TEMP              = 0x000B0006;

        public const int ME_IRQ_EDGE_NOT_USED                       = ME_VALUE_NOT_USED;
        public const int ME_IRQ_EDGE_RISING                         = 0x000C0001;
        public const int ME_IRQ_EDGE_FALLING                        = 0x000C0002;
        public const int ME_IRQ_EDGE_ANY                            = 0x000C0003;

        public const int ME_IO_IRQ_START_NO_FLAGS                   = 0x0;
        public const int ME_IO_IRQ_START_DIO_BIT                    = 0x1;
        public const int ME_IO_IRQ_START_DIO_BYTE                   = 0x2;
        public const int ME_IO_IRQ_START_DIO_WORD                   = 0x4;
        public const int ME_IO_IRQ_START_DIO_DWORD                  = 0x8;
        public const int ME_IO_IRQ_START_PATTERN_FILTERING          = 0x10;
        public const int ME_IO_IRQ_START_EXTENDED_STATUS            = 0x20;
        public const int ME_IO_IRQ_START_USE_PROPERTIES             = 0x40000000;

        //==================================================================
        //  Defines for meIOIrqWait function
        //==================================================================

        public const int ME_IO_IRQ_WAIT_NO_FLAGS                    = 0x0;
        public const int ME_IO_IRQ_WAIT_NORMAL_STATUS               = 0x1;
        public const int ME_IO_IRQ_WAIT_EXTENDED_STATUS             = 0x2;

        //==================================================================
        //  Defines for meIOIrqStop function
        //==================================================================

        public const int ME_IO_IRQ_STOP_NO_FLAGS                    = 0x0;

        //==================================================================
        //  Defines for meIOIrqSetCallback function
        //==================================================================

        public const int ME_IO_IRQ_SET_CALLBACK_NO_FLAGS            = 0x0;

        //==================================================================
        //  Defines for meIOResetDevice function
        //==================================================================

        public const int ME_IO_RESET_DEVICE_NO_FLAGS                = 0x0;

        //==================================================================
        //  Defines for meIOResetSubdevice function
        //==================================================================

        public const int ME_IO_RESET_SUBDEVICE_NO_FLAGS             = 0x0;

        //==================================================================
        //  Defines for meIOSingleConfig function
        //==================================================================

        public const int ME_SINGLE_CONFIG_DIO_INPUT                 = 0x000D0001;
        public const int ME_SINGLE_CONFIG_DIO_OUTPUT                = 0x000D0002;
        public const int ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE        = 0x000D0003;
        public const int ME_SINGLE_CONFIG_DIO_SINK                  = 0x000D0004;
        public const int ME_SINGLE_CONFIG_DIO_SOURCE                = 0x000D0005;
        public const int ME_SINGLE_CONFIG_DIO_MUX32M                = 0x000D0006;
        public const int ME_SINGLE_CONFIG_DIO_DEMUX32               = 0x000D0007;
        public const int ME_SINGLE_CONFIG_DIO_BIT_PATTERN           = 0x000D0008;

        public const int ME_SINGLE_CONFIG_FIO_INPUT                 = 0x001E0001;
        public const int ME_SINGLE_CONFIG_FIO_OUTPUT                = 0x001E0002;
        public const int ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE        = 0x001E0002;
        public const int ME_SINGLE_CONFIG_FIO_SINK                  = 0x001E0003;
        public const int ME_SINGLE_CONFIG_FIO_SOURCE                = 0x001E0004;

        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_0           = 0x000E0001;
        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_1           = 0x000E0002;
        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_2           = 0x000E0003;
        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_3           = 0x000E0004;
        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_4           = 0x000E0005;
        public const int ME_SINGLE_CONFIG_CTR_8254_MODE_5           = 0x000E0006;

        public const int ME_IO_SINGLE_CONFIG_NO_FLAGS               = 0x00;
        public const int ME_IO_SINGLE_CONFIG_DIO_BIT                = 0x01;
        public const int ME_IO_SINGLE_CONFIG_DIO_BYTE               = 0x02;
        public const int ME_IO_SINGLE_CONFIG_DIO_WORD               = 0x04;
        public const int ME_IO_SINGLE_CONFIG_DIO_DWORD              = 0x08;
        public const int ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON        = 0x10;
        public const int ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF       = 0x20;
        public const int ME_IO_SINGLE_CONFIG_AI_RMS                 = 0x40;

        //==================================================================
        //  Defines for meIOSingle function
        //==================================================================

        public const int ME_IO_SINGLE_NO_FLAGS                      = 0x0;

        public const int ME_DIR_INPUT                               = 0x000F0001;
        public const int ME_DIR_OUTPUT                              = 0x000F0002;
        public const int ME_DIR_SET_OFFSET                          = 0x000F0003;

        public const int ME_IO_SINGLE_TYPE_NO_FLAGS                 = 0x00;
        public const int ME_IO_SINGLE_TYPE_DIO_BIT                  = 0x01;
        public const int ME_IO_SINGLE_TYPE_DIO_BYTE                 = 0x02;
        public const int ME_IO_SINGLE_TYPE_DIO_WORD                 = 0x04;
        public const int ME_IO_SINGLE_TYPE_DIO_DWORD                = 0x08;
        public const int ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS         = 0x10;
        public const int ME_IO_SINGLE_TYPE_NONBLOCKING              = 0x20;
        public const int ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING        = ME_IO_SINGLE_TYPE_NONBLOCKING;
        public const int ME_IO_SINGLE_TYPE_READ_NONBLOCKING         = ME_IO_SINGLE_TYPE_NONBLOCKING;

        public const int ME_IO_SINGLE_TYPE_FIO_DIVIDER              = 0x40;
        public const int ME_IO_SINGLE_TYPE_FO_START_LOW             = 0x80;
        public const int ME_IO_SINGLE_TYPE_FO_START_SOFT            = 0x100;
        public const int ME_IO_SINGLE_TYPE_FI_LAST_VALUE            = 0x200;
        public const int ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY           = 0x200;
        public const int ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL          = 0x400;
        public const int ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE    = 0x800;
        public const int ME_IO_SINGLE_TYPE_FO_USE_PROPERTIES        = 0x40000000;

        //==================================================================
        //  Defines for meIOSingleTimeToTicks function
        //==================================================================
        public const int ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS        = 0x0;

        //==================================================================
        //  Defines for meIOSingleTicksToTime function
        //==================================================================
        public const int ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS        = 0x0;

        //==================================================================
        //  Defines for meIOSetChannelOffset function
        //==================================================================

        public const int ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS          = 0x0;

        //==================================================================
        //  Defines for meIOStreamConfig function
        //==================================================================

        public const int ME_IO_STREAM_CONFIG_NO_FLAGS               = 0x0;
        public const int ME_IO_STREAM_CONFIG_BIT_PATTERN            = 0x1;
        public const int ME_IO_STREAM_CONFIG_WRAPAROUND             = 0x2;
        public const int ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD        = 0x4;

        public const int ME_IO_STREAM_CONFIG_INTERNAL_COUNTER       = unchecked((int)0x80000000);

        public const int ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS          = 0x0;

        public const int ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS         = 0x0;

        //==================================================================
        //  Defines for meIOStreamRead function
        //==================================================================

        public const int ME_READ_MODE_BLOCKING                      = 0x00100001;
        public const int ME_READ_MODE_NONBLOCKING                   = 0x00100002;

        public const int ME_IO_STREAM_READ_NO_FLAGS                 = 0x0;
        public const int ME_IO_STREAM_READ_FRAMES                   = 0x1;

        //==================================================================
        //  Defines for meIOStreamWrite function
        //==================================================================

        public const int ME_WRITE_MODE_BLOCKING                     = 0x00110001;
        public const int ME_WRITE_MODE_NONBLOCKING                  = 0x00110002;
        public const int ME_WRITE_MODE_PRELOAD                      = 0x00110003;

        public const int ME_IO_STREAM_WRITE_NO_FLAGS                = 0x00000000;

        //==================================================================
        //  Defines for meIOStreamStart function
        //==================================================================

        public const int ME_IO_STREAM_START_NO_FLAGS                = 0x00000000;
        public const int ME_IO_STREAM_START_NONBLOCKING             = 0x00000020;

        public const int ME_START_MODE_BLOCKING                     = 0x00120001;
        public const int ME_START_MODE_NONBLOCKING                  = 0x00120002;

        public const int ME_IO_STREAM_START_TYPE_NO_FLAGS           = 0x0;
        public const int ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS   = 0x1;

        //==================================================================
        //  Defines for meIOStreamStop function
        //==================================================================

        public const int ME_IO_STREAM_STOP_NO_FLAGS                 = 0x00000000;
        public const int ME_IO_STREAM_STOP_NONBLOCKING              = 0x00000020;

        public const int ME_STOP_MODE_IMMEDIATE                     = 0x00130001;
        public const int ME_STOP_MODE_LAST_VALUE                    = 0x00130002;

        public const int ME_IO_STREAM_STOP_TYPE_NO_FLAGS            = 0x00000000;

        //==================================================================
        //  Defines for meIOStreamStatus function
        //==================================================================

        public const int ME_WAIT_NONE                               = 0x00140001;
        public const int ME_WAIT_IDLE                               = 0x00140002;
        public const int ME_WAIT_BUSY                               = 0x00140003;

        public const int ME_STATUS_INVALID                          = 0x00000000;
        public const int ME_STATUS_IDLE                             = 0x00150001;
        public const int ME_STATUS_BUSY                             = 0x00150002;
        public const int ME_STATUS_ERROR                            = 0x00150003;

        public const int ME_IO_STREAM_STATUS_NO_FLAGS               = 0x00000000;

        //==================================================================
        //  Defines for meIOStreamSetCallbacks function
        //==================================================================

        public const int ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS        = 0x00000000;

        //==================================================================
        //  Defines for meIOStreamTimeToTicks function
        //==================================================================

        public const int ME_IO_TIME_TO_TICKS_NO_FLAGS               = 0x00000000;
        public const int ME_IO_STREAM_TIME_TO_TICKS_NO_FLAGS        = ME_IO_TIME_TO_TICKS_NO_FLAGS;
        public const int ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE = 0x00000001;

        //==================================================================
        //  Defines for module types
        //==================================================================

        public const int ME_MODULE_TYPE_MULTISIG_NONE               = 0x00000000;
        public const int ME_MODULE_TYPE_MULTISIG_DIFF16_10V         = 0x00160001;
        public const int ME_MODULE_TYPE_MULTISIG_DIFF16_20V         = 0x00160002;
        public const int ME_MODULE_TYPE_MULTISIG_DIFF16_50V         = 0x00160003;
        public const int ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA   = 0x00160004;
        public const int ME_MODULE_TYPE_MULTISIG_RTD8_PT100         = 0x00160005;
        public const int ME_MODULE_TYPE_MULTISIG_RTD8_PT500         = 0x00160006;
        public const int ME_MODULE_TYPE_MULTISIG_RTD8_PT1000        = 0x00160007;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B         = 0x00160008;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E         = 0x00160009;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J         = 0x0016000A;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K         = 0x0016000B;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N         = 0x0016000C;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R         = 0x0016000D;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S         = 0x0016000E;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T         = 0x0016000F;
        public const int ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR    = 0x00160010;

        //==================================================================
        //  Defines for meQuerySubdeviceCaps function
        //==================================================================

        public const int ME_CAPS_DIO_DIR_BIT                        = 0x00000001;
        public const int ME_CAPS_DIO_DIR_BYTE                       = 0x00000002;
        public const int ME_CAPS_DIO_DIR_WORD                       = 0x00000004;
        public const int ME_CAPS_DIO_DIR_DWORD                      = 0x00000008;
        public const int ME_CAPS_DIO_SINK_SOURCE                    = 0x00000010;
        public const int ME_CAPS_DIO_BIT_PATTERN_IRQ                = 0x00000020;
        public const int ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING       = 0x00000040;
        public const int ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING      = 0x00000080;
        public const int ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY          = 0x00000100;
        public const int ME_CAPS_DIO_OVER_TEMP_IRQ                  = 0x00000200;
        public const int ME_CAPS_DIO_NORMAL_TEMP_IRQ                = 0x00000400;

        public const int ME_CAPS_CTR_CLK_PREVIOUS                   = 0x00000001;
        public const int ME_CAPS_CTR_CLK_INTERNAL_1MHZ              = 0x00000002;
        public const int ME_CAPS_CTR_CLK_INTERNAL_10MHZ             = 0x00000004;
        public const int ME_CAPS_CTR_CLK_EXTERNAL                   = 0x00000008;

        public const int ME_CAPS_AI_TRIG_SIMULTANEOUS               = 0x00000001;
        public const int ME_CAPS_AI_FIFO                            = 0x00000002;
        public const int ME_CAPS_AI_FIFO_THRESHOLD                  = 0x00000004;
        public const int ME_CAPS_AI_SAMPLE_HOLD                     = 0x00000008;

        public const int ME_CAPS_AO_TRIG_SIMULTANEOUS               = 0x00000001;
        public const int ME_CAPS_AO_FIFO                            = 0x00000002;
        public const int ME_CAPS_AO_FIFO_THRESHOLD                  = 0x00000004;

        public const int ME_CAPS_FIO_SINK_SOURCE                    = 0x00000010;

        public const int ME_CAPS_EXT_IRQ_EDGE_RISING                = 0x00000001;
        public const int ME_CAPS_EXT_IRQ_EDGE_FALLING               = 0x00000002;
        public const int ME_CAPS_EXT_IRQ_EDGE_ANY                   = 0x00000004;

        //==================================================================
        //  Defines for meQuerySubdeviceCapsArgs function
        //==================================================================

        public const int ME_CAP_AI_FIFO_SIZE                        = 0x001D0000;
        public const int ME_CAP_AI_BUFFER_SIZE                      = 0x001D0001;
        public const int ME_CAP_AI_CHANNEL_LIST_SIZE                = 0x001D0002;
        public const int ME_CAP_AI_MAX_THRESHOLD_SIZE               = 0x001D0003;

        public const int ME_CAP_AO_FIFO_SIZE                        = 0x001F0000;
        public const int ME_CAP_AO_BUFFER_SIZE                      = 0x001F0001;
        public const int ME_CAP_AO_CHANNEL_LIST_SIZE                = 0x001F0002;
        public const int ME_CAP_AO_MAX_THRESHOLD_SIZE               = 0x001F0003;

        public const int ME_CAP_CTR_WIDTH                           = 0x00200000;

        public const int ME_CAP_FPGA_IN_FIFO_SIZE                   = 0x00300000;
        public const int ME_CAP_FPGA_IN_BUFFER_SIZE                 = 0x00300001;
        public const int ME_CAP_FPGA_OUT_FIFO_SIZE                  = 0x00300002;
        public const int ME_CAP_FPGA_OUT_BUFFER_SIZE                = 0x00300003;

        //==================================================================
        //  Defines common to query functions
        //==================================================================

        public const int ME_UNIT_INVALID                            = 0x00000000;
        public const int ME_UNIT_VOLT                               = 0x00170001;
        public const int ME_UNIT_AMPERE                             = 0x00170002;
        public const int ME_UNIT_ANY                                = 0x00170003;
        public const int ME_UNIT_HZ                                 = 0x00170004;

        public const int ME_TYPE_INVALID                            = 0x00000000;
        public const int ME_TYPE_AO                                 = 0x00180001;
        public const int ME_TYPE_AI                                 = 0x00180002;
        public const int ME_TYPE_DIO                                = 0x00180003;
        public const int ME_TYPE_DO                                 = 0x00180004;
        public const int ME_TYPE_DI                                 = 0x00180005;
        public const int ME_TYPE_CTR                                = 0x00180006;
        public const int ME_TYPE_EXT_IRQ                            = 0x00180007;
        public const int ME_TYPE_FIO                                = 0x00180008;
        public const int ME_TYPE_FO                                 = 0x00180009;
        public const int ME_TYPE_FI                                 = 0x0018000A;
        public const int ME_TYPE_FPGA                               = 0x0018000B;

        public const int ME_SUBTYPE_INVALID                         = 0x00000000;
        public const int ME_SUBTYPE_SINGLE                          = 0x00190001;
        public const int ME_SUBTYPE_STREAMING                       = 0x00190002;
        public const int ME_SUBTYPE_CTR_8254                        = 0x00190003;
        public const int ME_SUBTYPE_ANY                             = 0x00190004;
        public const int ME_SUBTYPE_CTR                             = 0x00190006;

        public const int ME_DEVICE_DRIVER_NAME_MAX_COUNT            = 64;
        public const int ME_DEVICE_NAME_MAX_COUNT                   = 64;

        public const int ME_DEVICE_DESCRIPTION_MAX_COUNT            = 256;

        public const int ME_BUS_TYPE_INVALID                        = 0x00000000;

        public const int ME_BUS_TYPE_ANY                            = 0x001A0000;
        public const int ME_BUS_TYPE_PCI                            = 0x001A0001;
        public const int ME_BUS_TYPE_USB                            = 0x001A0002;
        public const int ME_BUS_TYPE_LAN_PCI                        = 0x001A0101;
        public const int ME_BUS_TYPE_LAN_USB                        = 0x001A0102;

        public const int ME_PLUGGED_INVALID                         = 0x00000000;

        public const int ME_PLUGGED_ANY                             = 0x001B0000;
        public const int ME_PLUGGED_IN                              = 0x001B0001;
        public const int ME_PLUGGED_OUT                             = 0x001B0002;

        public const int ME_EXTENSION_TYPE_INVALID                  = 0x00000000;
        public const int ME_EXTENSION_TYPE_NONE                     = 0x001C0001;
        public const int ME_EXTENSION_TYPE_MUX32M                   = 0x001C0002;
        public const int ME_EXTENSION_TYPE_DEMUX32                  = 0x001C0003;
        public const int ME_EXTENSION_TYPE_MUX32S                   = 0x001C0004;
        public const int ME_EXTENSION_TYPE_ME1001                   = 0x001C0005;

        public const int ME_ACCESS_TYPE_INVALID                     = 0x00000000;
        public const int ME_ACCESS_TYPE_ANY                         = 0x001D0000;
        public const int ME_ACCESS_TYPE_LOCAL                       = 0x001D0001;
        public const int ME_ACCESS_TYPE_REMOTE                      = 0x001D0002;

        //==================================================================
        //  Defines for ConfigLoad
        //==================================================================
        public const int ME_CONF_LOAD_CUSTOM_DRIVER                 = 0x00001000;

        //==================================================================
        //  Defines for FPGA device
        //==================================================================

        public const uint ME_FPGA_FIRMWARE                          = 0xFF000001;
        public const uint ME_FPGA_SUBDEVICE                         = 0xFF000002;

        //==================================================================
        //  Defines for meUtilityPWM
        //==================================================================

        public const int ME_PWM_START_NO_FLAGS                      = 0x0;
        public const int ME_PWM_START_CONNECT_INTERNAL              = 0x1;

        //==================================================================
        //  Defines of flags for error handling
        //==================================================================

        public const int ME_ERRNO_CLEAR_FLAGS                       = 0x01;

        //==================================================================
        //  Defines of flags for device settings, used with property functions
        //==================================================================

        public const int ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS            = 0x0;
        public const int ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS          = 0x1;

        //==================================================================
        //  Defines of flags for property functions
        //==================================================================
        public const int ME_PROPERTY_TYPE_INVALID                   = 0x0;
        public const int ME_PROPERTY_TYPE_CONTAINER                 = 0x1;
        public const int ME_PROPERTY_TYPE_BOOL                      = 0x2;
        public const int ME_PROPERTY_TYPE_INT                       = 0x3;
        public const int ME_PROPERTY_TYPE_DOUBLE                    = 0x4;
        public const int ME_PROPERTY_TYPE_STRING                    = 0x5;
        public const int ME_PROPERTY_TYPE_DEFINE                    = 0x6;

        public const int ME_PROPERTY_ACCESS_READ_ONLY               = 0x0;
        public const int ME_PROPERTY_ACCESS_READ_WRITE              = 0x1;

        public const int ME_PROPERTY_BOOLEAN_FALSE                  = 0x00;
        public const int ME_PROPERTY_BOOLEAN_TRUE                   = 0x01;

        public const int ME_CALIBRATION_TYPE_FACTORY                = 0x001E0000;
        public const int ME_CALIBRATION_TYPE_USER_1                 = 0x001E0001;

        #endregion

        #region PropertyConstants

        //==================================================================
        //  System properties
        //==================================================================
        public const string ME_CONTAINER_NAME_ROOT = "\\\\";  // Root container (system container)

        public const string ME_ATTRIBUTE_NAME_NUMBER_OF_ELEMENTS    = "NumberOfElements";
        public const string ME_ATTRIBUTE_NAME_PROPERTY_NAME         = "PropertyName";
        public const string ME_ATTRIBUTE_NAME_PROPERTY_TYPE         = "PropertyType";
        public const string ME_ATTRIBUTE_NAME_PROPERTY_ACCESS       = "PropertyAccess";
        public const string ME_ATTRIBUTE_NAME_PROPERTY_DESCRIPTION  = "PropertyDescription";
        public const string ME_ATTRIBUTE_NAME_MIN_VALUE             = "MinValue";
        public const string ME_ATTRIBUTE_NAME_MAX_VALUE             = "MaxValue";
        public const string ME_ATTRIBUTE_NAME_LENGTH                = "Length";
        public const string ME_ATTRIBUTE_NAME_MAX_LENGTH            = "MaxLength";
        public const string ME_ATTRIBUTE_NAME_NUMBER_OF_SELECTIONS  = "NumberOfSelections";
        public const string ME_ATTRIBUTE_NAME_PREFIX_SELECTION      = "Selection";    // The selection with index # is "Selection#";

        //==================================================================
        //  System properties and containers
        //==================================================================

        public const string ME_PROPERTY_NAME_LIBRARY_VERSION        = "LibraryVersion";
        public const string ME_PROPERTY_NAME_MAIN_DRIVER_VERSION    = "MainDriverVersion";
        public const string ME_PROPERTY_NAME_NUMBER_OF_DEVICES      = "NumberOfDevices";
        public const string ME_CONTAINER_NAME_DEVICES               = "Devices";

        //==================================================================
        //  General device properties and containers - not device specific
        //==================================================================

        public const string ME_CONTAINER_NAME_PREFIX_DEVICE         = "Device";    // The container name for the device with index # is "Device#";
        public const string ME_PROPERTY_NAME_NAME                   = "Name";
        public const string ME_PROPERTY_NAME_DRIVER_NAME            = "DriverName";
        public const string ME_PROPERTY_NAME_DRIVER_VERSION         = "DriverVersion";
        public const string ME_PROPERTY_NAME_DESCRIPTION            = "Description";
        public const string ME_PROPERTY_NAME_SERIAL_NUMBER          = "SerialNumber";
        public const string ME_PROPERTY_NAME_BUS_TYPE               = "BusType";
        public const string ME_PROPERTY_NAME_ACCESS_TYPE            = "AccessType";
        public const string ME_PROPERTY_NAME_PLUGGED                = "Plugged";
        public const string ME_PROPERTY_NAME_FIRMWARE_SELECTABLE    = "FirmwareSelectable";
        public const string ME_PROPERTY_NAME_CURRENT_FIRMWARE_ID    = "CurrentFirmwareID";
        public const string ME_PROPERTY_NAME_NUMBER_OF_SUBDEVICES   = "NumberOfSubdevices";
        public const string ME_CONTAINER_NAME_SUBDEVICES            = "Subdevices";

        //==================================================================
        // Additional properties for PCI devices
        //==================================================================

        public const string ME_PROPERTY_NAME_PCI_VENDOR_ID          = "PCIVendorID";
        public const string ME_PROPERTY_NAME_PCI_DEVICE_ID          = "PCIDeviceID";
        public const string ME_PROPERTY_NAME_PCI_BUS_NUMBER         = "PCIBusNumber";
        public const string ME_PROPERTY_NAME_PCI_SLOT_NUMBER        = "PCISlotNumber";
        public const string ME_PROPERTY_NAME_PCI_FUNCTION_NUMBER    = "PCIFunctionNumber";

        //==================================================================
        // General sub-device properties and containers - not sub-device specific
        //==================================================================

        public const string ME_CONTAINER_NAME_PREFIX_SUBDEVICE      = "Subdevice";    // The container name for the sub-device with index # is "Subdevice#";
        public const string ME_PROPERTY_NAME_TYPE                   = "Type";
        public const string ME_PROPERTY_NAME_SUBTYPE                = "Subtype";
        public const string ME_PROPERTY_NAME_NUMBER_OF_CHANNELS     = "NumberOfChannels";
        public const string ME_PROPERTY_NAME_CONFIGURABLE           = "Configurable";
        public const string ME_PROPERTY_NAME_NUMBER_OF_CONFIGURATIONS = "NumberOfConfigurations";
        public const string ME_PROPERTY_NAME_CURRENT_CONFIGURATION  = "CurrentConfiguration";
        public const string ME_CONTAINER_NAME_CHANNELS              = "Channels";
        public const string ME_CONTAINER_NAME_PREFIX_CHANNEL        = "Channel"; // The container name for the channel with index # is "Channel#";
        public const string ME_CONTAINER_NAME_CONFIGURATIONS        = "Configurations";
        public const string ME_CONTAINER_NAME_PREFIX_CONFIGURATION  = "Configuration";    // The container name for the configuration with index # is "Configuration#";

        //==================================================================
        // Configuration properties
        //==================================================================

        public const string ME_PROPERTY_NAME_SUBDEVICE_TYPE         = "SubdeviceType";
        public const string ME_PROPERTY_NAME_SUBDEVICE_SUBTYPE      = "SubdeviceSubtype";
        public const string ME_PROPERTY_NAME_SUBDEVICE_NUMBER_OF_CHANNELS = "SubdeviceNumberOfChannels";

        //==================================================================
        // ME-5100 and ME-5001 - additional device properties
        //==================================================================

        public const string ME_PROPERTY_NAME_IO_PIN_VOLTAGE_LEVEL   = "IOPinVoltageLevel";
        public const string ME_PROPERTY_NAME_SUBDEVICES_0_AND_1_TERMINATED = "Subdevice0And1Terminated";
        public const string ME_PROPERTY_NAME_SUBDEVICES_2_AND_3_TERMINATED = "Subdevice2And3Terminated";

        //==================================================================
        // Additional sub-device properties for various sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_TERMINATED             = "Terminated";
        public const string ME_PROPERTY_NAME_SYSTEM_CLOCK_FREQUENCY = "SystemClockFrequency";

        //==================================================================
        // Additional sub-device properties and containers for DI and DO sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_TRIGGER_TYPE           = "TriggerType";
        public const string ME_PROPERTY_NAME_PREFIX_RISING_EDGE_BIT = "RisingEdgeBit";    // The name for the trigger condition on bit # is "RisingEdgeBit#";
        public const string ME_PROPERTY_NAME_PREFIX_FALLING_EDGE_BIT = "FallingEdgeBit";    // The name for the trigger condition on bit # is "FallngEdgeBit#";
        public const string ME_PROPERTY_NAME_INTERNAL_BUFFER_SIZE   = "InternalBufferSize";
        public const string ME_PROPERTY_NAME_SAMPLE_FREQUENCY       = "SampleFrequency";
        public const string ME_PROPERTY_NAME_SAMPLE_TIME            = "SampleTime";
        public const string ME_PROPERTY_NAME_START_TRIGGER_TYPE     = "StartTriggerType";
        public const string ME_PROPERTY_NAME_CONV_TRIGGER_TYPE      = "ConvTriggerType";
        public const string ME_PROPERTY_NAME_STOP_TRIGGER_TYPE      = "StopTriggerType";
        public const string ME_PROPERTY_NAME_START_STOP_PATTERN     = "StartStopPattern";
        public const string ME_PROPERTY_NAME_STOP_ON_COUNT          = "StopOnCount";
        public const string ME_PROPERTY_NAME_STOP_COUNT             = "StopCount";
        public const string ME_CONTAINER_NAME_INTERRUPT_CONDITION   = "InterruptCondition";
        public const string ME_CONTAINER_NAME_SINGLE_CONFIGURATION  = "SingleConfiguration";
        public const string ME_CONTAINER_NAME_EXT_DIGITAL_TRIGGER_CONDITION = "ExtDigitalTriggerCondition";
        public const string ME_CONTAINER_NAME_STREAMING_CONFIGURATION = "StreamingConfiguration";
        public const string ME_CONTAINER_NAME_START_AND_CONV_TRIGGER_CONDITION = "StartAndConvTriggerCondition";
        public const string ME_CONTAINER_NAME_STOP_TRIGGER_CONDITION = "StopTriggerCondition";
        public const string ME_CONTAINER_NAME_IRQ_CONFIGURATION      = "IRQConfiguration";

        //==================================================================
        // Additional sub-device properties for AI sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_CALIBRATION             = "Calibration";
        public const string ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A1  = "RisingEdgeTriggerA1";
        public const string ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A1 = "FallingEdgeTriggerA1";
        public const string ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A2  = "RisingEdgeTriggerA2";
        public const string ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A2 = "FallingEdgeTriggerA2";
        public const string ME_PROPERTY_NAME_ACQUIRE_CHANNEL         = "AcquireChannel";

        //==================================================================
        // Additional sub-device properties and containers for DI sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A  = "RisingEdgeTriggerA";
        public const string ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A = "FallingEdgeTriggerA";
        public const string ME_PROPERTY_NAME_USE_INTERNAL_TEST_COUNTER = "UseInternalTestCounter";
        public const string ME_PROPERTY_NAME_TRANSFER_SIZE          = "TransferSize";
        public const string ME_PROPERTY_NAME_IRQ_SOURCE             = "IRQSource";
        public const string ME_PROPERTY_NAME_BIT_PATTERN            = "BitPattern";
        public const string ME_PROPERTY_NAME_BIT_PATTERN_FILTERING  = "BitPatternFiltering";
        public const string ME_PROPERTY_CONTAINER_BIT_MASK          = "BitMask";

        //==================================================================
        // Additional sub-device properties and containers for DO sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_B  = "RisingEdgeTriggerB";
        public const string ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_B = "FallingEdgeTriggerB";
        public const string ME_PROPERTY_NAME_IRQ_ON_EXCESS_TEMPERATURE = "IRQOnExcessTemperature";
        public const string ME_PROPERTY_NAME_IRQ_ON_NORMAL_TEMPERATURE = "IRQOnNormalTemperature";
        public const string ME_PROPERTY_NAME_STOP_PATTERN           = "StopPattern";
        public const string ME_PROPERTY_NAME_WRAPAROUND             = "Wraparound";
        public const string ME_PROPERTY_NAME_WRAPAROUND_LOOPS       = "WraparoundLoops";

        //==================================================================
        // Additional sub-device properties and containers for DO and FO sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_OUTPUT_MODE            = "OutputMode";

        //==================================================================
        // Additional sub-device properties and containers for DIO sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_DIRECTION              = "Direction";

        //==================================================================
        // Additional sub-device properties FI sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TICKS = "MinMeasurableTotalTicks";
        public const string ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TICK  = "MaxMeasurableTotalTicks";
        public const string ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TICKS = "MinMeasurableFirstPhaseTicks";
        public const string ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TICKS = "MaxMeasurableFirstPhaseTicks";
        public const string ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TIME  = "MinMeasurableTotalTime";
        public const string ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TIME  = "MaxMeasurableTotalTime";
        public const string ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TIME = "MinMeasurableFirstPhaseTime";
        public const string ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TIME = "MaxMeasurableFirstPhaseTime";

        //==================================================================
        // Additional sub-device properties for FO sub-device types
        //==================================================================

        public const string ME_PROPERTY_NAME_MIN_TOTAL_TICKS        = "MinTotalTicks";
        public const string ME_PROPERTY_NAME_MAX_TOTAL_TICK         = "MaxTotalTicks";
        public const string ME_PROPERTY_NAME_MIN_FIRST_PHASE_TICKS  = "MinFirstPhaseTicks";
        public const string ME_PROPERTY_NAME_MAX_FIRST_PHASE_TICKS  = "MaxFirstPhaseTicks";
        public const string ME_PROPERTY_NAME_MIN_TOTAL_TIME         = "MinTotalTime";
        public const string ME_PROPERTY_NAME_MAX_TOTAL_TIME         = "MaxTotalTime";
        public const string ME_PROPERTY_NAME_MIN_FIRST_PHASE_TIME   = "MinFirstPhaseTime";
        public const string ME_PROPERTY_NAME_MAX_FIRST_PHASE_TIME   = "MaxFirstPhaseTime";

        //==================================================================
        // FO sub-device channel properties
        //==================================================================

        public const string ME_PROPERTY_NAME_INVERTED               = "Inverted";
        public const string ME_PROPERTY_NAME_SYNCHRONOUS_START      = "SynchronousStart";
        public const string ME_PROPERTY_NAME_SOFT_START             = "SoftStart";

        //==================================================================
        // Counter sub-devices - additional sub-device properties
        //==================================================================

        public const string ME_PROPERTY_NAME_WC_WIDTH_IN_BITS       = "WidthInBits";
        public const string ME_PROPERTY_NAME_CLOCK_SOURCE           = "ClockSource";
        public const string ME_PROPERTY_NAME_COUNTER_MODE           = "CounterMode";

        #endregion

        #region ErrorCodes

        public const int ME_ERRNO_SUCCESS                       = 0;
        public const int ME_ERRNO_INVALID_DEVICE                = 1;
        public const int ME_ERRNO_INVALID_SUBDEVICE             = 2;
        public const int ME_ERRNO_INVALID_CHANNEL               = 3;
        public const int ME_ERRNO_INVALID_SINGLE_CONFIG         = 4;
        public const int ME_ERRNO_INVALID_REF                   = 5;
        public const int ME_ERRNO_INVALID_TRIG_CHAN             = 6;
        public const int ME_ERRNO_INVALID_TRIG_TYPE             = 7;
        public const int ME_ERRNO_INVALID_TRIG_EDGE             = 8;
        public const int ME_ERRNO_INVALID_TIMEOUT               = 9;
        public const int ME_ERRNO_INVALID_FLAGS                 = 10;
        public const int ME_ERRNO_OPEN                          = 11;
        public const int ME_ERRNO_CLOSE                         = 12;
        public const int ME_ERRNO_NOT_OPEN                      = 13;
        public const int ME_ERRNO_INVALID_DIR                   = 14;
        public const int ME_ERRNO_PREVIOUS_CONFIG               = 15;
        public const int ME_ERRNO_NOT_SUPPORTED                 = 16;
        public const int ME_ERRNO_SUBDEVICE_TYPE                = 17;
        public const int ME_ERRNO_USER_BUFFER_SIZE              = 18;
        public const int ME_ERRNO_LOCKED                        = 19;
        public const int ME_ERRNO_NO_MORE_SUBDEVICE_TYPE        = 20;
        public const int ME_ERRNO_TIMEOUT                       = 21;
        public const int ME_ERRNO_SIGNAL                        = 22;
        public const int ME_ERRNO_INVALID_IRQ_SOURCE            = 23;
        public const int ME_ERRNO_THREAD_RUNNING                = 24;
        public const int ME_ERRNO_START_THREAD                  = 25;
        public const int ME_ERRNO_CANCEL_THREAD                 = 26;
        public const int ME_ERRNO_NO_CALLBACK                   = 27;
        public const int ME_ERRNO_USED                          = 28;
        public const int ME_ERRNO_INVALID_UNIT                  = 29;
        public const int ME_ERRNO_INVALID_MIN_MAX               = 30;
        public const int ME_ERRNO_NO_RANGE                      = 31;
        public const int ME_ERRNO_INVALID_RANGE                 = 32;
        public const int ME_ERRNO_SUBDEVICE_BUSY                = 33;
        public const int ME_ERRNO_INVALID_LOCK                  = 34;
        public const int ME_ERRNO_INVALID_SWITCH                = 35;
        public const int ME_ERRNO_INVALID_ERROR_MSG_COUNT       = 36;
        public const int ME_ERRNO_INVALID_STREAM_CONFIG         = 37;
        public const int ME_ERRNO_INVALID_CONFIG_LIST_COUNT     = 38;
        public const int ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE   = 39;
        public const int ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE   = 40;
        public const int ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN   = 41;
        public const int ME_ERRNO_INVALID_ACQ_START_TIMEOUT     = 42;
        public const int ME_ERRNO_INVALID_ACQ_START_ARG         = 43;
        public const int ME_ERRNO_INVALID_SCAN_START_TRIG_TYPE  = 44;
        public const int ME_ERRNO_INVALID_SCAN_START_ARG        = 45;
        public const int ME_ERRNO_INVALID_CONV_START_TRIG_TYPE  = 46;
        public const int ME_ERRNO_INVALID_CONV_START_ARG        = 47;
        public const int ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE   = 48;
        public const int ME_ERRNO_INVALID_SCAN_STOP_ARG         = 49;
        public const int ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE    = 50;
        public const int ME_ERRNO_INVALID_ACQ_STOP_ARG          = 51;
        public const int ME_ERRNO_SUBDEVICE_NOT_RUNNING         = 52;
        public const int ME_ERRNO_INVALID_READ_MODE             = 53;
        public const int ME_ERRNO_INVALID_VALUE_COUNT           = 54;
        public const int ME_ERRNO_INVALID_WRITE_MODE            = 55;
        public const int ME_ERRNO_INVALID_TIMER                 = 56;
        public const int ME_ERRNO_DEVICE_UNPLUGGED              = 57;
        public const int ME_ERRNO_USED_INTERNAL                 = 58;
        public const int ME_ERRNO_INVALID_DUTY_CYCLE            = 59;
        public const int ME_ERRNO_INVALID_WAIT                  = 60;
        public const int ME_ERRNO_CONNECT_REMOTE                = 61;
        public const int ME_ERRNO_COMMUNICATION                 = 62;
        public const int ME_ERRNO_INVALID_SINGLE_LIST           = 63;
        public const int ME_ERRNO_INVALID_MODULE_TYPE           = 64;
        public const int ME_ERRNO_INVALID_START_MODE            = 65;
        public const int ME_ERRNO_INVALID_STOP_MODE             = 66;
        public const int ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD    = 67;
        public const int ME_ERRNO_INVALID_POINTER               = 68;
        public const int ME_ERRNO_CREATE_EVENT                  = 69;
        public const int ME_ERRNO_LACK_OF_RESOURCES             = 70;
        public const int ME_ERRNO_CANCELLED                     = 71;
        public const int ME_ERRNO_RING_BUFFER_OVERFLOW          = 72;
        public const int ME_ERRNO_SOFTWARE_BUFFER_OVERFLOW      = ME_ERRNO_RING_BUFFER_OVERFLOW;
        public const int ME_ERRNO_RING_BUFFER_UNDERFLOW         = 73;
        public const int ME_ERRNO_SOFTWARE_BUFFER_UNDERFLOW     = ME_ERRNO_RING_BUFFER_UNDERFLOW;
        public const int ME_ERRNO_INVALID_IRQ_EDGE              = 74;
        public const int ME_ERRNO_INVALID_IRQ_ARG               = 75;
        public const int ME_ERRNO_INVALID_CAP                   = 76;
        public const int ME_ERRNO_INVALID_CAP_ARG_COUNT         = 77;
        public const int ME_ERRNO_INTERNAL                      = 78;
        public const int ME_ERRNO_VALUE_OUT_OF_RANGE            = 79;
        public const int ME_ERRNO_HARDWARE_FIFO_OVERFLOW        = 80;
        public const int ME_ERRNO_HARDWARE_BUFFER_OVERFLOW      = ME_ERRNO_HARDWARE_FIFO_OVERFLOW;
        public const int ME_ERRNO_HARDWARE_FIFO_UNDERFLOW       = 81;
        public const int ME_ERRNO_HARDWARE_BUFFER_UNDERFLOW     = ME_ERRNO_HARDWARE_FIFO_UNDERFLOW;
        public const int ME_ERRNO_CONFIG_LOAD_FAILED            = 82;
        public const int ME_ERRNO_PROPERTY_CONTAINER            = 83;
        public const int ME_ERRNO_PROPERTY_NOT_A_CONTAINER      = 84;
        public const int ME_ERRNO_PROPERTY_DATA_TYPE            = 85;
        public const int ME_ERRNO_PROPERTY_PATH                 = 86;
        public const int ME_ERRNO_PROPERTY_INDEX                = 87;
        public const int ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL     = 88;
        public const int ME_ERRNO_PROPERTY_UNKNOWN              = 89;
        public const int ME_ERRNO_PROPERTY_ATTRIBUTE_UNKNOWN    = 90;
        public const int ME_ERRNO_PROPERTY_ATTRIBUTE_UNSUPPORTED = 91;
        public const int ME_ERRNO_PROPERTY_SELECTION_INVALID    = 92;
        public const int ME_ERRNO_PROPERTY_VALUE_INVALID        = 93;
        public const int ME_ERRNO_PROPERTY_READ_ONLY            = 94;

        //==============================================================================
        //  ME_ERRNO_INVALID_ERROR_NUMBER is always the error constant
        //  with the greatest number when new error codes are added
        //==============================================================================
        public const int ME_ERRNO_INVALID_ERROR_NUMBER          = 95;

        #endregion

        #region MEiDSTypes

        #region IOSingle

        /// <summary>
        ///    Contains the necessary parameters to
        ///    read from or to write a single value to a subdevice.
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct meIOSingle_t
        {
            /// <summary>
            ///    Index of the device to be accessed.
            /// </summary>
            public int iDevice;

            /// <summary>
            ///    Index of the sub-device to be accessed.
            /// </summary>
            public int iSubdevice;

            /// <summary>
            ///    Channel index resp. index of the group
            /// </summary>
            public int iChannel;

            /// <summary>
            ///    Direction of the single operation
            /// </summary>
            /// <remarks>
            /// ME_DIR_INPUT, ME_DIR_OUTPUT, ME_DIR_SET_OFFSET
            /// </remarks>
            public int iDir;

            /// <summary>
            /// Read resp. output a 32 bit digital value. Depending on port width always the lower significant bits are relevant
            /// </summary>
            public int iValue;

            /// <summary>
            /// Time-out value in milliseconds.
            /// </summary>
            public int iTimeOut;

            /// <summary>
            /// Extended settings depending on the operation
            /// </summary>
            public int iFlags;

            /// <summary>
            /// Error code returned by the particular entry
            /// </summary>
            public int iErrno;
        }

        #endregion

        /// <summary>
        /// Channel-list for analog and digital (bit pattern output) streaming operations
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct meIOStreamConfig_t
        {
            /// <summary>
            /// Channel index. Depending on sub-device this can be analog inputs or outputs as well as a group of digital I/Os
            /// </summary>
            public int iChannel;

            /// <summary>
            /// Index of analog input or analog output range
            /// </summary>
            public int iStreamConfig;

            /// <summary>
            /// Defines the ground reference for analog inputs and outputs
            /// </summary>
            public int iRef;

            /// <summary>
            /// Extended settings
            /// </summary>
            public int iFlags;
        }

        /// <summary>
        /// Defines parameters for the start of streaming operations
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct meIOStreamStart_t
        {
            /// <summary>
            /// Index of the device to be accessed
            /// </summary>
            public int iDevice;

            /// <summary>
            /// Index of the sub-device to be accessed
            /// </summary>
            public int iSubdevice;

            /// <summary>
            /// Blocking or Nonblocking start mode of the streaming operation
            /// </summary>
            /// <remarks>
            /// ME_START_MODE_BLOCKING (waits until the proper trigger signal occurs), ME_START_MODE_NONBLOCKING (Function returns immediately)
            /// </remarks>
            public int iStartMode;

            /// <summary>
            /// Time interval in milliseconds within the first trigger pulse must occur
            /// </summary>
            public int iTimeOut;

            /// <summary>
            /// Extended settings, Start particular subdevice only or several subdevices synchronously
            /// </summary>
            /// <remarks>
            /// ME_IO_STREAM_START_TYPE_NO_FLAGS default setting, ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for Synchronous start
            /// </remarks>
            public int iFlags;

            /// <summary>
            /// If an error occurs, an error code will be set.
            /// </summary>
            public int iErrno;
        }

        /// <summary>
        /// StopList, defines end of input/output streaming operations
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct meIOStreamStop_t
        {
            /// <summary>
            /// Index of the device to be accessed.
            /// </summary>
            public int iDevice;

            /// <summary>
            /// Index of the sub-device to be accessed.
            /// </summary>
            public int iSubdevice;

            /// <summary>
            /// Stop mode of the streaming operation
            /// </summary>
            /// <remarks>
            /// <see cref="ME_STOP_MODE_IMMEDIATE"/>: Streaming operation is stopped at once.
            /// In case of an analog output 0V is attached to the pin.
            /// <see cref="ME_STOP_MODE_LAST_VALUE"/>: Output sub-device: operation is stopped on the last entry
            /// in the DA-FIFO which is a defined value.
            /// Input sub-device: operation is stopped on the last entry from the channel-list.
            /// </remarks>
            public int iStopMode;

            /// <summary>
            /// <see cref="ME_IO_STREAM_STOP_TYPE_NO_FLAGS"/>: Default settings.
            /// </summary>
            /// <remarks>
            /// Output sub-device: all buffers are cleared.
            /// Input sub-device: Hardware buffer is cleared. No synchronization at all.
            /// In mode <see cref="ME_STOP_MODE_IMMEDIATE"/> some data can be lost.
            /// </remarks>
            public int iFlags;

            /// <summary>
            /// If an error occurs, an error code will be set.
            /// </summary>
            public int iErrno;
        }

        /// <summary>
        /// Defines parameters to start and stop streaming operations.
        /// </summary>
        [StructLayout(LayoutKind.Sequential, Pack = 4)]
        public struct meIOStreamTrigger_t
        {
            /// <summary>
            /// defines the trigger type for start of the whole operation (ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_ANALOG, ME_TRIG_TYPE_THRESHOLD...)
            /// </summary>
            public int iAcqStartTrigType;

            /// <summary>
            /// defines the trigger edge for start of a single conversion (ME_TRIG_EDGE_NONE, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING...)
            /// </summary>
            public int iAcqStartTrigEdge;

            /// <summary>
            /// choose whether triggering should be done separatly for each channel (standard) or if a channel should be started synchronously with other channels
            /// </summary>
            public int iAcqStartTrigChan;

            /// <summary>
            /// Offset time in number of ticks between "start" of the measurement and the first conversion.
            /// </summary>
            public int iAcqStartTicksLow;

            /// <summary>
            /// Higher significant part of the offset time (bits 63...32)
            /// </summary>
            public int iAcqStartTicksHigh;

            /// <summary>
            /// List of Start Arguments (threshold value in [µV], slew rate in [µV/Sample], lower threshold value of the window in [µV])
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 10)]
            public int[] iAcqStartArgs;

            /// <summary>
            /// defines the trigger type for start of a scan (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_FOLLOW, ME_TRIG_TYPE_EXT_DIGITAL...)
            /// </summary>
            public int iScanStartTrigType;

            /// <summary>
            /// Time interval in ticks between the start of two consecutive scans
            /// </summary>
            public int iScanStartTicksLow;

            /// <summary>
            /// Higher significant part of the scan-time (bits 63...32)
            /// </summary>
            public int iScanStartTicksHigh;

            /// <summary>
            /// reserved
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 10)]
            public int[] iScanStartArgs;

            /// <summary>
            /// defines the trigger type for start of a single conversion (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_EXT_ANALOG)
            /// </summary>
            public int iConvStartTrigType;

            /// <summary>
            /// Chan interval in number of ticks between two conversions (Sample resp. output rate)
            /// </summary>
            public int iConvStartTicksLow;

            /// <summary>
            /// Higher significant part of the chan interval (bits 63...32)
            /// </summary>
            public int iConvStartTicksHigh;

            /// <summary>
            /// reserved
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 10)]
            public int[] iConvStartArgs;

            /// <summary>
            /// defines the trigger type for ending the scan (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT)
            /// </summary>
            public int iScanStopTrigType;

            /// <summary>
            /// Total number of conversions after which the scans will be ended and at the same time the measurement as a whole.
            /// </summary>
            public int iScanStopCount;

            /// <summary>
            /// MEphisto Scope in oscilloscope mode: trigger point in percent between 0%...100%
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 10)]
            public int[] iScanStopArgs;

            /// <summary>
            /// defines the trigger type for ending the whole operation (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT, ME_TRIG_TYPE_FOLLOW)
            /// </summary>
            public int iAcqStopTrigType;

            /// <summary>
            /// Number of scans (channel-list processings) after which the complete operation should be ended
            /// </summary>
            public int iAcqStopCount;

            /// <summary>
            /// reserved
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.I4, SizeConst = 10)]
            public int[] iArcStopArgs;

            /// <summary>
            /// ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS (default) (no flags available)
            /// </summary>
            public int iFlags;
        }

        #endregion

        #region Delegates

        /// <summary>
        /// Delegate type to be used for <see cref="meErrorSetUserProc"/>.
        /// </summary>
        /// <param name="functionName">
        /// String with the name of the faulty function where the error was detected.
        /// </param>
        /// <param name="errorCode">
        /// The error code.
        /// </param>
        /// <returns>
        /// No error possible. Return "0".
        /// </returns>
        public delegate int meErrorCB_t(string functionName, int errorCode);

        /// <summary>
        /// Delegate type to be used for <see cref="meIOStreamSetCallbacks"/>.
        /// </summary>
        /// <param name="device">
        /// Index of the device
        /// </param>
        /// <param name="subdevice">
        /// Index of the interrupt sub-device.
        /// </param>
        /// <param name="count">
        /// Input sub-device: number of values, which can be read
        /// Output sub-device: Free memory in the output buffer.
        /// </param>
        /// <param name="context">
        /// User-defined pointer.
        /// </param>
        /// <param name="errorCode">
        /// If an error occurs an error code will be returned.
        /// </param>
        /// <returns>
        /// Return the errorCode if the operation should stop when an error occured, otherwise return "0"
        /// </returns>
        public delegate int meIOStreamCB_t(int device, int subdevice, int count, IntPtr context, int errorCode);

        /// <summary>
        /// Delegate type to be used for <see cref="meIOIrqSetCallback"/>.
        /// </summary>
        /// <param name="device">
        /// Index of the device
        /// </param>
        /// <param name="subdevice">
        /// Index of the interrupt sub-device.
        /// </param>
        /// <param name="channel">
        /// Index of the interrupt channel within the sub-device
        /// </param>
        /// <param name="irqCount">
        /// Number of interrupts from the specified channel since starting.
        /// </param>
        /// <param name="value">
        /// Parameter returns the interrupt status.
        /// </param>
        /// <param name="context">
        /// User-defined pointer.
        /// </param>
        /// <param name="errorCode">
        /// Error code: see error reported by <see cref="meIOIrqWait"/>.
        /// </param>
        /// <returns>
        /// Return the errorCode if the operation should stop when an error occured, otherwise return "0"
        /// </returns>
        public delegate int meIOIrqCB_t(int device, int subdevice, int channel, int irqCount, int value, IntPtr context, int errorCode);

        #endregion

    #region MEiDSFunctions
    /// <summary>
    /// Description of the library functions for using in C#-Projects.
    /// </summary>

        #region meOpen

        /// <summary>
        /// Initializes the function library.
        /// </summary>
        /// <param name="flags">Use <see cref="ME_OPEN_NO_FLAGS"/>.</param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_OPEN"/>: ME-iDS can not be properly opened. Usually driver is not loaded.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// Before the ME-iDS driver functions can be used this function must be called.
        /// Otherwise the function calls will fail.
        /// In case of an error <see cref="meClose"/> doesn't have to be called.
        /// </remarks>
        /// <seealso cref="meClose"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meOpen(int flags);

        #endregion

        #region meClose

        /// <summary>
        /// This function closes the connection to the function library.
        /// </summary>
        /// <param name="flags">
        /// Use <see cref="ME_CLOSE_NO_FLAGS"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_CLOSE"/>: ME-iDS can not be properly closed.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// Call this function to release resources and to disconnect from the ME-iDS driver.
        /// </remarks>
        /// <seealso cref="meOpen"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meClose(int flags);

        #endregion

        #region meLockDriver

        /// <summary>
        /// Locks or unlocks the entire ME-iDS driver system.
        /// </summary>
        /// <param name="lockMode">
        /// The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        /// </param>
        /// <param name="flags">
        /// Use <see cref="ME_LOCK_DRIVER_NO_FLAGS"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        /// <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// If another thread wants access to the driver system an error message is returned.
        /// </remarks>
        /// <seealso cref="meLockDevice"/>
        /// <seealso cref="meLockSubdevice"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meLockDriver(int lockMode, int flags);

        #endregion

        #region meLockDevice

        /// <summary>
        /// Locks or unlocks a ME-iDS device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="lockMode">
        /// The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        /// </param>
        /// <param name="flags">
        /// Use <see cref="ME_LOCK_DEVICE_NO_FLAGS"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        /// <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// If another thread wants to access to a locked device an error message is returned.
        /// </remarks>
        /// <seealso cref="meLockDriver"/>
        /// <seealso cref="meLockSubdevice"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meLockDevice(int device, int lockMode, int flags);

        #endregion

        #region meLockSubdevice

        /// <summary>
        /// Locks or unlocks a sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="lockMode">
        /// The possible values are <see cref="ME_LOCK_SET"/>, <see cref="ME_LOCK_RELEASE"/>, <see cref="ME_LOCK_CHECK"/>.
        /// </param>
        /// <param name="flags">
        /// Use <see cref="ME_LOCK_SUBDEVICE_NO_FLAGS"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_LOCKED"/>: resource is locked by other application/task.
        /// <see cref="ME_ERRNO_USED"/>: resource is currently in use therefore lock can not be set.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// If another thread wants to access to a locked sub-device an error message is returned.
        /// </remarks>
        /// <seealso cref="meLockDevice"/>
        /// <seealso cref="meLockDriver"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meLockSubdevice(int device, int subdevice, int lockMode, int flags);

        #endregion

        #region meErrorGetLast

        /// <summary>
        /// Returns the last error code.
        /// </summary>
        /// <param name="errorCode">
        /// Variable that receives the error code.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_NO_FLAGS"/>: Default setting.
        /// <see cref="ME_ERRNO_CLEAR_FLAGS"/>: Do not report this error again.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <seealso cref="meErrorGetLastMessage"/>
        /// <seealso cref="meErrorGetMessage"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meErrorGetLast(out int errorCode, int flags);

        #endregion

        #region meErrorGetLastMessage

        /// <summary>
        /// Returns the last error caused by an API function.
        /// </summary>
        /// <param name="buffer">
        /// Buffer to hold the error description text.
        /// </param>
        /// <param name="count">
        /// Buffer size in bytes for the error description text. Use the constant <see cref="ME_ERROR_MSG_MAX_COUNT"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_ERROR_MSG_COUNT"/>: reserved buffer is too small for description.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <seealso cref="meErrorGetMessage"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int meErrorGetLastMessage(StringBuilder buffer, int count);

        #endregion

        #region meErrorGetMessage

        /// <summary>
        /// Converts an error code returned from an API function to plain text.
        /// </summary>
        /// <param name="errorCode">
        /// The error code from the API function.
        /// </param>
        /// <param name="msg">
        /// Buffer to hold the error description text.
        /// </param>
        /// <param name="count">
        /// Buffer size in bytes for the error description text. Use the constant ME_ERROR_MSG_MAX_COUNT.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_ERROR_NUMBER"/>: provided error code is not valid in ME-iDS.
        /// <see cref="ME_ERRNO_INVALID_ERROR_MSG_COUNT"/>: reserved buffer is too small for description.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <seealso cref="meErrorGetLastMessage"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int meErrorGetMessage(int errorCode, StringBuilder msg, int count);

        #endregion

        #region meErrorSetDefaultProc

        /// <summary>
        /// Installs a predefined global error logging routine for the entire ME-iDS.
        /// </summary>
        /// <param name="set">
        /// <see cref="ME_SWITCH_ENABLE"/>Installing the predefined error routine for global error logging.
        /// <see cref="ME_SWITCH_DISABLE"/>Uninstall the predefined error routine.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_SWITCH"/>: passed action code is not supported.
        /// </returns>
        /// <remarks>
        /// This global error routine is automatically called if any function call returns an error.
        /// Only one global error routine can be installed.
        /// The following infos are returned:
        /// -Name of the function causing the error
        /// -Short error description
        /// -Error code
        /// </remarks>
        /// <seealso cref="meErrorSetUserProc"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meErrorSetDefaultProc(int set);

        #endregion

        #region meErrorSetUserProc

        /// <summary>
        /// Installs a global user-defined error logging routine for the ME-iDS.
        /// </summary>
        /// <param name="errorProc">
        /// Delegate to the user-defined error logging routine.
        /// See <see cref="meErrorCB_t"/>
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// </returns>
        /// <remarks>
        /// This function is automatically called if any function call returns an error.
        /// Passing a NULL will uninstall a previously installed error routine.
        /// The following infos are returned:
        /// -Name of the function causing the error
        /// -Error code
        /// </remarks>
        /// <seealso cref="meErrorSetDefaultProc"/>
        /// <seealso cref="meErrorGetMessage"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meErrorSetUserProc(meErrorCB_t errorProc);

        #endregion

        #region meIOIrqSetCallback

        /// <summary>
        /// Installs a callback function which waits for an interrupt in the background.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="callback">
        /// Delegate to the user-defined callback function.
        /// See <see cref="meIOIrqCB_t"/>
        /// </param>
        /// <param name="callbackContext">
        /// User-defined pointer passed to the callback function.
        /// Can be used to pass a reference of the own instance through the callback routine
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_IRQ_SET_CALLBACK_NO_FLAGS"/>: No flags in use.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Linux only)
        /// <see cref="ME_ERRNO_THREAD_RUNNING"/>: callback thread is already running. (Windows only)
        /// </returns>
        /// <remarks>
        /// To deinstall/cancel the callback function (all registered instances)
        /// for the selected sub-device call meIOIrqSetCallback() and pass null in
        /// <paramref name="callback"/>.
        /// </remarks>
        /// <example>
        /// See also (<a href="http://msdn.microsoft.com/en-gb/magazine/cc301501.aspx">Call Unmanaged DLLs from C#, Killing Processes Cleanly</a>).
        /// <code>
        /// // the form contains a TextBox to display the values given by the callback function
        /// public partial class Form1 : Form
        /// {
        ///     meIDS.meIOIrqCB_t IrqCallback = new meIDS.meIOIrqCB_t(meIOIrqCB);   //create a delegate for Callback function
        ///     GCHandle objectHandle = new GCHandle();                             //global variable
        ///
        ///     private void MyStartIrqFunction(int deviceIndex, int subdeviceIndex)
        ///     {
        ///         objectHandle = GCHandle.Alloc(this);
        ///
        ///         int meError = meIDS.meIOIrqSetCallback(deviceIndex,             //Device index
        ///                                                subdeviceIndex,          //Subdevice index
        ///                                                IrqCallback,             //Callback routine
        ///                                                (IntPtr)objectHandle,    //Callback context, GCHandle used to wrap instance of Form
        ///                                                meIDS.ME_IO_IRQ_SET_CALLBACK_NO_FLAGS); //No flags in use
        ///
        ///         if (meError == meIDS.ME_ERRNO_SUCCESS)
        ///         {
        ///             //callback function is armed, meIDS.meIOIrqStart() may be called
        ///             meError = meIDS.meIOIrqStart(deviceIndex,                   //Device index
        ///                                          subdeviceIndex,                //Subdevice index
        ///                                          ...
        ///                                         );
        ///             ...
        ///         }
        ///     }
        ///
        ///     private static int meIOIrqCB(int idxDevice, int idxSubdevice, int idxChannel,
        ///                                         int irqCount, int value, IntPtr pContext, int errorCode)
        ///     {
        ///         if (errorCode == meIDS.ME_ERRNO_SUCCESS)
        ///         {
        ///             GCHandle objectHandle = GCHandle.FromIntPtr(pContext);          //get objectHandle of our instance
        ///             Form1 frm = (Form1)objectHandle.Target;
        ///             frm.DisplayValues(idxDevice, idxSubdevice, idxChannel, irqCount, value, pContext, errorCode);  //display values in textBox1
        ///         }
        ///         return (0);
        ///     }
        ///
        ///     // This delegate enables asynchronous calls for setting the text in a textBox1
        ///     private delegate void DisplayValuesDelegate(int idxDevice, int idxSubdevice, int idxChannel,
        ///                                    int irqCount, int value, IntPtr context, int errorCode);
        ///
        ///     // This method demonstrates a pattern for making thread-safe calls on a Windows Forms control.
        ///     private void DisplayValues(int idxDevice, int idxSubdevice, int idxChannel,
        ///                                    int irqCount, int value, IntPtr context, int errorCode)
        ///     {
        ///         // InvokeRequired compares the thread ID of the calling thread to the thread ID of the creating thread.
        ///         // If these threads are different, it returns true.
        ///         if (textBox1.InvokeRequired)
        ///         {
        ///             //The calling thread is different from the thread that created the TextBox.
        ///             //The method creates a SetTextCallback and calls itself asynchronously using the Invoke method.
        ///             DisplayValuesDelegate dispDelegate = new DisplayValuesDelegate(DisplayValues);
        ///             this.Invoke(dispDelegate, new object[] {idxDevice,  idxSubdevice, idxChannel, irqCount, value, context, errorCode});
        ///         }
        ///         else
        ///         {
        ///             //The calling thread is the same as the thread that created the TextBox
        ///             //The Text property is set directly.
        ///             textBox1.AppendText("Device index: " + idxDevice.ToString()
        ///                        + ",  Subdevice index: " + idxSubdevice.ToString()
        ///                        + String.Format(",  Value hex: 0x{0:X}", value)      //display value in hexadecimal
        ///                        + ",  dec: " + value.ToString()                      //display value in decimal
        ///                        + Environment.NewLine);
        ///         }
        ///     }
        ///
        ///     private void MyStopIrqFunction(int deviceIndex, int subdeviceIndex)
        ///     {
        ///         //disable generating IRQs
        ///         meIDS.meIOIrqStop(deviceIndex,
        ///                           subdevIndex,
        ///                           0,
        ///                           meIDS.ME_IO_IRQ_STOP_NO_FLAGS);
        ///
        ///         //Don't forget to call Free for objectHandle
        ///         if (objectHandle.IsAllocated)
        ///         {
        ///             objectHandle.Free();                        // do this when callback cannot be called anymore
        ///         }
        ///     }
        /// }
        /// </code>
        /// </example>
        /// <seealso cref="meIOIrqWait"/>
        /// <seealso cref="meIOIrqStart"/>
        /// <seealso cref="meIOIrqStop"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOIrqSetCallback(int device, int subdevice, meIOIrqCB_t callback, IntPtr callbackContext, int flags);

        #endregion

        #region meIOIrqStart

        /// <summary>
        /// Starts the interrupt handler for the given interrupt sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="channel">
        /// Index of the interrupt channel within the selected sub-device.
        /// </param>
        /// <param name="irqSource">
        /// Selection of interrupt source
        /// <see cref="ME_IRQ_SOURCE_DIO_LINE"/>: Interrupt source is a dedicated external interrupt input.
        /// <see cref="ME_IRQ_SOURCE_DIO_PATTERN"/>: Operation mode "Bit Pattern Match".
        /// When the current bit pattern at the digital port matches the reference bit pattern to be passed in <paramref name="irqArg"/> an interrupt is triggered.
        /// <see cref="ME_IRQ_SOURCE_DIO_MASK"/>: Operation mode "Bit Pattern Change".
        /// On change of at least one bit, masked as "sensitive" an interrupt is triggered.
        /// <see cref="ME_IRQ_SOURCE_DIO_OVER_TEMP"/>: On overheating of the driver circuit an interrupt is triggered.
        /// </param>
        /// <param name="irqEdge">
        /// Selection of the edge on which an interrupt should be triggered.
        /// <see cref="ME_IRQ_EDGE_NOT_USED"/>: Choosing an edge is not supported
        /// <see cref="ME_IRQ_EDGE_RISING"/>: Interrupt on rising edge
        /// <see cref="ME_IRQ_EDGE_FALLING"/>: Interrupt on falling edge
        /// <see cref="ME_IRQ_EDGE_ANY"/>: Interrupt on rising or falling edge
        /// </param>
        /// <param name="irqArg">
        /// Argument to configure the modes "Bit Pattern Match" and "Bit Pattern Change"
        /// In other cases pass the value "0" here.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_IRQ_START_NO_FLAGS"/>: No flags in use. Default settings will be used.
        /// <see cref="ME_IO_IRQ_START_DIO_BIT"/>: The reference bit pattern is one bit wide.
        /// <see cref="ME_IO_IRQ_START_DIO_BYTE"/>: The reference bit pattern is one byte wide (8 bit).
        /// <see cref="ME_IO_IRQ_START_DIO_WORD"/>: The reference bit pattern is one word wide (16 bit).
        /// <see cref="ME_IO_IRQ_START_DIO_DWORD"/>: The reference bit pattern is one long-word wide (32 bit).
        /// <see cref="ME_IO_IRQ_START_PATTERN_FILTERING"/>: (for "Bit Pattern Match" only): Enables filtering of the result.
        /// <see cref="ME_IO_IRQ_START_EXTENDED_STATUS"/>: (for "Bit Pattern Change" only): Set extended IRQ status format as default.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_INVALID_IRQ_SOURCE"/>: wrong mode or not supported by sub-device.
        /// <see cref="ME_ERRNO_INVALID_IRQ_EDGE"/>: set edge not supported.
        /// <see cref="ME_ERRNO_INVALID_IRQ_ARG"/>: wrong configuration argument / argument not supported.
        /// <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Linux only)
        /// </returns>
        /// <remarks>
        /// On demand an user-defined callback function can be installed by the function <see cref="meIOIrqSetCallback"/>() which is then called on each interrupt.
        /// </remarks>
        /// <seealso cref="meIOIrqSetCallback"/>
        /// <seealso cref="meIOIrqWait"/>
        /// <seealso cref="meIOIrqStop"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOIrqStart(int device, int subdevice, int channel, int irqSource, int irqEdge, int irqArg, int flags);

        #endregion

        #region meIOIrqStop

        /// <summary>
        /// Stops a previously started interrupt handler
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="channel">
        /// Index of the interrupt channel within the selected sub-device.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_IRQ_STOP_NO_FLAGS"/>: No flags in use. Default settings will be used.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// </returns>
        /// <seealso cref="meIOIrqStart"/>
        /// <seealso cref="meIOIrqSetCallback"/>
        /// <seealso cref="meIOIrqWait"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOIrqStop(int device, int subdevice, int channel, int flags);

        #endregion

        #region meIOIrqWait

        /// <summary>
        /// Waits as long as an interrupt occurs.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="channel">
        /// Index of the interrupt channel within the selected sub-device.
        /// </param>
        /// <param name="irqCount">
        /// Returns the number of interrupts from the specified channel since starting.
        /// </param>
        /// <param name="value">
        /// Returns the interrupt status. "Simple format": One status bit per IRQ line. "Extended format": Two status bits per IRQ line.
        /// </param>
        /// <param name="timeout">
        /// Time-out value in milliseconds. If 0 is passed the function will wait indefinitely.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_IRQ_WAIT_NO_FLAGS"/>: No flags in use. Default settings will be used.
        /// <see cref="ME_IO_IRQ_WAIT_NORMAL_STATUS"/>: Use "simple format" for interrupt status, see <paramref name="value"/>.
        /// <see cref="ME_IO_IRQ_WAIT_EXTENDED_STATUS"/>: Use "extended format" for interrupt status, see <paramref name="value"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: sub-device is protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_CANCELLED"/>: Sub-device was reset.
        /// <see cref="ME_ERRNO_SIGNAL"/>: Driver was unloaded.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: Sub-device wrongly configured.
        /// </returns>
        /// <remarks>
        /// This function is completely independent from <seealso cref="meIOIrqStart"/>.
        /// In multi-threading applications there is no need for synchronization.
        /// meIOIrqWait() can be called before or after <seealso cref="meIOIrqStart"/> and waits for the first interrupt event.
        /// If an interrupt occurs before meIOIrqWait() is called the function returns immediately and reports it.
        /// You must decide whether you want to install a callback function by <seealso cref="meIOIrqSetCallback"/>.
        /// before calling the function <seealso cref="meIOIrqStart"/>.
        /// </remarks>
        /// <seealso cref="meIOIrqStart"/>
        /// <seealso cref="meIOIrqSetCallback"/>
        /// <seealso cref="meIOIrqStop"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOIrqWait(int device, int subdeviceI, int channel, out int irqCount, out int value, int timeout, int flags);

        #endregion

        #region meIOResetDevice

        /// <summary>
        /// The device will be reset.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be reset.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_RESET_DEVICE_NO_FLAGS"/>: no flags available
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// All currently executed operations of the specific device are cancelled:
        /// - All hardware actions are stopped
        /// - Hardware is set to default (idle) state
        /// - Internal states are cleared
        /// - Buffers are flushed (emptied)
        /// - Interrupt counters are set to zero
        /// </remarks>
        /// <seealso cref="meIOResetSubdevice"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOResetDevice(int device, int flags);

        #endregion

        #region meIOResetSubdevice

        /// <summary>
        /// The sub-device will be reset.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be reset.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_RESET_SUBDEVICE_NO_FLAGS"/>: no flags available
        /// verfügbar.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// All currently executed operations of the specific sub-device are cancelled:
        /// - All hardware actions are stopped
        /// - Hardware is set to default (idle) state
        /// - Internal states are cleared
        /// - Buffers are flushed (emptied)
        /// - Interrupt counters are set to zero
        /// </remarks>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOResetSubdevice(int device, int subdevice, int flags);

        #endregion

        #region meIOSingleConfig

        /// <summary>
        /// Prepares a sub-device for a "single operation".
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="channel">
        /// Index of the channel within the selected sub-device.
        /// </param>
        /// <param name="singleConfig">
        /// Configuration of measurement ranges, digital ports and counters.
        /// </param>
        /// <param name="reference">
        /// Depending on the subdevice type it can be a ground reference,
        /// the clock source of the counters or <see cref="ME_REF_NONE"/>
        /// for standard digital I/O and frequency I/O.
        /// </param>
        /// <param name="trigChan">
        /// Trigger channel, if supported by the sub-device.
        /// </param>
        /// <param name="trigType">
        /// Trigger type for starting of input/output
        /// </param>
        /// <param name="trigEdge">
        /// Choose the appropriate trigger edge
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_SINGLE_CONFIG_NO_FLAGS"/>: No flags used. Default settings.
        /// <see cref="ME_IO_SINGLE_CONFIG_DIO_BIT"/>: Digital input/output operation by bit.
        /// <see cref="ME_IO_SINGLE_CONFIG_DIO_BYTE"/>: Digital input/output operation by byte (8 bit).
        /// <see cref="ME_IO_SINGLE_CONFIG_DIO_WORD"/>: Digital input/output operation by word (16 bit).
        /// <see cref="ME_IO_SINGLE_CONFIG_DIO_DWORD"/>: Digital input/output operation by long-word (32 bit).
        /// for the channel passed in parameter <paramref name="channel"/> and all channels beyond.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_REF"/>: parameter <paramref name="reference"/> is not correct.
        /// <see cref="ME_ERRNO_INVALID_TRIG_CHAN"/>: parameter <paramref name="trigChan"/> is not correct.
        /// <see cref="ME_ERRNO_INVALID_TRIG_TYPE"/>: parameter <paramref name="trigType"/> is not correct.
        /// <see cref="ME_ERRNO_INVALID_TRIG_EDGE"/>: parameter <paramref name="trigEdge"/> is not correct.
        /// <see cref="ME_ERRNO_INVALID_SINGLE_CONFIG"/>: parameter <paramref name="singleConfig"/> is not correct.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// Basically the operation starts after calling the function <seealso cref="meIOSingle"/>
        /// corresponding to the trigger conditions described here.
        /// </remarks>
        /// <seealso cref="meIOSingle"/>
        /// <seealso cref="meIOStreamConfig"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOSingleConfig(int device, int subdevice, int channel, int singleConfig, int refrence, int trigChan, int trigType, int trigEdge, int flags);

        #endregion

        #region meIOSingle

        /// <summary>
        /// Read/write operations can be processed.
        /// </summary>
        /// <param name="singleList">
        /// Reference to a list of type <see cref="meIOSingle_t"/>.
        /// </param>
        /// <param name="count">
        /// Number of entries in <paramref name="singleList"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_SINGLE_NO_FLAGS"/> No extended options. Default settings.
        /// Execution is stopped on first error.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_TIMEOUT"/>: timeout condition occurred.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device was not configured for required operation.
        /// <see cref="ME_ERRNO_SUBDEVICE_BUSY"/>: sub-device is performing other operation.
        /// </returns>
        /// <remarks>
        /// If for one or more list entries an external trigger source has been selected,
        /// the function waits until the appropriate trigger signal occurs.
        /// I. e. if operation 1 with external trigger is executed in blocking mode,
        /// operation 2 waits until the external trigger pulse of operation 1 occurs.
        /// </remarks>
        /// <seealso cref="meIOSingleConfig"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOSingle(ref meIOSingle_t singleList, int count, int flags);

        #endregion

        #region meIOSingleTicksToTime

        /// <summary>
        /// Converts the number of ticks into the desired time, e. g. period [s] for e. g. frequency measurement.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="timer">
        /// Ticks will be calculated in dependency of the sub-device type and the
        /// timer specified here.
        /// <see cref="ME_TIMER_FIO_TOTAL"/>: The period is converted into seconds.
        /// <see cref="ME_TIMER_FIO_FIRST_PHASE"/>: The duration of the first phase of the period is converted into seconds.
        /// </param>
        /// <param name="ticksLow">
        /// The number of ticks (lower significant part, bits 31...0) from parameter
        /// value of the function <see cref="meIOSingle"/> are passed here.
        /// </param>
        /// <param name="ticksHigh">
        /// The number of ticks (higher significant part, bits 63...32) from parameter
        /// value of the function <see cref="meIOSingle"/> are passed here. This
        /// parameter is resevered for future enhancements.
        /// </param>
        /// <param name="time">
        /// Pointer to a double value, which returns the calculated time in seconds, e. g. period [s].
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS"/>: (default)
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported
        /// </returns>
        /// <remarks>
        /// The conversion and the allowed value range depend on each sub-device and
        /// their properties. If hardware limits are exceeded, always the limit values are returned.
        /// If you need the dimensions frequency and duty-cycle you can calculate
        /// them easily by the return values from <paramref name="time"/>. It applies:
        /// Frequency [Hz] = 1/period [s]
        /// Duty-cycle [%] = ("Duration of the first phase of the period" [s] / period [s]) * 100
        /// </remarks>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOSingleTicksToTime(int device, int subdevice, int timer, int ticksLow, int ticksHigh, ref double time, int flags);
        #endregion

        #region meIOSingleTimeToTicks

        /// <summary>
        /// Converts a given time period [s] into the number of "ticks" to be passed to the
        /// timer in the function meIOSingleConfig.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="timer">
        /// Ticks will be calculated in dependency of the sub-device type and the
        /// timer specified here. The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>
        /// can be passed to the parameter value of the function <see cref="meIOSingle"/>.
        /// <see cref="ME_TIMER_FIO_TOTAL"/>: The period is converted into ticks.
        /// <see cref="ME_TIMER_FIO_FIRST_PHASE"/>: The duration of the first phase of the period is converted into ticks.
        /// </param>
        /// <param name="time">
        /// (in) Pointer to a double value, passing the asked time in seconds, e. g. the period [s]
        /// to be converted into ticks. If you pass invalid values a corresponding error code will be returned.
        /// (out) If the asked time cannot be realized exactly by the hardware the
        /// value next lower to it will be returned here. The corresponding ticks are
        /// returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        /// </param>
        /// <param name="ticksLow">
        /// Pointer to an integer value, which contains the lower significant 32 bits
        /// (31...0) of the calculated ticks. To be passed to the parameter
        /// value of the function <see cref="meIOSingle"/>.
        /// </param>
        /// <param name="ticksHigh">
        /// Pointer to an integer value, which contains the higher significant 32 bits
        /// (63...32) of the calculated ticks. This parameter is resevered for future enhancements.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS"/>: (default)
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported
        /// </returns>
        /// <remarks>
        /// The conversion and the allowed value range depend on each sub-device and
        /// their properties. If hardware limits are exceeded, an error message is returned.
        /// </remarks>
        /// <seealso cref="meIOSingle"/>
        /// <seealso cref="meIOSingleTicksToTime"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOSingleTimeToTicks(int device, int subdevice, int timer, ref double time, out int ticksLow, out int ticksHigh, int flags);
        #endregion

        #region meIOSetChannelOffset

        /// <summary>
        /// The anlog input ranges can be adjusted.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="channel">
        /// Index of the channel whose offset should be adjusted.
        /// </param>
        /// <param name="range">
        /// Index of the measurement range to be used for the measurement.
        /// </param>
        /// <param name="offset">
        /// (in) Reference to a double value, passing the asked offset
        /// (out) If the asked offset value cannot be realized exactly
        /// by the hardware the currently adjusted value will be returned.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS"/>: No flags used. Default settings.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// </returns>
        /// <seealso cref="meQueryNumberRanges"/>
        /// <seealso cref="meQueryRangeByMinMax"/>
        /// <seealso cref="meQueryRangeInfo"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOSetChannelOffset(int device, int subdevice, int channel, int range, ref double offset, int flags);

        #endregion

        #region meIOStreamConfig

        /// <summary>
        /// Configures the hardware for a timer-controlled streaming operation.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="configList">
        /// Reference to a list of type <see cref="meIOStreamConfig_t"/>.
        /// </param>
        /// <param name="count">
        /// Number of entries in <paramref name="configList"/>.
        /// </param>
        /// <param name="trigger">
        /// Pointer to a structure of type <see cref="meIOStreamTrigger_t"/>.
        /// </param>
        /// <param name="fifoIrqThreshold">
        /// Number of values to be read or written (reloaded) in one package.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_CONFIG_NO_FLAGS"/>: Flag for continuous mode (default setting).
        /// MEphisto Scope: analog acquisition
        /// <see cref="ME_IO_STREAM_CONFIG_BIT_PATTERN"/>: Bit pattern output and FIFO redirection.
        /// MEphisto Scope: Digital acquisition.
        /// <see cref="ME_IO_STREAM_CONFIG_WRAPAROUND"/>: Flag for wraparound mode (periodical output).
        /// Disables software buffer. Used only in combination with ME_IO_STREAM_CONFIG_WRAPAROUND flag.
        /// <see cref="ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD"/>: Enables "Sample Hold" feature.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CHANNEL"/>: no channel available on sub-device.
        /// <see cref="ME_ERRNO_LOCKED"/>: device or some of sub-devices are protected.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_REF"/>: parameter <see cref="meIOStreamConfig_t"/>.iRef is not correct.
        /// <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_CHAN"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigChan is not correct.
        /// <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_EDGE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigEdge is not correct.
        /// <see cref="ME_ERRNO_INVALID_STREAM_CONFIG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iStreamConfig is not correct.
        /// <see cref="ME_ERRNO_TIMEOUT"/>: timeout condition occurred.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device was not configured for required operation.
        /// <see cref="ME_ERRNO_SUBDEVICE_BUSY"/>: sub-device is performing other operation.
        /// <see cref="ME_ERRNO_INVALID_FIFO_IRQ_THRESHOLD"/>: parameter <paramref name="iFifoIrqThreshold"/> is not valid (too big).
        /// <see cref="ME_ERRNO_INVALID_CONFIG_LIST_COUNT"/>: Wrong iCount of configuration list.
        /// <see cref="ME_ERRNO_INVALID_ACQ_START_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStartTrigType is not correct.
        /// <see cref="ME_ERRNO_INVALID_ACQ_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iAcqStartTicks is not correct.
        /// <see cref="ME_ERRNO_INVALID_SCAN_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iScanStartTicks is not correct.
        /// <see cref="ME_ERRNO_INVALID_CONV_START_ARG"/>: interval <paramref name="meIOStreamConfig_t"/>.iConvStartTicks is not correct.
        /// <see cref="ME_ERRNO_INVALID_ACQ_STOP_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iConvStartTrigType is not correct.
        /// <see cref="ME_ERRNO_INVALID_SCAN_STOP_TRIG_TYPE"/>: parameter <paramref name="meIOStreamConfig_t"/>.iConvStartTrigType is not correct.
        /// <see cref="ME_ERRNO_INVALID_ACQ_STOP_ARG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iAcqStopCount is not correct.
        /// <see cref="ME_ERRNO_INVALID_SCAN_STOP_ARG"/>: parameter <paramref name="meIOStreamConfig_t"/>.iScanStopCount is not correct
        /// </returns>
        /// <remarks>
        /// For periodic bit pattern output and for periodic DEMUX operation
        /// the constant ME_IO_STREAM_CONFIG_WRAPAROUND must be ORed
        /// with the constant ME_IO_STREAM_CONFIG_ BIT_PATTERN.
        /// For analog and digital (bit pattern output) streaming operations
        /// a channel-list must be created, which contains an entry for
        /// each channel (channel index, measurement range...) of type meIOStreamConfig_t.
        /// Additionally a trigger structure (meIOStreamTrigger_t) is required,
        /// which defines numerous settings like start/stop conditions, timer settings,
        /// trigger sources and trigger edges valid for the whole operation.
        /// The operation is always started by the function meIOStreamStart()
        /// either at once (software start) or in accordance with the start
        /// conditions defined in the function meIOStreamConfig().
        /// Stop the operation either according to the stop conditions
        /// defined in the trigger structure or by calling the function meIOStreamStop().
        /// </remarks>
        /// <seealso cref="meIOStreamFrequencyToTicks"/>
        /// <seealso cref="meIOStreamFrequencyToTicks"/>
        /// <seealso cref="meIOStreamStart"/>
        /// <seealso cref="meIOStreamStop"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamConfig(int device, int subdevice, ref meIOStreamConfig_t configList, int count, ref meIOStreamTrigger_t trigger, int fifoIrqThreshold, int flags);

        #endregion

        #region meIOStreamRead

        /// <summary>
        /// Reads values from the data buffer during a timer-controlled acquisition.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="readMode">
        /// <see cref="ME_READ_MODE_BLOCKING"/>: (BLOCKING mode) The function waits until the number of
        /// measurement values specified in parameter <paramref name="count"/> has been acquired.
        /// Important: Call can block for ever!
        /// <see cref="ME_READ_MODE_NONBLOCKING"/>: (NONBLOCKING mode) The function returns immediately
        /// either with the number of measurement values available when calling
        /// the function or with the number specified in <paramref name="count"/>.
        /// Each time the lower value is valid.
        /// </param>
        /// <param name="values">
        /// Reference to a data buffer to be filled up.
        /// </param>
        /// <param name="count">
        /// (in) Size of the data buffer to be read in number of measurement values.
        /// (out) The pointer returns the number of values actually read from the data buffer.
        /// If in BLOCKING mode the acquisition has been cancelled, the return value can also be less than the value passed.
        /// BLOCKING mode:
        /// Number of values to be read – as a rule a multiple of the channel-list length,
        /// but this is not necessary (see also meUtilityExtractValues() on page 169).
        /// NONBLOCKING mode:
        /// Number of values to be read – if you want to read a multiple of channel-list
        /// length use the constant ME_IO_STREAM_ READ_FRAMES in the parameter <paramref name="flags"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_READ_NO_FLAGS"/>: Default settings.
        /// <see cref="ME_IO_STREAM_READ_FRAMES"/>: Reading a multiple of channel-list length in NONBLOCKING mode.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_VALUE_COUNT"/>: <paramref name="count"/> is lower than zero.
        /// <see cref="ME_ERRNO_INVALID_READ_MODE"/>: not supported read mode detected.
        /// <see cref="ME_ERRNO_SUBDEVICE_NOT_RUNNING"/>: buffer is empty and sub-device is not running a streaming operation.
        /// <see cref="ME_ERRNO_HARDWARE_BUFFER_OVERFLOW"/>: error during acquisition. Reading data from FIFO was too slow.
        /// <see cref="ME_ERRNO_SOFTWARE_BUFFER_OVERFLOW"/>: no place in buffer for new data. Reading data from buffer was too slow.
        /// </returns>
        /// <remarks>
        /// The user has to allocate a data buffer, to which the measurement values are written to.
        /// Using the execution mode BLOCKING the function meIOStreamRead() returns when the last
        /// value has been read. In NONBLOCKING mode the function returns at once
        /// with the available measurement values. For reading the data a callback function can also be used.
        /// </remarks>
        /// <seealso cref="meIOStreamStatus"/>
        /// <seealso cref="meIOStreamSetCallbacks"/>
        /// <seealso cref="meUtilityDigitalToPhysical"/>
        /// <seealso cref="meUtilityExtractValues"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamRead(int device, int subdevice, int readMode, out int values, ref int count, int flags);

        #endregion

        #region meIOStreamWrite

        /// <summary>
        /// Writes data to a buffer for timer-controlled analog resp. digital output.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="writeMode">
        /// <see cref="ME_WRITE_MODE_BLOCKING"/>: The function waits until the number of values specified
        /// in parameter <paramref name="count"/> can be written to the internal buffer.
        /// Important: Call can block for ever!
        /// <see cref="ME_WRITE_MODE_NONBLOCKING"/>: With this option the function writes as many values
        /// to the internal buffer as there is space at the moment the function was called
        /// (max. number specified in <paramref name="count"/>).
        /// <see cref="ME_WRITE_MODE_PRELOAD"/>: Pre-loading the data buffer for the first time.
        /// Data will be written directly to the hardware buffer.
        /// If there are more data as there is space in the FIFO the rest is stored in an internal buffer.
        /// Note: This is non-blocking writing.
        /// </param>
        /// <param name="values">
        /// Pointer to a data buffer (data stream) with the values resp. bit patterns to be output.
        /// Use the function <seealso cref="meUtilityPhysicalToDigital"/> for easy conversion of physical
        /// values (e. g. voltage) into digital values.
        /// </param>
        /// <param name="count">
        /// (in): Number of values to be loaded into the data buffer.
        /// (out): The pointer returns the number of values which could be written into the data buffer actually.
        /// The number will never be greater, but can also be less,
        /// if there is less memory for the number of values passed.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_WRITE_NO_FLAGS"/>: Default settings – no flags available
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_VALUE_COUNT"/>: <paramref name="count"/> is lower than zero.
        /// Note: When <paramref name="count"/> is set to zero ME_ERRNO_SUCCESS is returned.
        /// <see cref="ME_ERRNO_INVALID_WRITE_MODE"/>: not supported write mode detected.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: device is configured to work in single mode.
        /// <see cref="ME_ERRNO_HARDWARE_BUFFER_UNDERFLOW"/>: error during streaming. Writing data to FIFO was too slow.
        /// Hardware wraparound: More data than space in FIFO.
        /// <see cref="ME_ERRNO_SOFTWARE_BUFFER_UNDERFLOW"/>: (wraparound only) no place in buffer for data.
        /// <see cref="ME_ERRNO_SUBDEVICE_NOT_RUNNING"/>: The internal hardware state machine is stopped but
        /// logical status show that should be working. No data in FIFO but software buffer is not empty
        /// </returns>
        /// <remarks>
        /// For the values to be output allocate a data buffer of defined size for each sub-device to be used.
        /// </remarks>
        /// <seealso cref="meIOStreamRead"/>
        /// <seealso cref="meUtilityPhysicalToDigital"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamWrite(int device, int subdevice, int writeMode, ref int values, ref int count, int flags);

        #endregion

        #region meIOStreamSetCallbacks

        /// <summary>
        /// Installs different callback functions that wait for an event on a streaming sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="startCB">
        /// Delegate to an user-defined function. This function is called when streaming operation starts.
        /// If the function exits with a return value different than <see cref="ME_ERRNO_SUCCESS"/>
        /// streaming is instantly stopped, <seealso cref="meIOStreamStop"/> is executed.
        /// </param>
        /// <param name="startCBContext">
        /// User-defined pointer passed to start callback function.
        /// This parameter is optional. If you don't want to use this functionality pass NULL.
        ///  </param>
        /// <param name="newValuesCB">
        /// Pointer to an user-defined function. This function is called when the buffer status is changing.
        /// If the function exits with a return value different than <see cref="ME_ERRNO_SUCCESS"/>
        /// streaming is instantly stopped, <seealso cref="meIOStreamStop"/> is executed.
        /// </param>
        /// <param name="newValuesCBContext">
        /// User-defined pointer passed to new values callback function. This parameter is optional.
        /// If you don't want to use this functionality pass NULL
        /// </param>
        /// <param name="endCB">
        /// Pointer to an user-defined function. This function is called when streaming operation stops.
        /// </param>
        /// <param name="endCBContext">
        /// User-defined pointer passed to stop callback function. This parameter is optional.
        /// If you don't want to use this functionality pass NULL.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS"/>: (no flags available)
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// To deinstall/cancel all registered callback instances for the selected sub-device call
        /// meIOStreamSetCallbacks() with all callback pointers
        /// (<paramref name="startCB"/>, <paramref name="newValuesCB"/> and <paramref name="endCB"/>) set to NULL.
        /// </remarks>
        /// <seealso cref="meIOStreamStart"/>
        /// <seealso cref="meIOStreamStop"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamSetCallbacks(int device, int subdevice, meIOStreamCB_t startCB, IntPtr startCBContext, meIOStreamCB_t newValuesCB, IntPtr newValuesCBContext, meIOStreamCB_t endCB, IntPtr endCBContext, int flags);

        #endregion

        #region meIOStreamStart

        /// <summary>
        /// Starts streaming operations.
        /// </summary>
        /// <param name="startList">
        /// Pointer to a list of type meIOStreamStart_t, by which one or more streaming operations can be started.
        /// The start is done immediately after calling the function corresponding to the start conditions.
        /// If for one or more list entries the <see cref="meIOStreamStart_t"/>.iStartMode
        /// </param>
        /// <param name="count">
        /// Number of meIOStreamStart_t entries in <paramref name="startList"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_START_NO_FLAGS"/>: Default settings. Execute list up to the first error.
        /// Returned value corresponds with the first non-zero <see cref="meIOStreamStart_t"/>.iErrno field.
        /// <see cref="ME_IO_STREAM_START_NONBLOCKING"/>: (Linux only) Execute whole start list.
        /// When this flag is set execution is processed although an error occured for some entries.
        /// The function returns ME_ERRNO_SUCCESS when no global error was detected.
        /// <see cref="meIOStreamStart_t"/>.iErrno fields have to be checked.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of the passed flags are not supported.
        /// <see cref="ME_ERRNO_INVALID_TIMEOUT"/>: timeout lower than 0.
        /// <see cref="ME_ERRNO_INVALID_START_MODE"/>: not supported start mode detected.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device is not configured correctly to proceed streaming operation.
        /// <see cref="ME_STATUS_ERROR"/>: previous operation ended with an error. Reset has to be called to clear this state.
        /// <see cref="ME_ERRNO_LACK_OF_RESOURCES"/>: (output only) operation can not be proceed. Buffers are empty. (Linux only)
        /// <see cref="ME_ERRNO_TIMEOUT"/>: Operation didn't start on time.
        /// <see cref="ME_ERRNO_START_THREAD"/>: creating callback thread failed. (Windows only)
        /// </returns>
        /// <remarks>
        /// Returning of the function depends on the <see cref="meIOStreamStart_t"/>.iStartMode
        /// (BLOCKING or NONBLOCKING) and trigger conditions defined in the function <see cref="meIOStreamConfig"/>.
        /// </remarks>
        /// <seealso cref="meIOStreamStart_t"/>
        /// <seealso cref="meIOStreamConfig"/>
        /// <seealso cref="meIOStreamStop"/>
        /// <seealso cref="meIOResetDevice"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamStart(ref meIOStreamStart_t startList, int count, int flags);

        #endregion

        #region meIOStreamStatus

        /// <summary>
        /// Checks the status of streaming operation.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="wait">
        /// Behaviour of return of this function:
        /// <see cref="ME_WAIT_NONE"/>: Check current status.
        /// Function returns the current state of operation immediately in parameter <paramref name="status"/>.
        /// <see cref="ME_WAIT_IDLE"/>: In case of an output operation the function waits until all values have been output.
        /// The function returns with <see cref="ME_STATUS_IDLE"/> in parameter <paramref name="status"/>.
        /// Important: Call can block for ever!
        /// <see cref="ME_WAIT_BUSY"/>: (Linux only)
        /// The function blocks while the status is <see cref="ME_STATUS_BUSY"/>
        /// Important: Call can block for ever!
        /// </param>
        /// <param name="status">
        /// Pointer which returns the current state of operation of the specified sub-device.
        /// <see cref="ME_STATUS_IDLE"/>: Streaming operation has finished.
        /// <see cref="ME_STATUS_BUSY"/>: Streaming operation is still running.
        /// <see cref="ME_STATUS_ERROR"/>: Error occured, e. g. data stream was interrupted.
        /// </param>
        /// <param name="count">
        /// Input sub-device: Number of values which can be read
        /// Output sub-device: Free memory in the output buffer (in number of values)
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_STATUS_NO_FLAGS"/>: Default settings – no flags available
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: unsupported flag detected.
        /// <see cref="ME_ERRNO_INVALID_WAIT"/>: not supported wait mode detected.
        /// </returns>
        /// <remarks>
        /// Depending on input or output operation this function is used to check whether
        /// all measurement values have been acquired or whether an output operation is still running.
        /// With the parameter <paramref name="wait"/> you can control, whether the function
        /// should return the current state at once, or whether you want to wait
        /// until the input resp. output operation has been ended.
        /// </remarks>
        /// <seealso cref="meIOStreamRead"/>
        /// <seealso cref="meIOStreamWrite"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamStatus(int device, int subdevice, int wait, out int status, out int count, int flags);

        #endregion

        #region meIOStreamStop

        /// <summary>
        /// An "infinite" operation can be cancelled at once or stopped in a defined way.
        /// </summary>
        /// <param name="stopList">
        /// Pointer to a list of type <see cref="meIOStreamStop_t"/> to end one or several input/output operations.
        /// Stopping is done in accordance to parameter <see cref="meIOStreamStop_t"/>.iStopMode.
        /// </param>
        /// <param name="count">
        /// Number of <see cref="meIOStreamStop_t"/> entries in <paramref name="stopList"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_STREAM_STOP_NO_FLAGS"/>: Default settings.
        /// Execute list up to the first error.
        /// Returned value corresponds with the first non-zero <see cref="meIOStreamStop_t"/>.iErrno field.
        /// <see cref="ME_IO_STREAM_STOP_NONBLOCKING"/>: (Linux only)
        /// Execute whole stop list one by one. When this flag is set execution is processed
        /// although an error occured for some entries. The function returns ME_SUCCESS
        /// when no global error was detected. <see cref="meIOStreamStop_t"/>.iErrno fields have to be checked.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: unsupported flag detected.
        /// <see cref="ME_ERRNO_INVALID_STOP_MODE"/>: not supported stop mode detected.
        /// <see cref="ME_ERRNO_PREVIOUS_CONFIG"/>: sub-device is not configured correctly to proceed streaming operation.
        /// <see cref="ME_STATUS_ERROR"/>: previous operation ended with an error. Reset has to be called to clear this state.
        /// </returns>
        /// <remarks>
        /// With meIOStreamStop you have the possibility to stop an output operation by the last entry
        /// in the FIFO which is a known value.
        /// If in the parameters iAcqStopCount resp. iScanStopCount of the function meIOStreamConfig()
        /// stop conditions have been defined, calling the function meIOStreamStop() is not necessary.
        /// Configuration of the sub-device remains preserved (channel-list, timer...)
        /// so that a restart with the function <see cref="meIOStreamStart"/> is possible without new configuration.
        /// In opposite to this using the function <see cref="meIOResetDevice"/> deletes the whole configuration of the device.
        /// </remarks>
        /// <seealso cref="meIOStreamStop_t"/>
        /// <seealso cref="meIOResetDevice"/>
        /// <seealso cref="meIOStreamStart"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamStop(ref meIOStreamStop_t stopList, int count, int flags);

        #endregion

        #region meIOStreamFrequencyToTicks

        /// <summary>
        /// Converts a given frequency [Hz] into the number of "ticks"
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="timer">
        /// Ticks will be calculated in dependency of the sub-device to which the specified timer belongs to.
        /// The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> are passed
        /// in the trigger structure of the function <see cref="meIOStreamConfig"/>
        /// <see cref="ME_TIMER_ACQ_START"/>: <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// <see cref="ME_TIMER_SCAN_START"/>: <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// <see cref="ME_TIMER_CONV_START"/>: <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// </param>
        /// <param name="frequency">
        /// Pointer to a double value, passing the asked frequency [Hz] to be converted into ticks.
        /// If you pass „0“ the maximum frequency will be returned.
        /// If the asked frequency cannot be realized exactly by the hardware the frequency next higher
        /// to it will be returned as an approximation.
        /// The corresponding ticks are returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        /// </param>
        /// <param name="ticksLow">
        /// Pointer to an integer value, which contains the lower significant 32 bits (31...0) of the calculated ticks.
        /// Will be passed to the appropriate parameter startTicksLow of the function <see cref="meIOStreamConfig"/>.
        /// </param>
        /// <param name="ticksHigh">
        /// Pointer to an integer value, which contains the higher significant 32 bits (63...32) of the calculated ticks.
        /// Will be passed to the appropriate parameter startTicksHigh of the function <see cref="meIOStreamConfig"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS"/>: (default) MEphisto Scope: data-logging mode
        /// <see cref="ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE"/>: MEphisto Scope: oscilloscope mode
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// The conversion and the allowed value range depend on each sub-device and their timers.
        /// If hardware limits are exceeded, always the limit values are returned.
        /// Tip: Passing "0" in parameter <paramref name="frequency"/> of this function returns the maximum frequency allowed.
        /// In dependency of parameter <paramref name="timer"/> of this function the return values of
        /// <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> can be passed to the corresponding parameters
        /// <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks, <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        /// and <see cref="meIOStreamTrigger_t"/>.iScanStartTicks in the trigger structure of function <see cref="meIOStreamConfig"/>.
        /// </remarks>
        /// <seealso cref="meIOStreamTimeToTicks"/>
        /// <seealso cref="meIOStreamConfig"/>
        /// <seealso cref="meIOStreamTrigger_t"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamFrequencyToTicks(int device, int subdevice, int timer, ref double frequency, out int ticksLow, out int ticksHigh, int flags);

        #endregion

        #region meIOStreamTimeToTicks

        /// <summary>
        /// Converts a given time period [s] into the number of "ticks".
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="timer">
        /// Ticks will be calculated in dependency of the sub-device to which the specified timer belongs to.
        /// The values <paramref name="ticksLow"/> and <paramref name="ticksHigh"/> are passed
        /// in the trigger structure of the function <see cref="meIOStreamConfig"/>
        /// <see cref="ME_TIMER_ACQ_START"/>: <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// <see cref="ME_TIMER_SCAN_START"/>: <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// <see cref="ME_TIMER_CONV_START"/>: <see cref="meIOStreamTrigger_t"/>.iConvStartTicks
        /// should be calculated for passing to the parameter of the same name.
        /// </param>
        /// <param name="time">
        /// (in): Pointer to a double value, passing the asked period [s] to be converted into ticks.
        /// If you pass "0" the minimum period will be returned.
        /// (out): If the asked period cannot be realized exactly by the hardware the
        /// period next lower to it will be returned as an approximation. The corresponding ticks
        /// are returned in the parameters <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>.
        /// </param>
        /// <param name="ticksLow">
        /// Pointer to an integer value, which contains the lower significant 32 bits (31...0) of the calculated ticks.
        /// Will be passed to the appropriate parameter startTicksLow of the function <see cref="meIOStreamConfig"/>.
        /// </param>
        /// <param name="ticksHigh">
        /// Pointer to an integer value, which contains the higher significant 32 bits (63...32) of the calculated ticks.
        /// Will be passed to the appropriate parameter startTicksHigh of the function <see cref="meIOStreamConfig"/>.
        /// </param>
        /// <param name="flags">
        /// <see cref="ME_IO_TIME_TO_TICKS_NO_FLAGS"/>: (default) MEphisto Scope: data-logging mode
        /// <see cref="ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE"/>: MEphisto Scope: oscilloscope mode
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_TIMER"/>: not supported timer ID.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: some of passed flags are not supported.
        /// </returns>
        /// <remarks>
        /// The conversion and the allowed value range depend on each sub-device and their timers.
        /// If hardware limits are exceeded, always the limit values are returned.
        /// Tip: Passing "0" in parameter <paramref name="time"/> of this function returns the
        /// minimum frequency allowed. In dependency of parameter <paramref name="timer"/> of
        /// this function the return values of <paramref name="ticksLow"/> and <paramref name="ticksHigh"/>
        /// can be passed to the corresponding parameters <see cref="meIOStreamTrigger_t"/>.iAcqStartTicks,
        /// <see cref="meIOStreamTrigger_t"/>.iConvStartTicks and <see cref="meIOStreamTrigger_t"/>.iScanStartTicks
        /// in the trigger structure of function <see cref="meIOStreamConfig"/>.
        /// </remarks>
        /// <seealso cref="IOStreamFrequencyToTicks"/>
        /// <seealso cref="meIOStreamConfig"/>
        /// <seealso cref="meIOStreamTrigger_t"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meIOStreamTimeToTicks(int device, int subdevice, int timer, ref double time, out int ticksLow, out int ticksHigh, int flags);

        #endregion

        #region meQueryDescriptionDevice

        /// <summary>
        /// Determines the device description.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="description">
        /// Buffer to hold the device description.
        /// </param>
        /// <param name="count">
        /// Buffer size in bytes for device description.
        /// Recommended: <see cref="ME_DEVICE_DESCRIPTION_MAX_COUNT"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        /// </returns>
        /// <seealso cref="meQueryInfoDevice"/>
        /// <seealso cref="meQueryNameDevice"/>
        /// <seealso cref="meQueryNumberDevices"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int meQueryDescriptionDevice(int device, StringBuilder description, int count);

        #endregion

        #region meQueryInfoDevice

        /// <summary>
        /// Determines detailed information of the device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="vendorId">
        /// Pointer returns vendor ID of the device.
        /// 0x1402 for Meilhaus PCI boards, 0x1B04 for USB devices like e. g. ME-1 (ME-Synapse USB).
        /// </param>
        /// <param name="deviceId">
        /// Pointer returns the device ID.
        /// </param>
        /// <param name="serialNo">
        /// Pointer returns the serial number of the device.
        /// </param>
        /// <param name="busType">
        /// Pointer returns the bus type by which the device is connected with the PC (PCI/cPCI, USB).
        /// </param>
        /// <param name="busNo">
        /// PCI only: Pointer returns the PCI bus number, if several PCI buses are available in your system (if one bus it is always "0")
        /// </param>
        /// <param name="slot">
        /// PCI only: Slot number of the board to be accessed.
        /// </param>
        /// <param name="funcNo">
        /// PCI: Function number.
        /// </param>
        /// <param name="plugged">
        /// Pointer indicates whether a device is physically available.
        /// <see cref="ME_PLUGGED_IN"/>: Device physically available.
        /// <see cref="ME_PLUGGED_OUT"/>: Device registered with the ME-iDC (ME-Config-Tool) but not connected with the PC.
        /// <see cref="ME_PLUGGED_INVALID"/>: invalid return value
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// </returns>
        /// <remarks>
        /// This is a PCI orientated function and some parameters have no meaning for
        /// ME-Synapse USB or ME-Synapse LAN.
        /// </remarks>
        /// <seealso cref="meQueryDescriptionDevice"/>
        /// <seealso cref="meQueryNameDevice"/>
        /// <seealso cref="meQueryNumberDevices"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryInfoDevice(int device,
                                                   out int vendorId,
                                                   out int deviceId,
                                                   out int serialNo,
                                                   out int busType,
                                                   out int busNo,
                                                   out int slot,
                                                   out int funcNo,
                                                   out int plugged);

        #endregion

        #region meQueryNameDevice

        /// <summary>
        /// Determines the device name.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="name">
        /// Buffer for the device name.
        /// </param>
        /// <param name="count">
        /// Buffer size in bytes for device name. Recommended: <see cref="ME_DEVICE_NAME_MAX_COUNT"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        /// </returns>
        /// <seealso cref="meQueryInfoDevice"/>
        /// <seealso cref="meQueryDescriptionDevice"/>
        /// <seealso cref="meQueryNumberDevices"/>
        /// <seealso cref="meQueryNameDeviceDriver"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int meQueryNameDevice(int device, StringBuilder name, int count);

        #endregion

        #region meQueryNameDeviceDriver

        /// <summary>
        /// Determines the name of the device specific driver module.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="name">
        /// Pointer to a buffer for the driver module.
        /// </param>
        /// <param name="count">
        /// Buffer size in bytes for the driver module.
        /// Recommended: <see cref="ME_DEVICE_DRIVER_NAME_MAX_COUNT"/>.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_USER_BUFFER_SIZE"/>: count smaller than 1.
        /// </returns>
        /// <seealso cref="meQueryVersionDeviceDriver"/>
        /// <seealso cref="meQueryVersionMainDriver"/>
        /// <seealso cref="meQueryVersionLibrary"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int meQueryNameDeviceDriver(int device, StringBuilder name, int count);

        #endregion

        #region meQueryNumberDevices

        /// <summary>
        /// Determines the number of devices recognized by the ME-iDS.
        /// </summary>
        /// <param name="count">
        /// Contains the number of recognized devices after the function returned.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <remarks>
        /// Not all devices have to be physically present.
        /// This can be tested with the function <see cref="meQueryInfoDevice"/>.
        /// </remarks>
        /// <seealso cref="meQueryInfoDevice"/>
        /// <seealso cref="meQueryNumberSubdevices"/>
        /// <seealso cref="meQueryNumberChannels"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryNumberDevices(out int count);

        #endregion

        #region meQueryNumberSubdevices

        /// <summary>
        /// Determines the number of sub-devices on a queried device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="count">
        /// Number of sub-devices on the device.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// </returns>
        /// <seealso cref="meQueryNumberDevices"/>
        /// <seealso cref="meQueryNumberChannels"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryNumberSubdevices(int device, out int count);

        #endregion

        #region meQueryNumberChannels

        /// <summary>
        /// Determines the number of channels of a sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="count">
        /// Returns the number of channels of the specified sub-device.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// </returns>
        /// <seealso cref="meQueryNumberDevices"/>
        /// <seealso cref="meQueryNumberSubdevices"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryNumberChannels(int device, int subdevice, out int count);

        #endregion

        #region meQueryNumberRanges

        /// <summary>
        /// Determines the number of ranges which support the specified measurement range(s).
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="unit">
        /// Restrict the query to the specified measurement range(s).
        /// <see cref="ME_UNIT_ANY"/>: Query for all ranges
        /// <see cref="ME_UNIT_VOLT"/>: Query only for voltage ranges
        /// <see cref="ME_UNIT_AMPERE"/>: Query only for current ranges
        /// </param>
        /// <param name="count">
        /// Returns the number of ranges which support the specified measurement range(s).
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_NOT_SUPPORTED"/>: function is not supported by sub-device.
        /// </returns>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meQueryRangeByMinMax"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryNumberRanges(int device, int subdevice, int unit, out int count);

        #endregion

        #region meQueryRangeByMinMax

        /// <summary>
        /// Determines the appropriate measurement range by given limits
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device to be accessed.
        /// </param>
        /// <param name="unit">
        /// Restrict the query to the specified measurement range(s).
        /// <see cref="ME_UNIT_ANY"/>: Query for all ranges
        /// <see cref="ME_UNIT_VOLT"/>: Query only for voltage ranges
        /// <see cref="ME_UNIT_AMPERE"/>: Query only for current ranges
        /// </param>
        /// <param name="min">
        /// (in) Passing the lower limit of the searched range.
        /// (out) Returns the lower limit for the range determined.
        /// </param>
        /// <param name="max">
        /// (in) Passing the upper limit of the searched range.
        /// (out) Returns the upper limit for the range determined.
        /// </param>
        /// <param name="maxData">
        /// Returns the maximum resolution for the range determined (e. g. 65535 (0xFFFF) for 16 bit resolution).
        /// </param>
        /// <param name="rangeIndex">
        /// The index of the best fitting measurement range is returned.
        /// Always the smallest range is chosen, which includes the range limits searched for.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_UNIT"/>: unit's type not supported on sub-device.
        /// <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: lower limit is higher than upper.
        /// <see cref="ME_ERRNO_NO_RANGE"/>: fitted range not found.
        /// </returns>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meQueryNumberRanges"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryRangeByMinMax(int device, int subdevice, int unit, ref double min, ref double max, out int maxData, out int rangeIndex);

        #endregion

        #region meQueryRangeInfo

        /// <summary>
        /// Determines details of the specified measurement range.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device that is queried.
        /// </param>
        /// <param name="range">
        /// Index of measurement range that is queried.
        /// </param>
        /// <param name="unit">
        /// Pointer, which returns the physical unit of the specified measurement range.
        /// <see cref="ME_UNIT_INVALID"/>: Invalid return value
        /// <see cref="ME_UNIT_VOLT"/>: Voltage range
        /// <see cref="ME_UNIT_AMPERE"/>: Current range
        /// </param>
        /// <param name="min">
        /// Reference to the lower limit of the requested range.
        /// It applies to the physical unit specified in parameter <paramref name="unit"/>.
        /// </param>
        /// <param name="max">
        /// Reference to the upper limit of the requested range.
        /// It applies to the physical unit specified in parameter <paramref name="unit"/>.
        /// </param>
        /// <param name="maxData">
        /// Returns the maximum resolution of the measurement range (e. g. for 16 bit resolution the value 65535 (0xFFFF) is returned).
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// </returns>
        /// <seealso cref="meQueryNumberRanges"/>
        /// <seealso cref="meQueryRangeByMinMax"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryRangeInfo(int device, int subdevice, int range, out int unit, out double min, out double max, out int maxData);

        #endregion

        #region meQuerySubdeviceByType

        /// <summary>
        /// Determines the index of the first available sub-device which matches the features searching for.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="startSubdevice">
        /// Index of the sub-device the query starts with.
        /// </param>
        /// <param name="type">
        /// Type of the sub-device searched for:
        /// <see cref="ME_TYPE_AI"/> Analog acquisition
        /// <see cref="ME_TYPE_AO"/>: Analog output
        /// <see cref="ME_TYPE_DIO"/>: Digital input/output (bi-directional)
        /// <see cref="ME_TYPE_DO"/>: Digital output
        /// <see cref="ME_TYPE_DI"/>: Digital input
        /// <see cref="ME_TYPE_FIO"/>: Frequency input/output (bi-directional)
        /// <see cref="ME_TYPE_FO"/>: Frequency output
        /// <see cref="ME_TYPE_FI"/>: Frequency input
        /// <see cref="ME_TYPE_CTR"/>: Counter
        /// <see cref="ME_TYPE_EXT_IRQ"/>: External interrupt
        /// </param>
        /// <param name="subType">
        /// The capabilities of the sub-device searched for can be specified more detailed if necessary:
        /// <see cref="ME_SUBTYPE_ANY"/>: Sub-type doesn't matter.
        /// <see cref="ME_SUBTYPE_SINGLE"/>: Acquisition resp. output of a single value.
        /// <see cref="ME_SUBTYPE_STREAMING"/>: Continuous acquisition resp. output by using special hardware capabilities (e. g. FIFOs).
        /// <see cref="ME_SUBTYPE_CTR_8254"/>: Sub-device with a counter of type 8254
        /// </param>
        /// <param name="subdevice">
        /// Reference to the index of the first matching sub-device.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_NO_MORE_SUBDEVICE_TYPE"/>: Matching sub-device not found.
        /// </returns>
        /// <seealso cref="meQuerySubdeviceType"/>
        /// <seealso cref="meQuerySubdeviceCaps"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQuerySubdeviceByType(int device, int startSubdevice, int type, int subType, out int subdevice);

        #endregion

        #region meQuerySubdeviceType

        /// <summary>
        /// Determines the type and subtype of the specified sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device that is queried.
        /// </param>
        /// <param name="type">
        /// Reference to the sub-device type:
        /// <see cref="ME_TYPE_AO"/>: Analog output
        /// <see cref="ME_TYPE_AI"/> Analog input
        /// <see cref="ME_TYPE_DIO"/>: Digital input/output (bi-directional)
        /// <see cref="ME_TYPE_DO"/>: Digital output
        /// <see cref="ME_TYPE_DI"/>: Digital input
        /// <see cref="ME_TYPE_FIO"/>: Frequency input/output (bi-directional)
        /// <see cref="ME_TYPE_FO"/>: Frequency output
        /// <see cref="ME_TYPE_FI"/>: Frequency input
        /// <see cref="ME_TYPE_CTR"/>: Counter
        /// <see cref="ME_TYPE_EXT_IRQ"/>: External interrupt
        /// </param>
        /// <param name="subType">
        /// Returns the subtype of the sub-device:
        /// <see cref="ME_SUBTYPE_SINGLE"/>: Sub-device is able to acquire resp. output single values.
        /// <see cref="ME_SUBTYPE_STREAMING"/>: The sub-device can acquire values continuously resp. output a data stream.
        /// <see cref="ME_SUBTYPE_CTR_8254"/>: Sub-device with a counter of type 8254
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// </returns>
        /// <seealso cref="meQueryInfoDevice"/>
        /// <seealso cref="meQuerySubdeviceByType"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQuerySubdeviceType(int device, int subdevice, out int type, out int subType);

        #endregion

        #region meQuerySubdeviceCaps

        /// <summary>
        /// Determines the special capabilities of a sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device that is queried.
        /// </param>
        /// <param name="caps">
        /// Reference to a bit-coded integer value which returns the special capabilities of the specified sub-device.
        /// If several capabilities apply, the values are ORed bitwise.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// </returns>
        /// <seealso cref="meQuerySubdeviceCapsArgs"/>
        /// <seealso cref="meQuerySubdeviceType"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQuerySubdeviceCaps(int device, int subdevice, out int caps);

        #endregion

        #region meQuerySubdeviceCapsArgs

        /// <summary>
        /// Determines detailed information of a specific capability of a sub-device.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice">
        /// Index of the sub-device that is queried.
        /// </param>
        /// <param name="cap">
        /// The capability to be queried.
        /// </param>
        /// <param name="args">
        /// Reference to an array of type integer, which returns the queried values.
        /// </param>
        /// <param name="count">
        /// Number of values in parameter <paramref name="args"/>.
        /// As a rule "1", if the returned values fit into an integer.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_CAP"/>: Passed code is invalid or not supported on sub-device.
        /// <see cref="ME_ERRNO_INVALID_CAP_ARG_COUNT"/>: Parameter <paramref name="count"/> doesn't fit for queried capability code.
        /// </returns>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQuerySubdeviceCapsArgs(int device, int subdevice, int cap, ref int args, int count);

        #endregion

        #region meQueryVersionLibrary

        /// <summary>
        /// Determines the version number of the library.
        /// </summary>
        /// <param name="version">
        /// Reference to the version number of the library.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <remarks>
        /// Can be called before calling <see cref="meOpen"/>.
        /// </remarks>
        /// <seealso cref="meQueryVersionDeviceDriver"/>
        /// <seealso cref="meQueryVersionMainDriver"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryVersionLibrary(out int version);

        #endregion

        #region meQueryVersionMainDriver

        /// <summary>
        /// Determines the version number of the main driver.
        /// </summary>
        /// <param name="version">
        /// Reference to the version number of the main driver.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <remarks>
        /// The two higher significant bytes (main version, sub version) must be the same one as the
        /// version number of the device specific driver module (see <see cref="meQueryVersionDeviceDriver"/>).
        /// The lower significant bytes (build number) can differ.
        /// </remarks>
        /// <seealso cref="meQueryVersionDeviceDriver"/>
        /// <seealso cref="meQueryVersionLibrary"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryVersionMainDriver(out int version);

        #endregion

        #region meQueryVersionDeviceDriver

        /// <summary>
        /// Determines the version number of the device specific driver module.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="version">
        /// Reference to the version number of the main driver.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// </returns>
        /// <remarks>
        /// The version number must be the same one as the version number of the main driver
        /// (see <see cref="meQueryVersionMainDriver"/>).
        /// </remarks>
        /// <seealso cref="meQueryVersionLibrary"/>
        /// <seealso cref="meQueryVersionMainDriver"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meQueryVersionDeviceDriver(int device, out int version);

        #endregion

        #region meUtilityExtractValues

        /// <summary>
        /// Extracts the values of the specified channel from an array of values taking the channel-list into account.
        /// </summary>
        /// <param name="channel">
        /// Channel index whose values should be extracted.
        /// </param>
        /// <param name="dataBuffer">
        /// Reference to the data buffer allocated for the function <see cref="meIOStreamRead"/>.
        /// </param>
        /// <param name="dataCount">
        /// Number of measurement values in data buffer <paramref name="dataBuffer"/>.
        /// </param>
        /// <param name="configList">
        /// Pointer to the channel-list, which was passed to the function <see cref="meIOStreamConfig"/>.
        /// </param>
        /// <param name="configListCount">
        /// Number of channel-list entries in <paramref name="configList"/>.
        /// </param>
        /// <param name="chanBuffer">
        /// Pointer to an array with the extracted values of the specified channel.
        /// </param>
        /// <param name="chanBufferCount">
        /// (in) Passing the size of the array <paramref name="chanBuffer"/> in number of values.
        /// (out) The function returns the number values actually written to <paramref name="chanBuffer"/>.
        /// Feld <paramref name="chanBuffer"/> channBuffer kopiert.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <remarks>
        /// To extract the channels for several channels the function must be called separately.
        /// Note: If channel is not on list the function returns ME_ERRNO_SUCCESS
        /// and <paramref name="chanBufferCount"/> is set to "0".
        /// </remarks>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityExtractValues(int channel, ref int dataBuffer, int dataCount, ref meIOStreamConfig_t configList, int configListCount, ref int chanBuffer, ref int chanBufferCount);

        #endregion

        #region meUtilityDigitalToPhysical

        /// <summary>
        /// Conversion of the standardized digital values into the appropriate physical unit.
        /// </summary>
        /// <param name="min">
        /// The lower limit of the range e. g. -10[V].
        /// </param>
        /// <param name="max">
        /// The upper limit of the range e. g. +10[V].
        /// </param>
        /// <param name="maxData">
        /// The maximum resolution of the range e. g. 65536 at 16 bit resolution.
        /// </param>
        /// <param name="data">
        /// Digital value (0...65535) to be converted.
        /// </param>
        /// <param name="moduleType">
        /// Support for ME-MultiSig module.
        /// If for the current calculation no plug-on module must be taken into account,
        /// pass the constant: <see cref="ME_MODULE_TYPE_MULTISIG_NONE"/>
        /// No plug-on module used (standard)
        /// </param>
        /// <param name="refValue">
        /// For a RTD module or a thermo-couple module. Otherwise use: ME_VALUE_NOT_USED.
        /// </param>
        /// <param name="physical">
        /// Result in the corresponding physical unit [V], [A], [°C].
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than "0" or bigger than <paramref name="maxData"/>.
        /// <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        /// <see cref="ME_ERRNO_INVALID_MODULE_TYPE"/>: passed module type is not supported.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <remarks>
        /// If you read data from an input sub-device in streaming mode, you should
        /// apply the function <see cref="meUtilityExtractValues"/> to the array of values before
        /// calling this function. Only by that way it is guarenteed, that different gain
        /// factors and the usage of different plug-on modules in combination with the
        /// ME-MultiSig system can be taken into account when calculating.
        /// If you want to apply the function to a whole array of values we recommend
        /// the function <see cref="meUtilityDigitalToPhysicalV"/>.
        /// The parameters <paramref name="min"/> and <paramref name="max"/> must correspond with the limits of
        /// the measurement range choosen in the functions <see cref="meIOSingleConfig"/>
        /// resp. <see cref="meIOStreamConfig"/>.
        /// The parameters <paramref name="min"/>, <paramref name="max"/> and <paramref name="physical"/> must be given
        /// always in the same decimal power of the respective base unit (e. g. either "mV" or "V").
        /// The physical unit is not relevant for calculation.
        /// </remarks>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meUtilityExtractValues"/>
        /// <seealso cref="meUtilityDigitalToPhysicalV"/>
        /// <seealso cref="meIOSingleConfig"/>
        /// <seealso cref="meIOStreamConfig"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityDigitalToPhysical(double min, double max, int maxData, int data, int moduleType, double refValue, out double physical);

        #endregion

        #region meUtilityDigitalToPhysicalV

        /// <summary>
        /// Conversion of a whole array of standardized digital values into the appropriate physical unit.
        /// </summary>
        /// <param name="min">
        /// The lower limit of the range.
        /// </param>
        /// <param name="max">
        /// The upper limit of the range.
        /// </param>
        /// <param name="maxData">
        /// The maximum resolution of the range.
        /// </param>
        /// <param name="dataBuffer">
        /// Pointer to an array of digital values to be converted.
        /// </param>
        /// <param name="dataCount">
        /// Number of values in the array.
        /// </param>
        /// <param name="moduleType">
        /// Support for ME-MultiSig module.
        /// If for the current calculation no plug-on module must be taken into account,
        /// pass the constant: <see cref="ME_MODULE_TYPE_MULTISIG_NONE"/>
        /// No plug-on module used (standard)
        /// </param>
        /// <param name="refValue">
        /// For a RTD module or a thermo-couple module. Otherwise use: ME_VALUE_NOT_USED.
        /// </param>
        /// <param name="physicalBuffer">
        /// Pointer to an array for the results in the appropriate physical unit [V],
        /// [A], [°C]. Has to be able to store <paramref name="dataCount"/> values.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than "0" or bigger than <paramref name="maxData"/>.
        /// <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        /// <see cref="ME_ERRNO_INVALID_MODULE_TYPE"/>: passed module type is not supported.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meUtilityDigitalToPhysical"/>
        /// <seealso cref="meIOSingleConfig"/>
        /// <seealso cref="meIOStreamConfig"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityDigitalToPhysicalV(double min, double max, int maxData, ref int dataBuffer, int dataCount, int moduleType, double refValue, ref double physicalBuffer);

        #endregion

        #region meUtilityPhysicalToDigital

        /// <summary>
        /// Conversion of values to be output in standardized digital values which are appropriate for the converter.
        /// </summary>
        /// <param name="min">
        /// The lower limit of the range, e. g. -10[V].
        /// </param>
        /// <param name="max">
        /// The upper limit of the range, e. g. +10[V].
        /// </param>
        /// <param name="maxData">
        /// The maximum resolution of the range, e. g. 65536 at 16 bit resolution.
        /// </param>
        /// <param name="physical">
        /// Voltage or current value to be converted, e. g. +0.75[V].
        /// </param>
        /// <param name="data">
        /// Result as a digital value to be output.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than <paramref name="min"/> or bigger than <paramref name="max"/>.
        /// <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointer is NULL.
        /// </returns>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meUtilityPhysicalToDigitalV"/>
        /// <seealso cref="meUtilityDigitalToPhysical"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityPhysicalToDigital(double min, double max, int maxData, double physical, out int data);

        #endregion

        #region meUtilityPhysicalToDigitalV

        /// <summary>
        /// Conversion of a whole array of values to be output in standardized digital values.
        /// </summary>
        /// <param name="min">
        /// The lower limit of the range, e. g. -10[V].
        /// </param>
        /// <param name="max">
        /// The upper limit of the range, e. g. +10[V].
        /// </param>
        /// <param name="maxData">
        /// The maximum resolution of the range, e. g. 65536 at 16 bit resolution.
        /// </param>
        /// <param name="physicalBuffer">
        /// Pointer to an array with the voltage or current values to be converted.
        /// </param>
        /// <param name="physicalCount">
        /// Number of values in the array.
        /// </param>
        /// <param name="dataBuffer">
        /// Pointer to an array with the digital values to be output. Has to be able to store <paramref name="physicalCount"/> values.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_VALUE_OUT_OF_RANGE"/>: passed value is lower than <paramref name="min"/> or bigger than <paramref name="max"/>.
        /// <see cref="ME_ERRNO_INVALID_MIN_MAX"/>: passed <paramref name="maxData"/> is not valid.
        /// <see cref="ME_ERRNO_INVALID_POINTER"/>: passed pointers are NULL.
        /// </returns>
        /// <seealso cref="meQueryRangeInfo"/>
        /// <seealso cref="meUtilityPhysicalToDigital"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityPhysicalToDigitalV(double min, double max, int maxData, ref double physicalBuffer, int physicalCount, ref int dataBuffer);

        #endregion

        #region meUtilityPWMStart

        /// <summary>
        /// configures the counter device 8254 for the operation mode "pulse width modulation" and starts the operation.
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed.
        /// </param>
        /// <param name="subdevice1">
        /// Index of the sub-device counter 0 (used as prescaler).
        /// </param>
        /// <param name="subdevice2">
        /// Index of the sub-device counter 1.
        /// </param>
        /// <param name="subdevice3">
        /// Index of the sub-device counter 2.
        /// </param>
        /// <param name="reference">
        /// Defines the clock source for counter 0 (CLK_0)
        /// <see cref="ME_REF_CTR_INTERNAL_1MHZ"/>: Clock source is the internal 1 MHz crystal oszillator.
        /// <see cref="ME_REF_CTR_INTERNAL_10MHZ"/>: Clock source is the internal 10 MHz crystal oszillator.
        /// <see cref="ME_REF_CTR_EXTERNAL"/>: Clock source is an external oszillator.
        /// </param>
        /// <param name="prescaler">
        /// Value for the prescaler (counter 0) in the range 2...65535.
        /// </param>
        /// <param name="dutyCycle">
        /// TDuty cycle of the output signal from 1% –99% adjustable in steps of 1%.
        /// </param>
        /// <param name="flags">
        /// Flag for extended options:
        /// <see cref="ME_PWM_START_NO_FLAGS"/>: default settings
        /// <see cref="ME_PWM_START_CONNECT_INTERNAL"/>: If supported by hardware (e. g. ME-1400 series),
        /// connect OUT_1 with GATE_2 internally. This reduces the number of external connections.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_FLAGS"/>: not supported flag detected.
        /// <see cref="ME_ERRNO_INVALID_REF"/>: used signal source not available.
        /// <see cref="ME_ERRNO_INVALID_DUTY_CYCLE"/>: value outside of supported range.
        /// <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is not a counter or internal connection can not be done
        /// </returns>
        /// <remarks>
        /// A further usage of the counters 0...2 is not possible in this operation mode.
        /// The signal is available at OUT_2 of the specified counter device.
        /// Depending on device type the base clock (max. 10 MHz) must be provided externally
        /// or (if supported by the hardware) an on-board crystal oszillator can be used.
        /// Counter 0 is used as a prescaler. The frequency of the output signal is max. 50 kHz
        /// and can be calculated as follows:
        /// <code>fOut_2 = baseClock / prescaler * 100;  //with prescaler = 2Exp(16-1)</code>
        /// The duty cycle can be set between 1...99% in steps of 1%
        /// </remarks>
        /// <seealso cref="meUtilityPWMStop"/>
        /// <seealso cref="meUtilityPWMRestart"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityPWMStart(int device, int subdevice1, int subdevice2, int subdevice3, int reference, int prescaler, int dutyCycle, int flags);

        #endregion

        #region meUtilityPWMRestart

        /// <summary>
        /// Restarts a PWM operation stopped by the function <see cref="meUtilityPWMStop()"/>
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed
        /// </param>
        /// <param name="subdevice1">
        /// Index of the sub-device counter 0 used as prescaler
        /// </param>
        /// <param name="reference">
        /// Defines the clock source for counter 0 (CLK_0)
        /// <see cref="ME_REF_CTR_INTERNAL_1MHZ"/>: Clock source is the internal 1 MHz crystal oszillator.
        /// <see cref="ME_REF_CTR_INTERNAL_10MHZ"/>: Clock source is the internal 10 MHz crystal oszillator.
        /// <see cref="ME_REF_CTR_EXTERNAL"/>: Clock source is an external oszillator.
        /// </param>
        /// <param name="prescaler">
        /// Value for the prescaler (counter 0) in the range 2...65535.
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_REF"/>: used signal source not available.
        /// <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is no counter.
        /// </returns>
        /// <seealso cref="meUtilityPWMStop"/>
        /// <seealso cref="meUtilityPWMStart"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityPWMRestart(int device, int subdevice1, int reference, int prescaler);

        #endregion

        #region meUtilityPWMStop

        /// <summary>
        /// Stops a PWM operation started by the function <see cref="meUtilityPWMStart"/>
        /// </summary>
        /// <param name="device">
        /// Index of the device to be accessed
        /// </param>
        /// <param name="subdevice1">
        /// Index of the sub-device counter 0 used as prescaler
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_NOT_OPEN"/>: ME-iDS is not properly open.
        /// <see cref="ME_ERRNO_INVALID_DEVICE"/>: no device mapped to requested index.
        /// <see cref="ME_ERRNO_INVALID_SUBDEVICE"/>: on requested device no sub-device mapped to requested index.
        /// <see cref="ME_ERRNO_NOT_SUPPORTED"/>: used sub-device is no counter.
        /// </returns>
        /// <seealso cref="meUtilityPWMStart"/>
        /// <seealso cref="meUtilityPWMRestart"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int meUtilityPWMStop(int device, int subdevice1);

        #endregion

        #region mePropertyGetIntA

        /// <summary>
        /// Read an integer value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the integer value
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertyGetIntA is the ANSI character version of mePropertyGetIntW
        /// </remarks>
        /// <seealso cref="mePropertyGetIntW"/>
        /// <seealso cref="mePropertySetIntA"/>
        /// <seealso cref="mePropertySetIntW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertyGetIntA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, out int propertyValue);

        #endregion

        #region mePropertyGetIntW

        /// <summary>
        /// Read an integer value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the integer value
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertyGetIntW is the wide character version of mePropertyGetIntA
        /// </remarks>
        /// <seealso cref="mePropertyGetIntA"/>
        /// <seealso cref="mePropertySetIntA"/>
        /// <seealso cref="mePropertySetIntW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertyGetIntW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, out int propertyValue);

        #endregion

        #region mePropertyGetDoubleA

        /// <summary>
        /// Read a double value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the double value
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertyGetDoubleA is the ANSI character version of mePropertyGetDoubleW
        /// </remarks>
        /// <seealso cref="mePropertyGetDoubleW"/>
        /// <seealso cref="mePropertySetDoubleA"/>
        /// <seealso cref="mePropertySetDoubleW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertyGetDoubleA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, out double propertyValue);

        #endregion

        #region mePropertyGetDoubleW

        /// <summary>
        /// Read a double value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the double value
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertyGetDoubleW is the wide character version of mePropertyGetDoubleA
        /// </remarks>
        /// <seealso cref="mePropertyGetDoubleA"/>
        /// <seealso cref="mePropertySetDoubleA"/>
        /// <seealso cref="mePropertySetDoubleW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertyGetDoubleW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, out double propertyValue);

        #endregion

        #region mePropertyGetStringA

        /// <summary>
        /// Read a string value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the ANSI-string value
        /// </param>
        /// <param name="count">
        /// Buffer length in characters including the terminating null character
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL"/>: the buffer is not large enough to hold the string
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertyGetStringA is the ANSI character version of mePropertyGetStringW
        /// The required buffer length can be determined with the property attribute "Length"
        /// </remarks>
        /// <seealso cref="mePropertyGetStringW"/>
        /// <seealso cref="mePropertySetStringA"/>
        /// <seealso cref="mePropertySetStringW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertyGetStringA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, StringBuilder propertyValue, int count);

        #endregion

        #region mePropertyGetStringW

        /// <summary>
        /// Read a string value from the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// Variable that receives the UTF-16 Unicode-string value
        /// </param>
        /// <param name="count">
        /// Buffer length in characters, not bytes, including the terminating null character
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// <see cref="ME_ERRNO_PROPERTY_BUFFER_TOO_SMALL"/>: the buffer is not large enough to hold the string
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// The required buffer length can be determined with the property attribute "Length"
        /// mePropertyGetStringW is the wide character version of mePropertyGetStringA
        /// </remarks>
        /// <seealso cref="mePropertyGetStringA"/>
        /// <seealso cref="mePropertySetStringA"/>
        /// <seealso cref="mePropertySetStringW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertyGetStringW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, StringBuilder propertyValue, int count);

        #endregion

        #region mePropertySetIntA

        /// <summary>
        /// Set an integer value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// The integer value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetIntA is the ANSI character version of mePropertySetIntW
        /// </remarks>
        /// <seealso cref="mePropertySetIntW"/>
        /// <seealso cref="mePropertyGetIntA"/>
        /// <seealso cref="mePropertyGetIntW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertySetIntA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, int propertyValue);

        #endregion

        #region mePropertySetIntW

        /// <summary>
        /// Set an integer value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// The integer value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetIntW is the wide character version of mePropertySetIntA
        /// </remarks>
        /// <seealso cref="mePropertySetIntA"/>
        /// <seealso cref="mePropertyGetIntA"/>
        /// <seealso cref="mePropertyGetIntW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertySetIntW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, int propertyValue);

        #endregion

        #region mePropertySetDoubleA

        /// <summary>
        /// Set a double value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// The double value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetIntA is the ANSI character version of mePropertySetDoubleW
        /// </remarks>
        /// <seealso cref="mePropertySetDoubleW"/>
        /// <seealso cref="mePropertyGetDoubleA"/>
        /// <seealso cref="mePropertyGetDoubleW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertySetDoubleA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, double propertyValue);

        #endregion

        #region mePropertySetDoubleW

        /// <summary>
        /// Set a double value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// The double value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetDoubleW is the wide character version of mePropertySetDoubleA
        /// </remarks>
        /// <seealso cref="mePropertySetDoubleA"/>
        /// <seealso cref="mePropertyGetDoubleA"/>
        /// <seealso cref="mePropertyGetDoubleW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertySetDoubleW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, double propertyValue);

        #endregion

        #region mePropertySetStringA

        /// <summary>
        /// Set a string value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as ANSI-string
        /// </param>
        /// <param name="propertyValue">
        /// The ANSI-string value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetStringA is the ANSI character version of mePropertyGetStringW
        /// </remarks>
        /// <seealso cref="mePropertySetStringW"/>
        /// <seealso cref="mePropertyGetStringA"/>
        /// <seealso cref="mePropertyGetStringW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern int mePropertySetStringA([MarshalAs(UnmanagedType.LPStr)]String propertyPath, [MarshalAs(UnmanagedType.LPStr)]String propertyValue);

        #endregion

        #region mePropertySetStringW

        /// <summary>
        /// Set a string value of the given property
        /// </summary>
        /// <param name="propertyPath">
        /// Property path as UTF-16 Unicode-string
        /// </param>
        /// <param name="propertyValue">
        /// The UTF-16 Unicode-string value to be set
        /// </param>
        /// <returns>
        /// <see cref="ME_ERRNO_SUCCESS"/>: the function returned successfully.
        /// The return value is an error code if there is a failure.
        /// </returns>
        /// <remarks>
        /// mePropertySetStringW is the wide character version of mePropertySetStringA
        /// </remarks>
        /// <seealso cref="mePropertySetStringA"/>
        /// <seealso cref="mePropertyGetStringA"/>
        /// <seealso cref="mePropertyGetStringW"/>
        [DllImport("meIDSmain.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public static extern int mePropertySetStringW([MarshalAs(UnmanagedType.LPWStr)]String propertyPath, [MarshalAs(UnmanagedType.LPWStr)]String propertyValue);

        #endregion

    #endregion //MEiDSFunctions

    }
}
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Delphi Interface

  • ME-iDS API

Delphi Interface

  • Delphi Interface Types, Functions and Constants
  • Delphi Property Names
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Delphi Interface Types, Functions and Constants

  • ME-iDS API
  • Delphi Interface

Delphi Interface Types, Functions and Constants

//==============================================================================
//Copyright(c), Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : meIDS.pas
//Note        : import library for ME-iDS API 32bit: meIDSmain.dll
//              import library for ME-iDS API 64bit: meIDSmain64.dll
//Changes     : 2011-02-21 updated from metypes.h, medriver.h, medefines.h
//            : 2011-09-09 changed PChar to PAnsiChar
//            : 2012-04-04 new Property Get and Set functions,
//              new constants for property functions
//==============================================================================
unit meIDS;

interface

uses
    SysUtils;

const

{$IFDEF WIN32}
  MEIDSMAIN_DLL = 'meIDSmain.dll';               //import dll for ME-iDS API (32bit)
{$ENDIF}

{$IFDEF WIN64}
  MEIDSMAIN_DLL = 'meIDSmain64.dll';             //import dll for ME-iDS API (64bit)
{$ENDIF}

type
  //record of the single-config-list
  me_IOSingle = record                           //see Manual ME-iDS, Input/Output Functions, meIOSingle()
    iDevice: Integer;                            //Index of the device to be accessed
    iSubDevice: Integer;                         //Index of the sub-device to be accessed
    iChannel: Integer;                           //Channel index resp. index of the group
    iDir: Integer;                               //ME_DIR_INPUT, ME_DIR_OUTPUT, ME_DIR_SET_OFFSET
    iValue: Integer;                             //e.g. DIO: Read resp. output a 32 bit digital value. Depending on port width always the lower significant bits are relevant.
    iTimeOut: Integer;                           //Time-out value in milliseconds. If no external trigger is being used or no time-out value is used, pass 0
    iFlags: Integer;                             //Extended settings
    iErrno: Integer;                             //Error code returned by the particular entry
  end;
  TMeIOSingle = me_IOSingle;
  PMeIOSingle = ^TMeIOSingle;

  //record of the channel-list
  me_IOStreamConfig = record
    iChannel: Integer;                           //Channel index. Depending on sub-device this can be analog inputs or outputs as well as a group of digital I/Os
    iStreamConfig: Integer;                      //Index of analog input or analog output range; On bit pattern output pass ME_VALUE_NOT_USED
    iRef: Integer;                               //Defines the ground reference for analog inputs and outputs, ME_REF_NONE, ME_REF_AI_GROUND, ME_REF_AI_DIFFERENTIAL, ME_REF_AO_GROUND, ME_REF_AO_DIFFERENTIAL
    iFlags: Integer;                             //No extended options available, use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS
  end;
  TMeIOStreamConfig = me_IOStreamConfig;
  PMeIOStreamConfig = ^TMeIOStreamConfig;

  //trigger structure
  me_IOStreamTrigger = record
    iAcqStartTrigType: Integer;                  //defines the trigger type for start of the whole operation (ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_ANALOG, ME_TRIG_TYPE_THRESHOLD...)
    iAcqStartTrigEdge: Integer;                  //defines the trigger edge for start of a single conversion (ME_TRIG_EDGE_NONE, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING...)
    iAcqStartTrigChan: Integer;                  //choose whether triggering should be done separatly for each channel (standard) or if a channel should be started synchronously with other channels
    iAcqStartTicksLow: Integer;                  //Offset time in number of ticks between "start" of the measurement and the first conversion.
    iAcqStartTicksHigh: Integer;                 //Higher significant part of the offset time (bits 63 to 32)
    iAcqStartArgs: array [0..9] of Integer;      //List of Start Arguments (threshold value in [uV], slew rate in [uV/Sample], lower threshold value of the window in [uV])
    iScanStartTrigType: Integer;                 //defines the trigger type for start of a scan (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_FOLLOW, ME_TRIG_TYPE_EXT_DIGITAL...)
    iScanStartTicksLow: Integer;                 //Time interval in ticks between the start of two consecutive scans
    iScanStartTicksHigh: Integer;                //Higher significant part of the scan-time (bits 63 to 32)
    iScanStartArgs: array [0..9] of Integer;     //reserved
    iConvStartTrigType: Integer;                 //defines the trigger type for start of a single conversion (ME_TRIG_TYPE_TIMER, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_EXT_ANALOG)
    iConvStartTicksLow: Integer;                 //Chan interval in number of ticks between two conversions (Sample resp. output rate)
    iConvStartTicksHigh: Integer;                //Higher significant part of the chan interval (bits 63 to 32)
    iConvStartArgs: array [0..9] of Integer;     //reserved
    iScanStopTrigType: Integer;                  //defines the trigger type for ending the scan (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT)
    iScanStopCount: Integer;                     //Total number of conversions after which the scans will be ended and at the same time the measurement as a whole.
    iScanStopArgs: array [0..9] of Integer;      //MEphisto Scope in oscilloscope mode: trigger point in percent between 0% to 100%,
    iAcqStopTrigType: Integer;                   //defines the trigger type for ending the whole operation (ME_TRIG_TYPE_NONE, ME_TRIG_TYPE_COUNT, ME_TRIG_TYPE_FOLLOW)
    iAcqStopCount: Integer;                      //Number of scans (channel-list processings) after which the complete operation should be ended
    iAcqStopArgs: array [0..9] of Integer;       //reserved
    iFlags: Integer;                             //ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS (default) (no flags available)
  End;
  TMeIOStreamTrigger = me_IOStreamTrigger;
  PMeIOStreamTrigger = ^TMeIOStreamTrigger;

  me_IOStreamStart = record                      //StartList, defines by which streaming operations can be started
    iDevice: Integer;                            //Index of the device to be accessed
    iSubDevice: Integer;                         //Index of the sub-device to be accessed
    iStartMode: Integer;                         //ME_START_MODE_BLOCKING (waits until the proper trigger signal occurs), ME_START_MODE_NONBLOCKING (Function returns immediately)
    iTimeOut: Integer;                           //time interval in milliseconds within the first trigger pulse must occur
    iFlags: Integer;                             //ME_IO_STREAM_START_TYPE_NO_FLAGS, ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for Synchronous start
    iErrno: Integer;                             //If an error occurs, an error code will be set
  end;
  TMeIOStreamStart = me_IOStreamStart;
  PMeIOStreamStart = ^TMeIOStreamStart;

  me_IOStreamStop = record                       //StopList, defines end of input/output operations
    iDevice: Integer;                            //Index of the device to be accessed
    iSubDevice: Integer;                         //Index of the sub-device to be accessed
    iStopMode: Integer;                          //ME_STOP_MODE_IMMEDIATE stopped at once, ME_STOP_MODE_LAST_VALUE
    iFlags: Integer;                             //ME_IO_STREAM_STOP_TYPE_NO_FLAGS, ME_IO_STREAM_STOP_TYPE_PRESERVE_BUFFERS (Linux only)
    iErrno: Integer;                             //If an error occurs, an error code will be set
  end;
  TMeIOStreamStop = me_IOStreamStop;
  PMeIOStreamStop = ^TMeIOStreamStop;

    // Typedef for general API error procedure - used in meErrorSetUserProc
  meErrorCB_t = function(pcFunctionName: PAnsiChar; iErrorCode: Integer): Integer; stdcall;

    // Typedef for streaming callback function - used in meIOStreamSetCallbacks
  meIOStreamCB_t = function(iDevice: Integer; iSubdevice: Integer; iCount: Integer;
                                pvContext: Pointer; iErrorCode: Integer): Integer; stdcall;

    // Typedef for IRQ callback function - used in meIOIrqSetCallback
  meIOIrqCB_t = function(iDevice: Integer; iSubdevice: Integer; iChannel: Integer; iIrqCount: Integer;
                      iValue: Integer; pvContext: Pointer; iErrorCode: Integer): Integer; stdcall;

//------------------------------------------------------------------------------
//
// me-iDS API Functions
//
//------------------------------------------------------------------------------

//==============================================================================
//  Functions to access the driver system
//==============================================================================
function meOpen(iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meClose(iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meLockDriver(iLock: Integer; iFlags: Integer):Integer; cdecl; external MEIDSMAIN_DLL;

function meLockDevice(iDevice: Integer; iLock: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meLockSubdevice(iDevice: Integer; iSubDevice: Integer; iLock: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
//  Error handling functions
//==============================================================================
function meErrorGetLast(var piErrorCode: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meErrorGetLastMessage(pcErrorMsg: PAnsiChar; iCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meErrorGetMessage(iErrorCode: Integer; pcErrorMsg: PAnsiChar; iCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meErrorSetDefaultProc(iSwitch: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meErrorSetUserProc(pErrorProc: meErrorCB_t): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
// Functions to perform I/O on a device
//==============================================================================
function meIOIrqSetCallback(iDevice: Integer; iSubDevice: Integer; pCallback: meIOIrqCB_t; pCallbackContext: Pointer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOIrqStart(iDevice: Integer; iSubDevice: Integer; iChannel: Integer; iIrqSources: Integer; iIrqEdge : Integer; iIrqArg : Integer; iFlags : Integer):  Integer; cdecl; external MEIDSMAIN_DLL;

function meIOIrqStop(iDevice: Integer; iSubDevice: Integer; iChannel: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOIrqWait(iDevice: Integer; iSubDevice: Integer ;iChannel: Integer; var piIrqCount: Integer; var piValue: Integer; iTimeOut: Integer; iFlags: Integer ): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOResetDevice(iDevice: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOResetSubdevice(iDevice: Integer; iSubDevice: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamFrequencyToTicks(iDevice: Integer; iSubDevice: Integer; iTimer: Integer; var pdFrequency: Double; var piTicksLow: Integer; var piTicksHigh: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOSetChannelOffset(iDevice: Integer; iSubdevice: Integer; iChannel: Integer; iRange: Integer; var pdOffset: Double; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOSingleConfig(iDevice: Integer; iSubDevice: Integer; iChannel: Integer; iSingleconfig: Integer; iRef: Integer; iTrigChan: Integer; iTrigtype: Integer; iTrigedge: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOSingle(var pSingleList: TMeIOSingle; iCount: Integer; iFlag: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//meIOSingleTimeToTicks new in v1.3.7.0
function meIOSingleTimeToTicks(iDevice: Integer; iSubDevice: Integer; iTimer: Integer; var pdTime: Double; var piTicksLow: Integer; var piTicksHigh: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//meIOSingleTicksToTime new in v1.3.7.0
function meIOSingleTicksToTime(iDevice: Integer; iSubDevice: Integer; iTimer: Integer; iTicksLow: Integer; iTicksHigh: Integer; var pdTime: Double; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamConfig(iDevice: Integer; iSubDevice: Integer; var pConfigList: TMeIOStreamConfig; iCount: Integer; var pTrigger: TMeIOStreamTrigger; iFifoIrqThreshold: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamRead(iDevice: Integer; iSubDevice: Integer; lReadMode: Integer; var piValues: Integer; var plCount: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamWrite(iDevice: Integer; iSubDevice: Integer; lWriteMode: Integer; var piValues: Integer; var plCount: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamStart(var pStartList: TMeIOStreamStart; iCount: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamStop(var pStopList: TMeIOStreamStop; iCount: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamStatus(iDevice: Integer; iSubDevice: Integer; lWait: Integer; var plStatus: Integer; var plCount: Integer; iFlags: Integer ): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamSetCallbacks(iDevice: Integer; iSubDevice: Integer; pStartCB: meIOStreamCB_t; pStartCBContext: Pointer; pNewValuesCB: meIOStreamCB_t; pNewValuesCBContext: Pointer; pEndCB: meIOStreamCB_t; pEndCBContext: Pointer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meIOStreamTimeToTicks(iDevice: Integer; iSubDevice: Integer; iTimer: Integer; var pdTime: Double; var piTicksLow: Integer; var piTicksHigh: Integer; iFlags: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
//  Functions to query the driver system
//==============================================================================
function meQueryDescriptionDevice(iDevice: Integer; pcDescription: PAnsiChar; iCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryInfoDevice(iDevice: Integer; var piVendorId: Integer; var piDeviceId: Integer; var piSerialNo: Integer; var piBusType: Integer; var piBusNo: Integer; var plDevNo: Integer; var plFuncNo: Integer; var plPlugged: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryNameDevice(iDevice: Integer; pcName: PAnsiChar; iCount: Integer): Integer overload; cdecl; external MEIDSMAIN_DLL;

function meQueryNameDeviceDriver(iDevice: Integer; pcName: PAnsiChar; iCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryNumberDevices(var piNumber: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryNumberSubdevices(iDevice: Integer; var piNumber: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryNumberChannels(iDevice: Integer; iSubDevice: Integer; var piNumber: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryNumberRanges(iDevice: Integer; iSubDevice: Integer; lUnit: Integer; var piNumber: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryRangeByMinMax(iDevice: Integer; iSubDevice: Integer; lUnit: Integer; var pdMin: Double; var pdMax: Double; var piMaxData: Integer; var piRange: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryRangeInfo(iDevice: Integer; iSubDevice: Integer; lRange: Integer; var piUnit: Integer; var pdMin: Double; var pdMax: Double; var piMaxData: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQuerySubdeviceByType(iDevice: Integer; iStartSubdevice: Integer; iType: Integer; lSubtype: Integer; var piSubdevice: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQuerySubdeviceType(iDevice: Integer; iSubDevice: Integer; var piType: Integer; var piSubtype: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQuerySubdeviceCaps(iDevice: Integer; iSubDevice: Integer; var piCaps: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQuerySubdeviceCapsArgs(iDevice: Integer; iSubDevice: Integer; iCap: Integer; piArgs: PInteger; iCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryVersionLibrary(var piVersion: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryVersionMainDriver(var piVersion: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meQueryVersionDeviceDriver(iDevice: Integer; var piVersion: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
//  Common utility functions
//==============================================================================
function meUtilityExtractValues(iChannel: Integer; var piAIBuffer: Integer; lAIBufferCount: Integer; var pConfigList: TMeIOStreamConfig; iConfigListCount: Integer; var piChanBuffer: Integer; var plChanBufferCount: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityDigitalToPhysical(dMin: Double; dMax: Double; iMaxData: Integer; iData: Integer; iModuleType: Integer; dRefValue: Double; var pdPhysical: Double): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityDigitalToPhysicalV(dMin: Double; dMax: Double; iMaxData: Integer; var piDataBuffer: Integer; iCount: Integer; iModuleType: Integer; drefValue: Double; var pdPhysicalBuffer: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityPhysicalToDigital(dMin: Double; dMax: Double; iMaxData: Integer; dPhysical: Double; var piData: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityPhysicalToDigitalV(dMin: Double; dMax: Double; iMaxData: Integer; var pdPhysicalBuffer: Double; iCount: Integer; var piDataBuffer: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityPWMStart(iDevice: Integer; iSubdevice1: Integer; iSubdevice2: Integer; iSubdevice3: Integer; iRef: Integer; iPrescaler: Integer; iDutyCycle: Integer; iFlag: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//meUtilityPWMRestart new in v2.0
function meUtilityPWMRestart(iDevice: Integer; iSubDevice1: Integer; iRef: Integer; iPrescaler: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

function meUtilityPWMStop(iDevice: Integer; iSubDevice: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
//  Property Get and Set functions
//==============================================================================

//mePropertyGetIntA, mePropertyGetIntW new in v2.0
function mePropertyGetIntA(pcPropertyPath: PAnsiChar; var piPropertyValue: Integer): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertyGetIntW(pcPropertyPath: PWideChar; var piPropertyValue: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//mePropertyGetDoubleA, mePropertyGetDoubleW new in v2.0
function mePropertyGetDoubleA(pcPropertyPath: PAnsiChar; var pdPropertyValue: Double): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertyGetDoubleW(pcPropertyPath: PWideChar; var pdPropertyValue: Double): Integer; cdecl; external MEIDSMAIN_DLL;

//mePropertyGetStringA, mePropertyGetStringW new in v2.0
function mePropertyGetStringA(pcPropertyPath: PAnsiChar; pcPropertyValue: PAnsiChar; iBufferLength: Integer): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertyGetStringW(pcPropertyPath: PWideChar; pcPropertyValue: PWideChar; iBufferLength: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//mePropertySetIntA, mePropertySetIntW new in v2.0
function mePropertySetIntA(pcPropertyPath: PAnsiChar; iPropertyValue: Integer): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertySetIntW(pcPropertyPath: PWideChar; iPropertyValue: Integer): Integer; cdecl; external MEIDSMAIN_DLL;

//mePropertySetDoubleA, mePropertySetDoubleW new in v2.0
function mePropertySetDoubleA(pcPropertyPath: PAnsiChar; dPropertyValue: Double): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertySetDoubleW(pcPropertyPath: PWideChar; dPropertyValue: Double): Integer; cdecl; external MEIDSMAIN_DLL;

//mePropertySetStringA, mePropertySetStringW new in v2.0
function mePropertySetStringA(pcPropertyPath: PAnsiChar; pcPropertyValue: PAnsiChar): Integer; cdecl; external MEIDSMAIN_DLL;
function mePropertySetStringW(pcPropertyPath: PWideChar; pcPropertyValue: PWideChar): Integer; cdecl; external MEIDSMAIN_DLL;

//==============================================================================
//  System constants
//==============================================================================
const

//==================================================================
//  General
//==================================================================
    ME_VALUE_NOT_USED = $0;
    ME_VALUE_DEFAULT = $0;
    ME_NO_FLAGS = $0;

    ME_VALUE_INVALID = -1;
//==================================================================
//Defines common to access functions
//================================================================
    ME_LOCK_RELEASE = $10001;
    ME_LOCK_SET = $10002;
    ME_LOCK_CHECK = $10003;

//==================================================================
//  Defines meOpen function
//==================================================================
    ME_OPEN_NO_FLAGS = $0;

//==================================================================
//  Defines meClose function
//==================================================================
    ME_CLOSE_NO_FLAGS = $0;

//==================================================================
//  Defines meLockDriver function
//==================================================================
    ME_LOCK_DRIVER_NO_FLAGS = $0;

//==================================================================
//  Defines meLockDevice function
//==================================================================
    ME_LOCK_DEVICE_NO_FLAGS = $0;

//==================================================================
//  Defines meLockSubdevice function
//==================================================================
    ME_LOCK_SUBDEVICE_NO_FLAGS = $0;

//==================================================================
//  Defines common to error functions
//==================================================================
    ME_ERROR_MSG_MAX_COUNT = 256;
    ME_SWITCH_DISABLE = $20001;
    ME_SWITCH_ENABLE = $20002;

//==================================================================
//  Defines for meErrorGetLast function
//==================================================================
    ME_ERROR_GET_LAST_NO_FLAGS = $0;
    ME_ERROR_GET_LAST_CLEAR = $1;

//==================================================================
//  Defines common to IO functions
//==================================================================
    ME_REF_NONE =   $0;
    ME_REF_DIO_FIFO_LOW = $30001;
    ME_REF_DIO_FIFO_HIGH = $30002;

    ME_REF_CTR_PREVIOUS = $40001;
    ME_REF_CTR_INTERNAL_1MHZ = $40002;
    ME_REF_CTR_INTERNAL_10MHZ = $40003;
    ME_REF_CTR_EXTERNAL = $40004;

    ME_REF_AI_GROUND = $50001;
    ME_REF_AI_DIFFERENTIAL = $50002;

    ME_REF_AO_GROUND = $60001;
    ME_REF_AO_DIFFERENTIAL = $60002;

    ME_TRIG_CHAN_NONE = ME_VALUE_NOT_USED;
    ME_TRIG_CHAN_DEFAULT = $70001;
    ME_TRIG_CHAN_SYNCHRONOUS = $70002;

    ME_TRIG_TYPE_NONE = ME_VALUE_NOT_USED;
    ME_TRIG_TYPE_SW = $80001;
    ME_TRIG_TYPE_THRESHOLD = $80002;
    ME_TRIG_TYPE_WINDOW = $80003;
    ME_TRIG_TYPE_EDGE = $80004;
    ME_TRIG_TYPE_SLOPE = $80005;
    ME_TRIG_TYPE_EXT_DIGITAL = $80006;
    ME_TRIG_TYPE_EXT_ANALOG = $80007;
    ME_TRIG_TYPE_PATTERN = $80008;          //These two defines are the same
    ME_TRIG_TYPE_PATTERN_MATCH = $00080008; //to preserve compatibility
    ME_TRIG_TYPE_TIMER = $80009;
    ME_TRIG_TYPE_COUNT = $8000A;
    ME_TRIG_TYPE_FOLLOW = $8000B;
    ME_TRIG_TYPE_PATTERN_NO_MATCH = $0008000C;
    ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT = $0008000D;
    ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT = $0008000E;
    ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT = $0008000F;

    ME_TRIG_EDGE_NONE = ME_VALUE_NOT_USED;
    ME_TRIG_EDGE_ABOVE = $90001;
    ME_TRIG_EDGE_BELOW = $90002;
    ME_TRIG_EDGE_ENTRY = $90003;
    ME_TRIG_EDGE_EXIT = $90004;
    ME_TRIG_EDGE_RISING = $90005;
    ME_TRIG_EDGE_FALLING = $90006;
    ME_TRIG_EDGE_ANY = $90007;

    ME_TIMER_ACQ_START = $A0001;
    ME_TIMER_SCAN_START = $A0002;
    ME_TIMER_CONV_START = $A0003;
    ME_TIMER_FIO_TOTAL = $A0004;
    ME_TIMER_FIO_FIRST_PHASE = $A0005;

//==================================================================
//  Defines for meIOFrequencyToTicks function
//==================================================================
    ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS = $0;
    ME_IO_STREAM_FREQUENCY_TO_TICKS_NO_FLAGS = ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS;
    ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE  = $1;

//==================================================================
//  Defines for meIOIrqStart function
//==================================================================
    ME_IRQ_SOURCE_DIO_PATTERN = $B0001;
    ME_IRQ_SOURCE_DIO_MASK = $B0002;
    ME_IRQ_SOURCE_DIO_LINE = $B0003;
    ME_IRQ_SOURCE_DIO_OVER_TEMP = $B0004;         //temperature changing from cool -> hot
    //ME_IRQ_SOURCE_DIO_NORMAL_TEMP = $B0005;       //temperature changing from hot -> cool
    ME_IRQ_SOURCE_DIO_CHANGE_TEMP = $B0006;       //temperature changing both, from cool -> hot and hot -> cool

    ME_IRQ_EDGE_NOT_USED = ME_VALUE_NOT_USED;
    ME_IRQ_EDGE_RISING = $C0001;
    ME_IRQ_EDGE_FALLING = $C0002;
    ME_IRQ_EDGE_ANY = $C0003;

    ME_IO_IRQ_START_NO_FLAGS = $0;
    ME_IO_IRQ_START_DIO_BIT = $1;
    ME_IO_IRQ_START_DIO_BYTE = $2;
    ME_IO_IRQ_START_DIO_WORD = $4;
    ME_IO_IRQ_START_DIO_DWORD = $8;
    ME_IO_IRQ_START_PATTERN_FILTERING = $00000010;
    ME_IO_IRQ_START_EXTENDED_STATUS = $00000020;
    ME_IO_IRQ_START_USE_PROPERTIES = $40000000;

//==================================================================
//  Defines for meIOIrqWait function
//==================================================================
    ME_IO_IRQ_WAIT_NO_FLAGS = $0;
    ME_IO_IRQ_WAIT_NORMAL_STATUS = $00000001;
    ME_IO_IRQ_WAIT_EXTENDED_STATUS = $00000002;

//==================================================================
//  Defines for meIOIrqStop function
//==================================================================
    ME_IO_IRQ_STOP_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOIrqSetCallback function
//==================================================================
    ME_IO_IRQ_SET_CALLBACK_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOResetDevice function
//==================================================================
    ME_IO_RESET_DEVICE_NO_FLAGS = $0;
    ME_IO_RESET_SUBDEVICE_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOSetChannelOffset function
//==================================================================
    ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOSingleConfig function
//==================================================================
//Definitions for digital subdevice.
    ME_SINGLE_CONFIG_DIO_INPUT = $D0001;
    ME_SINGLE_CONFIG_DIO_OUTPUT = $D0002;
    ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE = $D0003;
    ME_SINGLE_CONFIG_DIO_SINK = $D0004;
    ME_SINGLE_CONFIG_DIO_SOURCE = $D0005;
    ME_SINGLE_CONFIG_DIO_MUX32M = $D0006;
    ME_SINGLE_CONFIG_DIO_DEMUX32 = $D0007;
    ME_SINGLE_CONFIG_DIO_BIT_PATTERN = $D0008;

//Definitions for frequency subdevice.
    ME_SINGLE_CONFIG_FIO_INPUT = $1E0001;
    ME_SINGLE_CONFIG_FIO_OUTPUT = $1E0002;
    ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE = $001E0002;
    ME_SINGLE_CONFIG_FIO_SINK = $001E0003;
    ME_SINGLE_CONFIG_FIO_SOURCE = $001E0004;

//Definitions for counter 8254 subdevice
    ME_SINGLE_CONFIG_CTR_8254_MODE_0 = $E0001;
    ME_SINGLE_CONFIG_CTR_8254_MODE_1 = $E0002;
    ME_SINGLE_CONFIG_CTR_8254_MODE_2 = $E0003;
    ME_SINGLE_CONFIG_CTR_8254_MODE_3 = $E0004;
    ME_SINGLE_CONFIG_CTR_8254_MODE_4 = $E0005;
    ME_SINGLE_CONFIG_CTR_8254_MODE_5 = $E0006;

    ME_IO_SINGLE_CONFIG_NO_FLAGS = $0;
    ME_IO_SINGLE_CONFIG_DIO_BIT = $1;
    ME_IO_SINGLE_CONFIG_DIO_BYTE = $2;
    ME_IO_SINGLE_CONFIG_DIO_WORD = $4;
    ME_IO_SINGLE_CONFIG_DIO_DWORD = $8;
    ME_IO_SINGLE_CONFIG_MULTISIG_LED_ON = $10;
    ME_IO_SINGLE_CONFIG_MULTISIG_LED_OFF = $20;
    ME_IO_SINGLE_CONFIG_AI_RMS = $40;

//==================================================================
//  Defines for meIOSingle function
//==================================================================
    ME_IO_SINGLE_NO_FLAGS = $0;

    ME_DIR_INPUT = $F0001;
    ME_DIR_OUTPUT = $F0002;
    ME_DIR_SET_OFFSET = $F0003;

    ME_IO_SINGLE_TYPE_NO_FLAGS = $0;
    ME_IO_SINGLE_TYPE_DIO_BIT = $1;
    ME_IO_SINGLE_TYPE_DIO_BYTE = $2;
    ME_IO_SINGLE_TYPE_DIO_WORD = $4;
    ME_IO_SINGLE_TYPE_DIO_DWORD = $8;
    ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS = $10;
    ME_IO_SINGLE_TYPE_NONBLOCKING = $20;
    ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING = ME_IO_SINGLE_TYPE_NONBLOCKING;
    ME_IO_SINGLE_TYPE_READ_NONBLOCKING = ME_IO_SINGLE_TYPE_NONBLOCKING;

    ME_IO_SINGLE_TYPE_FIO_DIVIDER = $40;
    ME_IO_SINGLE_TYPE_FO_START_LOW = $80;
    ME_IO_SINGLE_TYPE_FO_START_SOFT = $100;
    ME_IO_SINGLE_TYPE_FI_LAST_VALUE = $200;
    ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY = $200;
    ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL = $400;
    ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE = $800;
    ME_IO_SINGLE_TYPE_FO_USE_PROPERTIES = $40000000;

//==================================================================
//  Defines for meIOSingleTimeToTicks function
//==================================================================
    ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOSingleTicksToTime function
//==================================================================
    ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOStreamConfig function
//==================================================================
    ME_IO_STREAM_CONFIG_NO_FLAGS = $0;
    ME_IO_STREAM_CONFIG_BIT_PATTERN = $1;
    ME_IO_STREAM_CONFIG_WRAPAROUND = $2;
    ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD = $4;
    ME_IO_STREAM_CONFIG_INTERNAL_COUNTER = Integer($80000000);
    ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS = $0;

    ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOStreamRead function
//==================================================================
    ME_READ_MODE_BLOCKING = $100001;
    ME_READ_MODE_NONBLOCKING = $100002;

    ME_IO_STREAM_READ_NO_FLAGS = $0;
    ME_IO_STREAM_READ_FRAMES = $1;

//==================================================================
//  Defines for meIOStreamWrite function
//==================================================================
    ME_WRITE_MODE_BLOCKING = $110001;
    ME_WRITE_MODE_NONBLOCKING = $110002;
    ME_WRITE_MODE_PRELOAD = $110003;

    ME_IO_STREAM_WRITE_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOStreamStart function
//==================================================================
    ME_IO_STREAM_START_NO_FLAGS = $0;
    ME_IO_STREAM_START_NONBLOCKING = $20;

    ME_START_MODE_BLOCKING = $120001;
    ME_START_MODE_NONBLOCKING = $120002;

    ME_IO_STREAM_START_TYPE_NO_FLAGS = $0;
    ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS = $1;

//==================================================================
//  Defines for meIOStreamStop function
//==================================================================
    ME_IO_STREAM_STOP_NO_FLAGS = $0;
    ME_IO_STREAM_STOP_NONBLOCKING = $20;

    ME_STOP_MODE_IMMEDIATE = $130001;
    ME_STOP_MODE_LAST_VALUE = $130002;

    ME_IO_STREAM_STOP_TYPE_NO_FLAGS = $0;

//==================================================================
//Defines for meIOStreamStatus function
//==================================================================
    ME_WAIT_NONE = $140001;
    ME_WAIT_IDLE = $140002;
    ME_WAIT_BUSY = $140003;

    ME_STATUS_INVALID = $0;
    ME_STATUS_IDLE = $150001;
    ME_STATUS_BUSY = $150002;
    ME_STATUS_ERROR = $150003;

    ME_IO_STREAM_STATUS_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOStreamSetCallbacks function
//==================================================================
    ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS = $0;

//==================================================================
//  Defines for meIOStreamTimeToTicks function
//==================================================================
    ME_IO_TIME_TO_TICKS_NO_FLAGS = $0;
    ME_IO_STREAM_TIME_TO_TICKS_NO_FLAGS = ME_IO_TIME_TO_TICKS_NO_FLAGS;
    ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE = $1;

//==================================================================
//  Defines for module types
//==================================================================
    ME_MODULE_TYPE_MULTISIG_NONE = $0;
    ME_MODULE_TYPE_MULTISIG_DIFF16_10V = $160001;
    ME_MODULE_TYPE_MULTISIG_DIFF16_20V = $160002;
    ME_MODULE_TYPE_MULTISIG_DIFF16_50V = $160003;
    ME_MODULE_TYPE_MULTISIG_CURRENT16_0_20MA = $160004;
    ME_MODULE_TYPE_MULTISIG_RTD8_PT100 = $160005;
    ME_MODULE_TYPE_MULTISIG_RTD8_PT500 = $160006;
    ME_MODULE_TYPE_MULTISIG_RTD8_PT1000 = $160007;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_B = $160008;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_E = $160009;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_J = $16000A;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_K = $16000B;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_N = $16000C;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_R = $16000D;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_S = $16000E;
    ME_MODULE_TYPE_MULTISIG_TE8_TYPE_T = $16000F;
    ME_MODULE_TYPE_MULTISIG_TE8_TEMP_SENSOR = $160010;

//==================================================================
//  Defines for meQuerySubdeviceCaps function
//==================================================================
    ME_CAPS_DIO_DIR_BIT = $1;
    ME_CAPS_DIO_DIR_BYTE = $2;
    ME_CAPS_DIO_DIR_WORD = $4;
    ME_CAPS_DIO_DIR_DWORD = $8;
    ME_CAPS_DIO_SINK_SOURCE = $10;
    ME_CAPS_DIO_BIT_PATTERN_IRQ = $20;
    ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING = $40;
    ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING = $80;
    ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY = $100;
    ME_CAPS_DIO_OVER_TEMP_IRQ = $200;
    ME_CAPS_DIO_NORMAL_TEMP_IRQ = $400;

    ME_CAPS_CTR_CLK_PREVIOUS = $1;
    ME_CAPS_CTR_CLK_INTERNAL_1MHZ = $2;
    ME_CAPS_CTR_CLK_INTERNAL_10MHZ = $4;
    ME_CAPS_CTR_CLK_EXTERNAL = $8;

    ME_CAPS_AI_TRIG_SIMULTANEOUS = $1;
    ME_CAPS_AI_FIFO = $2;
    ME_CAPS_AI_FIFO_THRESHOLD = $4;
    ME_CAPS_AI_SAMPLE_HOLD = $8;

    ME_CAPS_AO_TRIG_SIMULTANEOUS = $1;
    ME_CAPS_AO_FIFO = $2;
    ME_CAPS_AO_FIFO_THRESHOLD = $4;

    ME_CAPS_FIO_SINK_SOURCE = $10;

    ME_CAPS_EXT_IRQ_EDGE_RISING = $1;
    ME_CAPS_EXT_IRQ_EDGE_FALLING = $2;
    ME_CAPS_EXT_IRQ_EDGE_ANY = $4;

//==================================================================
//  Defines for meQuerySubdeviceCapsArgs function
//==================================================================

    ME_CAP_AI_FIFO_SIZE                     = $001D0000;
    ME_CAP_AI_BUFFER_SIZE                   = $001D0001;
    ME_CAP_AI_CHANNEL_LIST_SIZE             = $001D0002;
    ME_CAP_AI_MAX_THRESHOLD_SIZE            = $001D0003;

    ME_CAP_AO_FIFO_SIZE                     = $001F0000;
    ME_CAP_AO_BUFFER_SIZE                   = $001F0001;
    ME_CAP_AO_CHANNEL_LIST_SIZE             = $001F0002;
    ME_CAP_AO_MAX_THRESHOLD_SIZE            = $001F0003;

    ME_CAP_CTR_WIDTH                        = $00200000;

    ME_CAP_FPGA_IN_FIFO_SIZE                = $00300000;
    ME_CAP_FPGA_IN_BUFFER_SIZE              = $00300001;
    ME_CAP_FPGA_OUT_FIFO_SIZE               = $00300002;
    ME_CAP_FPGA_OUT_BUFFER_SIZE             = $00300003;

//==================================================================
//  Defines common to query functions
//==================================================================

    ME_UNIT_INVALID = $0;
    ME_UNIT_VOLT = $170001;
    ME_UNIT_AMPERE = $170002;
    ME_UNIT_ANY = $170003;
    ME_UNIT_HZ = $170004;

    ME_TYPE_INVALID = $0;
    ME_TYPE_AO = $180001;
    ME_TYPE_AI = $180002;
    ME_TYPE_DIO = $180003;
    ME_TYPE_DO = $180004;
    ME_TYPE_DI = $180005;
    ME_TYPE_CTR = $180006;
    ME_TYPE_EXT_IRQ = $180007;
    ME_TYPE_FIO =   $180008;
    ME_TYPE_FO = $180009;
    ME_TYPE_FI = $18000A;
    ME_TYPE_FPGA = $18000B;

    ME_SUBTYPE_INVALID = $0;
    ME_SUBTYPE_SINGLE = $190001;
    ME_SUBTYPE_STREAMING = $190002;
    ME_SUBTYPE_CTR_8254 = $190003;
    ME_SUBTYPE_ANY = $190004;
    ME_SUBTYPE_CTR = $190006;

    ME_DEVICE_DRIVER_NAME_MAX_COUNT = 64;
    ME_DEVICE_NAME_MAX_COUNT = 64;
    ME_DEVICE_DESCRIPTION_MAX_COUNT = 256;

    ME_BUS_TYPE_INVALID = $0;
    ME_BUS_TYPE_ANY = $1A0000;
    ME_BUS_TYPE_PCI = $1A0001;
    ME_BUS_TYPE_USB = $1A0002;
    ME_BUS_TYPE_LAN_PCI = $1A0101;
    ME_BUS_TYPE_LAN_USB = $1A0102;

    ME_PLUGGED_INVALID = $0;
    ME_PLUGGED_ANY = $1B0000;
    ME_PLUGGED_IN = $1B0001;
    ME_PLUGGED_OUT = $1B0002;

    ME_EXTENSION_TYPE_INVALID = $0;
    ME_EXTENSION_TYPE_NONE = $1C0001;
    ME_EXTENSION_TYPE_MUX32M = $1C0002;
    ME_EXTENSION_TYPE_DEMUX32 = $1C0003;
    ME_EXTENSION_TYPE_MUX32S = $1C0004;
    ME_EXTENSION_TYPE_ME1001 = $1C0005;

    ME_ACCESS_TYPE_INVALID = $0;
    ME_ACCESS_TYPE_ANY = $1D0000;
    ME_ACCESS_TYPE_LOCAL = $1D0001;
    ME_ACCESS_TYPE_REMOTE = $1D0002;

//==================================================================
//  Defines for ConfigLoad
//==================================================================
    ME_CONF_LOAD_CUSTOM_DRIVER = $00001000;

//==================================================================
//  Defines for FPGA device
//==================================================================
    ME_FPGA_FIRMWARE = $FF000001;
    ME_FPGA_SUBDEVICE = $FF000002;

//==================================================================
//  Defines for meUtilityPWM
//==================================================================
    ME_PWM_START_NO_FLAGS = $00000000;
    ME_PWM_START_CONNECT_INTERNAL = $00000001;

//==================================================================
//  Defines of flags for error handling
//==================================================================
    ME_ERRNO_CLEAR_FLAGS = $01;

//==================================================================
//  Defines of flags for device settings, used with property functions
//==================================================================
    ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS = $0;
    ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS = $1;

//==================================================================
//  Defines of flags for property functions
//==================================================================
    ME_PROPERTY_TYPE_INVALID = $0;
    ME_PROPERTY_TYPE_CONTAINER = $1;
    ME_PROPERTY_TYPE_BOOL = $2;
    ME_PROPERTY_TYPE_INT = $3;
    ME_PROPERTY_TYPE_DOUBLE = $4;
    ME_PROPERTY_TYPE_STRING = $5;
    ME_PROPERTY_TYPE_DEFINE = $6;

    ME_PROPERTY_ACCESS_READ_ONLY = $0;
    ME_PROPERTY_ACCESS_READ_WRITE = $1;

    ME_PROPERTY_BOOLEAN_FALSE = $00;
    ME_PROPERTY_BOOLEAN_TRUE = $01;

    ME_CALIBRATION_TYPE_FACTORY = $001E0000;
    ME_CALIBRATION_TYPE_USER_1 = $001E0001;

implementation

end.
Generated on Thu Aug 20 2020 10:37:16 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Delphi Property Names

  • ME-iDS API
  • Delphi Interface

Delphi Property Names

//==============================================================================
//Copyright(c), Meilhaus Electronic GmbH
//              http://www.meilhaus.de
//              support@meilhaus.de
//
//Source File : meProperties.pas
//            : 2012-11-05 created from meproperties.h
//              defines of property names
//===============================================================================
unit meProperties;

interface

uses
    SysUtils;

const

  //==================================================================
  //  System properties
  //==================================================================

  ME_CONTAINER_NAME_ROOT = '\\';  // Root container (system container)

  ME_ATTRIBUTE_NAME_NUMBER_OF_ELEMENTS    = 'NumberOfElements';
  ME_ATTRIBUTE_NAME_PROPERTY_NAME         = 'PropertyName';
  ME_ATTRIBUTE_NAME_PROPERTY_TYPE         = 'PropertyType';
  ME_ATTRIBUTE_NAME_PROPERTY_ACCESS       = 'PropertyAccess';
  ME_ATTRIBUTE_NAME_PROPERTY_DESCRIPTION  = 'PropertyDescription';
  ME_ATTRIBUTE_NAME_MIN_VALUE             = 'MinValue';
  ME_ATTRIBUTE_NAME_MAX_VALUE             = 'MaxValue';
  ME_ATTRIBUTE_NAME_LENGTH                = 'Length';
  ME_ATTRIBUTE_NAME_MAX_LENGTH            = 'MaxLength';
  ME_ATTRIBUTE_NAME_NUMBER_OF_SELECTIONS  = 'NumberOfSelections';
  ME_ATTRIBUTE_NAME_PREFIX_SELECTION      = 'Selection';    // The selection with index # is 'Selection#';

  //==================================================================
  //  System properties and containers
  //==================================================================

  ME_PROPERTY_NAME_LIBRARY_VERSION        = 'LibraryVersion';
  ME_PROPERTY_NAME_MAIN_DRIVER_VERSION    = 'MainDriverVersion';
  ME_PROPERTY_NAME_NUMBER_OF_DEVICES      = 'NumberOfDevices';
  ME_CONTAINER_NAME_DEVICES               = 'Devices';

  //==================================================================
  //  General device properties and containers - not device specific
  //==================================================================

  ME_CONTAINER_NAME_PREFIX_DEVICE         = 'Device';    // The container name for the device with index # is 'Device#';
  ME_PROPERTY_NAME_NAME                   = 'Name';
  ME_PROPERTY_NAME_DRIVER_NAME            = 'DriverName';
  ME_PROPERTY_NAME_DRIVER_VERSION         = 'DriverVersion';
  ME_PROPERTY_NAME_DESCRIPTION            = 'Description';
  ME_PROPERTY_NAME_SERIAL_NUMBER          = 'SerialNumber';
  ME_PROPERTY_NAME_BUS_TYPE               = 'BusType';
  ME_PROPERTY_NAME_ACCESS_TYPE            = 'AccessType';
  ME_PROPERTY_NAME_PLUGGED                = 'Plugged';
  ME_PROPERTY_NAME_FIRMWARE_SELECTABLE    = 'FirmwareSelectable';
  ME_PROPERTY_NAME_CURRENT_FIRMWARE_ID    = 'CurrentFirmwareID';
  ME_PROPERTY_NAME_NUMBER_OF_SUBDEVICES   = 'NumberOfSubdevices';
  ME_CONTAINER_NAME_SUBDEVICES            = 'Subdevices';

  //==================================================================
  // Additional properties for PCI devices
  //==================================================================

  ME_PROPERTY_NAME_PCI_VENDOR_ID          = 'PCIVendorID';
  ME_PROPERTY_NAME_PCI_DEVICE_ID          = 'PCIDeviceID';
  ME_PROPERTY_NAME_PCI_BUS_NUMBER         = 'PCIBusNumber';
  ME_PROPERTY_NAME_PCI_SLOT_NUMBER        = 'PCISlotNumber';
  ME_PROPERTY_NAME_PCI_FUNCTION_NUMBER    = 'PCIFunctionNumber';

  //==================================================================
  // General sub-device properties and containers - not sub-device specific
  //==================================================================

  ME_CONTAINER_NAME_PREFIX_SUBDEVICE      = 'Subdevice';    // The container name for the sub-device with index # is 'Subdevice#';
  ME_PROPERTY_NAME_TYPE                   = 'Type';
  ME_PROPERTY_NAME_SUBTYPE                = 'Subtype';
  ME_PROPERTY_NAME_NUMBER_OF_CHANNELS     = 'NumberOfChannels';
  ME_PROPERTY_NAME_CONFIGURABLE           = 'Configurable';
  ME_PROPERTY_NAME_NUMBER_OF_CONFIGURATIONS = 'NumberOfConfigurations';
  ME_PROPERTY_NAME_CURRENT_CONFIGURATION  = 'CurrentConfiguration';
  ME_CONTAINER_NAME_CHANNELS              = 'Channels';
  ME_CONTAINER_NAME_PREFIX_CHANNEL        = 'Channel'; // The container name for the channel with index # is 'Channel#';
  ME_CONTAINER_NAME_CONFIGURATIONS        = 'Configurations';
  ME_CONTAINER_NAME_PREFIX_CONFIGURATION  = 'Configuration';    // The container name for the configuration with index # is 'Configuration#';

  //==================================================================
  // Configuration properties
  //==================================================================

  ME_PROPERTY_NAME_SUBDEVICE_TYPE         = 'SubdeviceType';
  ME_PROPERTY_NAME_SUBDEVICE_SUBTYPE      = 'SubdeviceSubtype';
  ME_PROPERTY_NAME_SUBDEVICE_NUMBER_OF_CHANNELS = 'SubdeviceNumberOfChannels';

  //==================================================================
  // ME-5100 and ME-5001 - additional device properties
  //==================================================================

  ME_PROPERTY_NAME_IO_PIN_VOLTAGE_LEVEL   = 'IOPinVoltageLevel';
  ME_PROPERTY_NAME_SUBDEVICES_0_AND_1_TERMINATED = 'Subdevice0And1Terminated';
  ME_PROPERTY_NAME_SUBDEVICES_2_AND_3_TERMINATED = 'Subdevice2And3Terminated';

  //==================================================================
  // Additional sub-device properties for various sub-device types
  //==================================================================

  ME_PROPERTY_NAME_TERMINATED             = 'Terminated';
  ME_PROPERTY_NAME_SYSTEM_CLOCK_FREQUENCY = 'SystemClockFrequency';

  //==================================================================
  // Additional sub-device properties and containers for DI and DO sub-device types
  //==================================================================

  ME_PROPERTY_NAME_TRIGGER_TYPE           = 'TriggerType';
  ME_PROPERTY_NAME_PREFIX_RISING_EDGE_BIT = 'RisingEdgeBit';    // The name for the trigger condition on bit # is 'RisingEdgeBit#';
  ME_PROPERTY_NAME_PREFIX_FALLING_EDGE_BIT = 'FallingEdgeBit';    // The name for the trigger condition on bit # is 'FallngEdgeBit#';
  ME_PROPERTY_NAME_INTERNAL_BUFFER_SIZE   = 'InternalBufferSize';
  ME_PROPERTY_NAME_SAMPLE_FREQUENCY       = 'SampleFrequency';
  ME_PROPERTY_NAME_SAMPLE_TIME            = 'SampleTime';
  ME_PROPERTY_NAME_START_TRIGGER_TYPE     = 'StartTriggerType';
  ME_PROPERTY_NAME_CONV_TRIGGER_TYPE      = 'ConvTriggerType';
  ME_PROPERTY_NAME_STOP_TRIGGER_TYPE      = 'StopTriggerType';
  ME_PROPERTY_NAME_START_STOP_PATTERN     = 'StartStopPattern';
  ME_PROPERTY_NAME_STOP_ON_COUNT          = 'StopOnCount';
  ME_PROPERTY_NAME_STOP_COUNT             = 'StopCount';
  ME_CONTAINER_NAME_INTERRUPT_CONDITION   = 'InterruptCondition';
  ME_CONTAINER_NAME_SINGLE_CONFIGURATION  = 'SingleConfiguration';
  ME_CONTAINER_NAME_EXT_DIGITAL_TRIGGER_CONDITION = 'ExtDigitalTriggerCondition';
  ME_CONTAINER_NAME_STREAMING_CONFIGURATION = 'StreamingConfiguration';
  ME_CONTAINER_NAME_START_AND_CONV_TRIGGER_CONDITION = 'StartAndConvTriggerCondition';
  ME_CONTAINER_NAME_STOP_TRIGGER_CONDITION = 'StopTriggerCondition';
  ME_CONTAINER_NAME_IRQ_CONFIGURATION      = 'IRQConfiguration';

  //==================================================================
  // Additional sub-device properties for AI sub-device types
  //==================================================================

  ME_PROPERTY_NAME_CALIBRATION             = 'Calibration';
  ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A1  = 'RisingEdgeTriggerA1';
  ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A1 = 'FallingEdgeTriggerA1';
  ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A2  = 'RisingEdgeTriggerA2';
  ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A2 = 'FallingEdgeTriggerA2';
  ME_PROPERTY_NAME_ACQUIRE_CHANNEL         = 'AcquireChannel';

  //==================================================================
  // Additional sub-device properties and containers for DI sub-device types
  //==================================================================

  ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_A   = 'RisingEdgeTriggerA';
  ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_A  = 'FallingEdgeTriggerA';
  ME_PROPERTY_NAME_USE_INTERNAL_TEST_COUNTER = 'UseInternalTestCounter';
  ME_PROPERTY_NAME_TRANSFER_SIZE          = 'TransferSize';
  ME_PROPERTY_NAME_IRQ_SOURCE             = 'IRQSource';
  ME_PROPERTY_NAME_BIT_PATTERN            = 'BitPattern';
  ME_PROPERTY_NAME_BIT_PATTERN_FILTERING  = 'BitPatternFiltering';
  ME_PROPERTY_CONTAINER_BIT_MASK          = 'BitMask';

  //==================================================================
  // Additional sub-device properties and containers for DO sub-device types
  //==================================================================

  ME_PROPERTY_NAME_RISING_EDGE_TRIGGER_B  = 'RisingEdgeTriggerB';
  ME_PROPERTY_NAME_FALLING_EDGE_TRIGGER_B = 'FallingEdgeTriggerB';
  ME_PROPERTY_NAME_IRQ_ON_EXCESS_TEMPERATURE = 'IRQOnExcessTemperature';
  ME_PROPERTY_NAME_IRQ_ON_NORMAL_TEMPERATURE = 'IRQOnNormalTemperature';
  ME_PROPERTY_NAME_STOP_PATTERN           = 'StopPattern';
  ME_PROPERTY_NAME_WRAPAROUND             = 'Wraparound';
  ME_PROPERTY_NAME_WRAPAROUND_LOOPS       = 'WraparoundLoops';

  //==================================================================
  // Additional sub-device properties and containers for DO and FO sub-device types
  //==================================================================

  ME_PROPERTY_NAME_OUTPUT_MODE            = 'OutputMode';

  //==================================================================
  // Additional sub-device properties and containers for DIO sub-device types
  //==================================================================

  ME_PROPERTY_NAME_DIRECTION              = 'Direction';

  //==================================================================
  // Additional sub-device properties FI sub-device types
  //==================================================================

  ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TICKS = 'MinMeasurableTotalTicks';
  ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TICK  = 'MaxMeasurableTotalTicks';
  ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TICKS = 'MinMeasurableFirstPhaseTicks';
  ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TICKS = 'MaxMeasurableFirstPhaseTicks';
  ME_PROPERTY_NAME_MIN_MEASURABLE_TOTAL_TIME  = 'MinMeasurableTotalTime';
  ME_PROPERTY_NAME_MAX_MEASURABLE_TOTAL_TIME  = 'MaxMeasurableTotalTime';
  ME_PROPERTY_NAME_MIN_MEASURABLE_FIRST_PHASE_TIME = 'MinMeasurableFirstPhaseTime';
  ME_PROPERTY_NAME_MAX_MEASURABLE_FIRST_PHASE_TIME = 'MaxMeasurableFirstPhaseTime';

  //==================================================================
  // Additional sub-device properties for FO sub-device types
  //==================================================================

  ME_PROPERTY_NAME_MIN_TOTAL_TICKS        = 'MinTotalTicks';
  ME_PROPERTY_NAME_MAX_TOTAL_TICK         = 'MaxTotalTicks';
  ME_PROPERTY_NAME_MIN_FIRST_PHASE_TICKS  = 'MinFirstPhaseTicks';
  ME_PROPERTY_NAME_MAX_FIRST_PHASE_TICKS  = 'MaxFirstPhaseTicks';
  ME_PROPERTY_NAME_MIN_TOTAL_TIME         = 'MinTotalTime';
  ME_PROPERTY_NAME_MAX_TOTAL_TIME         = 'MaxTotalTime';
  ME_PROPERTY_NAME_MIN_FIRST_PHASE_TIME   = 'MinFirstPhaseTime';
  ME_PROPERTY_NAME_MAX_FIRST_PHASE_TIME   = 'MaxFirstPhaseTime';

  //==================================================================
  // FO sub-device channel properties
  //==================================================================

  ME_PROPERTY_NAME_INVERTED               = 'Inverted';
  ME_PROPERTY_NAME_SYNCHRONOUS_START      = 'SynchronousStart';
  ME_PROPERTY_NAME_SOFT_START             = 'SoftStart';

  //==================================================================
  // Counter sub-devices - additional sub-device properties
  //==================================================================

  ME_PROPERTY_NAME_WIDTH_IN_BITS          = 'WidthInBits';
  ME_PROPERTY_NAME_CLOCK_SOURCE           = 'ClockSource';
  ME_PROPERTY_NAME_COUNTER_MODE           = 'CounterMode';

implementation

end.
Generated on Thu Aug 20 2020 10:37:17 for Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows by doxygen 1.7.3


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: meIDSTools.dll

meIDSTools.dll

The DLL meIDSTools.dll contains a collection of routines to carry out common tasks using the ME-iDS system.

meIDSTools.dll contains the following routines:

  • int meIDSToolsWaveGen(int iDevice, int iSubdevice, int iUnit, int iShape, double dAmplitude, double dOffset, double* pdFrequency)

int meIDSToolsWaveGen(int iDevice, int iSubdevice, int iUnit, int iShape, double dAmplitude, double dOffset, double* pdFrequency)

This routine can be used to output one of a set of predefined waveforms on an ME-iDS analog output sub-device that supports streaming as found for example on some of the boards of the ME-4xxx and ME-6xxx families.

The routine creates the waveform using a number of data points less than the size of the internal FIFO on the sub-device. In this way, once started, the hardware will output the waveform indefinitely without consuming processor cycles until meIOStreamStop is called to terminate the operation.

The routine uses as much of the internal FIFO as possible in order to produce as smooth a signal as possible.

The meaning of the parameters passed to this function is as follows:

  • iDevice, iSubdevice: Device and sub-device index of the AO streaming sub-device which will be used to output the waveform.
  • iUnit: Type of signal which will be output, one of the constants ME_UNIT_VOLT, ME_UNIT_AMPERE, ME_UNIT_ANY or ME_UNIT_HZ from medefines.h
  • iShape: Shape of the waveform to be output, one of the constants MEIDS_TOOLS_WAVEGEN_SHAPE_RECTANGLE, MEIDS_TOOLS_WAVEGEN_SHAPE_TRIANGLE, MEIDS_TOOLS_WAVEGEN_SHAPE_SINUS, MEIDS_TOOLS_WAVEGEN_SHAPE_COSINUS, MEIDS_TOOLS_WAVEGEN_SHAPE_POS_RAMP or MEIDS_TOOLS_WAVEGEN_SHAPE_NEG_RAMP form meIDSToolsDLL.h
  • dAmplitude: The amplitude in the units 'iUnit' above of the signal produced.
  • dOffset: The offset in the units 'iUnit' above of the signal produced.
  • dFrequency: The frequency in Hz of the signal produced.

The return value from the routine is one of the standard ME-iDS error codes as defined in meerror.h or one of the special error codes MEIDS_TOOLS_ERRNO_... defined in meIDSToolsDLL.h.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Description of the C++ Console Test Programs

Description of the C++ Console Test Programs

Con_meIDSSystemInfo

This test program simply prints a list of the ME-iDS devices found in the system together with a list of their sub-devcies.
In addition, the version of each ME-iDS component in the system is printed.

Note:
The code to print the system information in found in a self-contained function in the file TestConsoleGeneric.cpp in the root directory.
This function is called once to print the system information at the beginning of each of the other test programs.

See the source code for this example;

Con_meErrorSetUserProc

This test program demonstrates using the ME-iDS API function meErrorSetUserProc to install a user-defined error routine which will be automatically called each time an API function returns an error.

An error function is installed which simply prints the name of the function which caused the error, the number of the error and a short description obtained by calling a further API function, meErrorGetMessage.

THe user is then repeatedly asked to enter a device number for which the routine meQueryNameDevice is called. If an invalid device number is entered, then meQueryNameDevice will return an error and the installed error function will be called automatically.

See the source code for this example;

Con_meIOCounter8254

This test program demonstrates the use of the ME-iDS API in conjunction with an 8254 counter sub-device.

The system is searched for all ME-iDS sub-devices with Type = ME_TYPE_CTR and Subtype = ME_SUBTYPE_CTR_8254.

A list of these sub-devices is printed on the screen and after choosing one it is possible to select one of the functions Reset (meIOResetSubdevice), Config (meIOSingleConfig), Write (meIOSingle, direction ME_DIR_OUTPUT) or Read (meIOSingle, direction ME_DIR_OUTPUT) to operate on this sub-device.

According to the function chosen in the last step it may be necessary to provide additional parameters for the function call.

Finally the required function is executed and, in the case of 'Read' the result is printed on the screen.

The whole process may be repeated with different sub-devices and/or different functions as often as desired

See the source code for this example;

Con_meIODigitalIrqCallback

This test program demonstrates the use of the ME-iDS API to automatically call a user defined routine when certain conditions are met on digital input/output lines.

This functionality is available on the me8100 family of boards where pattern matching and bit change events can be used to generate an interrupt and call a user-defined routine. It is also available on the me8200 family of boards where, in addition to the events available on the me8100 board family, a current overload event can also be used.

A list of all the sub-devices in the system supporting this kind of digital IRQ is printed on the screen and after choosing one any necessary parameters can be entered.

When all the required information has been gathered IRQ monitoring is started by pressing any key.

From this point on, until the ESCAPE key is pressed, each time the appropriate event occurs an interrupt will be generated and the installed callback routine will be executed causing a message to be printed on the screen containing the total number of IRQ's generated to date.

The whole process may be repeated with different sub-devices and/or different parameters as often as desired

See the source code for this example;

Con_meIOExtIrqCallback

This test program demonstrates the use of the ME-iDS API to automatically call a user defined routine when an external interrupt is generated.

A list of all the sub-devices in the system supporting an external interrupt is printed on the screen and after choosing one any necessary parameters can be entered.

When all the required information has been gathered IRQ monitoring is started by pressing any key.

From this point on, until the ESCAPE key is pressed, each time the appropriate event occurs an interrupt will be generated and the installed callback routine will be executed causing a message to be printed on the screen containing the total number of IRQ's generated to date.

The whole process may be repeated with different sub-devices and/or different parameters as often as desired

See the source code for this example;

Con_meIOExtIrqWait

This test program demonstrates the use of the ME-iDS API, and in particular of the function meIOIrqWait, to monitor external interrupts.

A list of all the sub-devices in the system supporting an external interrupt is printed on the screen and after choosing one any necessary parameters can be entered.

When all the required information has been gathered IRQ monitoring is started by pressing any key.

The function meIOIrqWait is then called in a loop. This function blocks until either an external interrupt occurs or the time-out period (in this test program 10 seconds) is exceeded.

If an interrupt occurs a message is printed on the screen containing the total number of IRQ's generated to date. In the event of a time-out a corresponding message is also printed on the screen.

If the ESCAPE key is pressed at any point then the interrupt monitoring will be terminated the next time the routine meIOIrqWait returns.

The whole process may be repeated with different sub-devices and/or different parameters as often as desired

See the source code for this example;

Con_meIOSingleReadAnalog

This test program demonstrates the use of the ME-iDS API to read single analog values from a sub-device which supports this capability and to convert the analog values to physical units.

A list of all the sub-devices in the system supporting single analog input is printed on the screen and after choosing one any necessary parameters such as channel number and range can be entered.

When all the required information has been gathered the user is requested to press a key each time a sample is required. The physical value together with the raw, analog value is printed on the screen

Pressing the ESCAPE key at any point terminates the sampling loop and makes it possible to choose a different sub-device and/or different parameters.

See the source code for this example;

Con_meIOSingleReadDigital

This test program demonstrates the use of the ME-iDS API to read single digital values from a sub-device which supports this capability.

A list of all the sub-devices in the system supporting digital input is printed on the screen. This list consists of all DI or DIO sub-devices found in the system. After choosing one of these sub-devices and pressing any key, the port is read and the value is displayed in hexadecimal format on the screen.

Note:
If the sub-device chosen is a DIO sub-device, then the test program configures it for input before trying to read from it.

The test program always reads from the full breadth of the port, 8, 16 or 32 bits and so the user is not required to enter a channel number or a flag for the data width.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meIOSingleWriteAnalog

This test program demonstrates the use of the ME-iDS API to write single analog values to a sub-device which supports this capability.

A list of all the sub-devices in the system supporting single analog output is printed on the screen and after choosing one any necessary parameters such as channel number and range can be entered.

When all the required information has been gathered the program enters a loop in which the user is repeatedly asked to enter a physical value which is then converted to a digital value and output to the chosen sub-device. The physical value together with the corresponding digital value is printed on the screen

At any time, if instead of entering a value the user simply presses the RETURN key then the input loop is exited.

The whole process may be repeated with different sub-devices and/or different parameters as often as desired

See the source code for this example;

Con_meIOSingleWriteDigital

This test program demonstrates the use of the ME-iDS API to write single digital values to a sub-device which supports this capability.

A list of all the sub-devices in the system supporting digital output is printed on the screen. This list consists of all DO or DIO sub-devices found in the system. After choosing one of these sub-devices and, where necessary, entering any additional parameters the program enters a loop in which the user is required to enter digital values in hexadecimal format which are then output to sub-device. Pressing the return key at any time without entering a value exits the loop.

Note:
If the sub-device chosen is a DIO sub-device, then the test program configures it for output before trying to write to it.

The test program always writes to the full breadth of the port, 8, 16 or 32 bits and so the user is not required to enter a channel number or a flag for the data width.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meIOStreamRead

This test program demonstrates the use of the ME-iDS API to acquire a continuous stream of analog values from a sub-device which supports this capability.

Once the data acquisition has been started, the function meIOStreamRead is called continuously in a loop to read the data from the sub-device.

The first sub-device in the system supporting analog input streaming is located and the routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect data from the first channel with a sampling rate of 10 Hz.

After calling meIOStreamStart to start the acquisition, meIoStreamRead is continuously called to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

The acquisition can be terminated at any time by pressing any key.

See the source code for this example;

Con_meIOStreamRead5200

This test program demonstrates the use of the ME-iDS API to acquire a continuous stream of analog values from the AI streaming sub-device on an ME-52xx board.

Once the data acquisition has been started, the function meIOStreamRead is called continuously in a loop to read the data from the sub-device.

The first sub-device in the system supporting analog input streaming is located and the routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect data from the first channel with a sampling rate of 10 Hz.

After calling meIOStreamStart to start the acquisition, meIoStreamRead is continuously called to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

The acquisition can be terminated at any time by pressing any key.

See the source code for this example;

Con_meIOStreamReadCallbacks

This test program demonstrates the use of the ME-iDS API to acquire a continuous stream of analog values from a sub-device which supports this capability.

A callback routine is installed which is called automatically whenever new data is available.

The first sub-device in the system supporting analog input streaming is located and the routine meIOStreamSetCallbacks is called to install functions which are called automatically during data acquisition.
The routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect data from the first channel with a sampling rate of 100 Hz.

After calling meIOStreamStart to start the acquisition, the installed callback routine StreamReadNewValuesCallback is executed whenever new data is available from the device. In the callback routine, meIoStreamRead is called to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

The acquisition can be terminated at any time by presssing any ESCAPE key.

See the source code for this example;

Con_meIOStreamReadCallbacks5200

This test program demonstrates the use of the ME-iDS API to acquire a continuous stream of analog values from the AI streaming sub-device on an ME-52xx board.

A callback routine is installed which is called automatically whenever new data is available.

The first sub-device in the system supporting analog input streaming is located and the routine meIOStreamSetCallbacks is called to install functions which are called automatically during data acquisition.
The routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect data from the first channel with a sampling rate of 100 Hz.

After calling meIOStreamStart to start the acquisition, the installed callback routine StreamReadNewValuesCallback is executed whenever new data is available from the device. In the callback routine, meIoStreamRead is called to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

The acquisition can be terminated at any time by presssing any ESCAPE key.

See the source code for this example;

Con_meIOStreamReadScan

This test program demonstrates the use of the ME-iDS API to acquire a predetermined number of analog values in a stream from a sub-device which supports this capability.

The routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect 200 data values from the first channel with a sampling rate of 10 Hz.

After calling meIOStreamStart to start the acquisition, meIOStreamStatus is called at 400 millisecond intervals to test if the acquisition is still running. The information whether the acquisition is still running or has already terminated is printed on the screen together with the number of data values acquired to date.

When the acquisition has terminated, meIoStreamRead is called repeatedly to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

See the source code for this example;

Con_meIOStreamReadScan5200

This test program demonstrates the use of the ME-iDS API to acquire a predetermined number of analog values in a stream from the AI streaming sub-device on an ME-52xx board

The routines meIOStreamTimeToTicks, meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to collect 200 data values from the first channel with a sampling rate of 10 Hz.

After calling meIOStreamStart to start the acquisition, meIOStreamStatus is called at 400 millisecond intervals to test if the acquisition is still running. The information whether the acquisition is still running or has already terminated is printed on the screen together with the number of data values acquired to date.

When the acquisition has terminated, meIoStreamRead is called repeatedly to read the acquired data and after calling meUtilityDigitalToPhysical to convert the digital data to physical units, the digital values together with their physical equivalent are printed on the screen.

See the source code for this example;

Con_meIOStreamWrite

This test program demonstrates the use of the ME-iDS API to write a continuous stream of data to a sub-device which supports this capability.

A list of all the sub-devices in the system supporting analog output streaming is printed on the screen. After choosing one of these sub-devices The routines meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to output data over the first channel with a frequency of 2 KHz.

meIOStreamWrite is then called in 'Preload' mode to queue the first buffer of data values to the sub-device. Finally, meIOStreamStart is called to start the output.

The program then enters a loop in which pressing the SPACE key causes another buffer of data values to be queued to the sub-device. The data values which are queued represent alternatively rising and falling slopes of 10 seconds duration (20000 values).
Pressing the ESCAPE key at any time causes the data output to terminate.
If the queue of data values ia exhausted the output will stop automatically and trying to add more data values to the queue will cause an error.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meIOStreamWriteWraparound

This test program demonstrates the use of the ME-iDS API to write a continuous stream of data in warp-around mode to a sub-device which supports this capability.

A list of all the sub-devices in the system supporting analog output streaming is printed on the screen. After choosing one of these sub-devices The routines meIOStreamFrequencyToTicks and meIOStreamConfig are used to configure this sub-device to output data over the first channel in wrap-around mode with a frequency of 1 KHz.

meIOStreamWrite is then called in 'Preload' mode to queue the buffer of data values to the sub-device. Finally, meIOStreamStart is called to start the output.

The data values (a rising slope of 20 seconds duration) are repeatedly output until the user presses either the 'I' key which immediately terminates the output or the 'L' key which terminates the output on reaching the end of the data buffer.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meIOFrequencyIn

This test program demonstrates the use of the ME-iDS API to measure the frequency of an incoming square wave on a sub-device which supports this capability.

A list of all the FI sub-devices in the system is printed on the screen and after choosing one the user has to choose whether to reset, configure or read from the sub-device.

Having chosen a function the user must enter the necessary parameters and/or flags. In particular, if reading from the sub-device, the user must decide whether he wishes to read the total period of the signal or the length of the first phase

If reading from the sub-device, the routine meIOSingleTicksToTime is called after the read operation to convert the number of ticks returned to a time in seconds.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meIOFrequencyOut

This test program demonstrates the use of the ME-iDS API to generate a pulse (output a square wave) on a sub-device which supports this capability.

A list of all the FO sub-devices in the system is printed on the screen and after choosing one the user has to choose whether to reset, configure, read from or write to the sub-device.

Having chosen a function the user must enter the necessary parameters and/or flags. In particular, if writing to the sub-device, the user must decide whether he wishes to write the total period of the signal or the length of the first phase

If writing to the sub-device, the routine meIOSingleTimeToTicks is called before writing to the sub-device to convert the time in seconds to a number of ticks for the write routine.

This process may be repeated with different sub-devices as often as desired.

See the source code for this example;

Con_meLockSubdevice

This test program demonstrates the use of the API function meLockSubdevice to reserve access to a sub-device for a particular application and then to remove this restriction again.

Once the program has been started, pressing any key causes the first sub-device on the first ME-iDS device in the system to be locked by the program.

Pressing a further key causes the lock to be released.

To demonstrate the locking of a sub-device you should start a second instance of this program when the first instance holds the lock on the sub-device.
Attempting to obtain the lock via the second program instance will cause an error.

See the source code for this example;

Con_meIOResetDevice

This test program demonstrates the use of the API function meResetDevice to reset all aspects of a particular ME-iDS device in the system.

Note:
Calling meIOResetDevice, in addition to other device dependant operations, automatically causes meIOResetSubdevice to be called for all sub-devices.

Once the program has been started, pressing any key causes meIOResetDevice to be called for all ME-iDS devices in the system.

See the source code for this example;

Con_meUtilityPWM

This test program demonstrates the use of the API functions meUtilityPWMStart and meUtilityPWMStop to generate a pulse width modulated signal using three independant 8254 counter sub-devices on an ME-iDS device.

The program searches for all ME-iDS devices in the system which have at least three counter sub-devices and presents the user with a list of these devices out of which he should choose one.

Having chosen a device, the user is requested to enter values for the remaining parameters ('iRef', 'iPrescaler', 'iDutyCycle' and 'iFlag') and after pressing any key, the pulse width modulation is started by calling meUtilityPWMStart.

Pressing an additional key causes the pulse width modulation to be terminated by calling meUtilityPWMStop.

Note:
For the second, third and fourth parameters passed to meUtilityPWMStart ('iSubdevice1', 'iSubdevice2' and 'iSubdevice1') the first three counter sub-devices found on the chosen device are used.

See the source code for this example;

Con_meIOMEphistoScopeStreamRead

This test program demonstrates the use of the streaming functions meIoStream... in conjunction with the MEphistoScope device which offers a number of special features in this area.

Once the program has been started, the user can choose one of the four streaming modes for the AI sub-device on the MEphistoScope. After entering all the required parameters he can carry out the streaming operation and see the results

See the source code for this example;

Con_meIDSSystemProperties

This test program demonstrates the use of the property functions mePropertyGet... to print a list of all the properties for the current system configuration.

The program is relatively short because a recursive function is used which prints the properties of all the elements of a particular property container. Executing this routine on the root container of the entire system causes the properties for the entier property hierarchy to be printed

In this test program we use the ANSI property routines mePropertyGet...A but we could just as easily have used the wide character or unicode routines mePropertyGet...W.

See the source code for this example;


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIDSSystemInfo C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIDSSystemInfo C++ Testprogram

#include "stdafx.h"

#include <windows.h>

#include <stdio.h>
#include <conio.h>

extern "C"
{
#include "medriver.h"
}

int TestConsoleMEIDSProlog(void)
{
    // Increase the size of the console buffer

    HANDLE  h_console = GetStdHandle(STD_OUTPUT_HANDLE);

    COORD coord;

    coord.X = 120;

    coord.Y = 2000;

    SetConsoleScreenBufferSize(h_console, coord);

    char sz_buffer[1024];

    // Enable the default error procedure

    meErrorSetDefaultProc(ME_SWITCH_ENABLE);

    // Print the library version

    int i_version_library;

    int i_me_error = meQueryVersionLibrary(&i_version_library);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meQueryVersionLibrary - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        _getch();

        return(-1);
    }

    printf("Library version: %d.%d.%d.%d\n", (i_version_library >> 24) & 0x000000FF, (i_version_library >> 16) & 0x000000FF, (i_version_library >> 8) & 0x000000FF, i_version_library & 0x000000FF);

    // Open the driver system

    i_me_error = meOpen(0);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meOpen - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        _getch();

        return(-1);
    }

    // Print the main driver version

    int i_version_main_driver;

    i_me_error = meQueryVersionMainDriver(&i_version_main_driver);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meQueryVersionMainDriver - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        meClose(0);

        _getch();

        return(-1);
    }

    printf("Main driver version: %d.%d.%d.%d\n", (i_version_main_driver >> 24) & 0x000000FF, (i_version_main_driver >> 16) & 0x000000FF, (i_version_main_driver >> 8) & 0x000000FF, i_version_main_driver & 0x000000FF);

    // Query the number of devices

    int i_number_of_devices;

    i_me_error = meQueryNumberDevices(&i_number_of_devices);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meQueryNumberDevices - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        meClose(0);

        _getch();

        return(-1);
    }

    if(i_number_of_devices == 0)
    {
        printf("****    No ME-IDS devices found in system    ****\n\n");

        printf("Press any key to terminate\n\n");

        meClose(0);

        _getch();

        return(-1);
    }

    printf("Number of Devices: %d\n\n", i_number_of_devices);

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(index_device, &i_vendor_id, &i_device_id, &i_serial_no,
                                                &i_bus_type, &i_bus_no, &i_dev_no, &i_func_no, &i_plugged);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryInfoDevice - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf(	"%sDevice: %-2d - Ser Nr.: 0x%08X - %s\n"
                "----------\n\n",
                (i_plugged == ME_PLUGGED_IN) ? "" : "! ",
                index_device,
                i_serial_no,
                (i_plugged == ME_PLUGGED_IN) ? "Plugged in" : "NOT plugged in");

        i_me_error = meQueryNameDevice(index_device, &sz_buffer[0], 1024);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryNameDevice - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf("    Device name: %s\n", &sz_buffer[0]);

        i_me_error = meQueryDescriptionDevice(index_device, &sz_buffer[0], 1024);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryNameDevice - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf("    Device description: %s\n", &sz_buffer[0]);

        i_me_error = meQueryNameDeviceDriver(index_device, &sz_buffer[0], 1024);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryNameDeviceDriver - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf("    Device driver name: %s\n", &sz_buffer[0]);

        int i_version_device_driver;

        i_me_error = meQueryVersionDeviceDriver(index_device, &i_version_device_driver);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryVersionDeviceDriver - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf("    Device driver version: %d.%d.%d.%d\n", (i_version_device_driver >> 24) & 0x000000FF, (i_version_device_driver >> 16) & 0x000000FF, (i_version_device_driver >> 8) & 0x000000FF, i_version_device_driver & 0x000000FF);

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(index_device, &i_number_of_subdevices);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryNumberSubdevices - Error: %d    ****\n", i_me_error);

            printf("Press any key to continue\n\n");

            _getch();

            continue;
        }

        printf("    Number of Subdevices: %d\n\n", i_number_of_subdevices);

        for(int index_subdevice = 0; index_subdevice < i_number_of_subdevices; index_subdevice++)
        {
            printf(	"    Subdevice: %-2d\n"
                    "    ------------\n\n",
                    index_subdevice			);

            int i_subdevice_type;
            int i_subdevice_subtype;

            i_me_error = meQuerySubdeviceType(index_device, index_subdevice, &i_subdevice_type, &i_subdevice_subtype);

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQuerySubdeviceType - Error: %d    ****\n", i_me_error);

                printf("Press any key to continue\n\n");

                _getch();

                continue;
            }

            printf("        Subdevice type:     0x%08X\n", i_subdevice_type);
            printf("        Subdevice subtype:  0x%08X\n", i_subdevice_subtype);

            int i_number_of_channels;

            i_me_error = meQueryNumberChannels(index_device, index_subdevice, &i_number_of_channels);

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberChannels - Error: %d    ****\n", i_me_error);

                printf("Press any key to continue\n\n");

                _getch();

                continue;
            }

            printf("        Number of channels: %d\n\n", i_number_of_channels);

            int i_subdevice_caps;

            i_me_error = meQuerySubdeviceCaps(index_device, index_subdevice, &i_subdevice_caps);

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQuerySubdeviceCaps - Error: %d    ****\n", i_me_error);

                printf("Press any key to continue\n\n");

                _getch();

                continue;
            }

            printf("        Subdevice caps: 0x%08X\n\n", i_subdevice_caps);
        }

        printf("\n\n");
    }

    return(i_number_of_devices);
}

// TestConsole_meIDSSystemInfo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    meClose(0);

    printf(	"Press any key to terminate\n\n");

    getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meErrorSetUserProc C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meErrorSetUserProc C++ Testprogram

// Con_meErrorSetUserProc.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int __stdcall meUserErrorProc(char *pcFunctionName, int iErrorCode);

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    printf( "This program demonstrates the use of the ME-iDS function meErrorSetUserProc\n"
            "to install a user-defined error function which will be called automatically\n"
            "each time an API-function returns an error.\n"
            "\n"
            "First of all the standard generic routine TestConsoleMEIDSProlog will be\n"
            "called to list all the ME-iDS devices found on the system\n"
            "\n"
            "Press any key to begin\n\n"                                                    );

    getch();

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    meErrorSetUserProc(meUserErrorProc);

    printf( "The user defined error function has been installed\n"
            "\n"
            "You will now be asked repeatedly to enter a device number for which the\n"
            "API-routine meQueryNameDevice will be called. If you (deliberately) enter\n"
            "an invalid device number, then the routine will return an error, and the\n"
            "error function we have just installed will be called automatically\n\n"        );

    char sz_name_device[ME_DEVICE_NAME_MAX_COUNT];

    char sz_buffer[64];

    while(true)
    {
        printf("Device number (RETURN to terminate): ");

        gets(&sz_buffer[0]);

        printf("\n\n");

        if(sz_buffer[0] == 0)
        {
            break;
        }

        int index_device;

        if( (sscanf(&sz_buffer[0], "%d", &index_device) != 1 ) )
        {
            continue;
        }

        int i_error =  meQueryNameDevice(index_device, &sz_name_device[0], ME_DEVICE_NAME_MAX_COUNT);
        {
            if(i_error == ME_ERRNO_SUCCESS)
            {
                printf( "Device: %d - Name: %s\n\n",
                        index_device, &sz_name_device[0]);
            }
        }
    }

    meClose(0);

    printf(	"Press any key to terminate\n\n");

    getch();

    return 0;
}

int __stdcall meUserErrorProc(char *pcFunctionName, int iErrorCode)
{
    // Get a text message corresponding to the error code

    char error_msg[ME_ERROR_MSG_MAX_COUNT];

    int i_error = meErrorGetMessage(iErrorCode, &error_msg[0], ME_ERROR_MSG_MAX_COUNT);

    if(i_error != ME_ERRNO_SUCCESS)
    {
        return(i_error);
    }

    // Print the name of the calling function, the error code and the error description
    // on the screen.

    printf( "**** User-defined error function called\n\n"
            "**** Error calling function: %s - Error code: 0x%08X\n\n"
            "**** Error description: %s\n\n",
            pcFunctionName, iErrorCode, &error_msg[0]                   );

    return(ME_ERRNO_SUCCESS);
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOCounter8254 C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOCounter8254 C++ Testprogram

// Con_meIOCounter8254.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the Counter sub-devices in the system

    int i_number_ctr_8254_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_CTR,					// Type of sub-device to search for
                                                ME_SUBTYPE_CTR_8254,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ctr_8254_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ctr_8254_subdevices == 0)
    {
        printf("****    No 8254 counter sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the 8254 counter sub-devices

    struct SCounter8254Subddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iNumberOfClockSources;

        int m_arrClockSources[4];
    };

    SCounter8254Subddevice* arrSubdevices = new SCounter8254Subddevice[i_number_ctr_8254_subdevices];

    i_number_ctr_8254_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_CTR,					// Type of sub-device to search for
                                                ME_SUBTYPE_CTR_8254,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ctr_8254_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ctr_8254_subdevices].m_iSubdeviceIndex = index_subdevice;

            int i_caps = 0;

            i_me_error = meQuerySubdeviceCaps(	index_device,			// Device
                                                index_subdevice,		// Sub-device
                                                &i_caps				);	// Number of channels returned here

            arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources = 0;

            if( (i_caps & ME_CAPS_CTR_CLK_PREVIOUS) ==  ME_CAPS_CTR_CLK_PREVIOUS )
            {
                arrSubdevices[i_number_ctr_8254_subdevices].m_arrClockSources[ arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources ] = ME_CAPS_CTR_CLK_PREVIOUS;

                ++arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources;
            }

            if( (i_caps & ME_CAPS_CTR_CLK_INTERNAL_1MHZ) ==  ME_CAPS_CTR_CLK_INTERNAL_1MHZ )
            {
                arrSubdevices[i_number_ctr_8254_subdevices].m_arrClockSources[ arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources ] = ME_CAPS_CTR_CLK_INTERNAL_1MHZ;

                ++arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources;
            }

            if( (i_caps & ME_CAPS_CTR_CLK_INTERNAL_10MHZ) ==  ME_CAPS_CTR_CLK_INTERNAL_10MHZ )
            {
                arrSubdevices[i_number_ctr_8254_subdevices].m_arrClockSources[ arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources ] = ME_CAPS_CTR_CLK_INTERNAL_10MHZ;

                ++arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources;
            }

            if( (i_caps & ME_CAPS_CTR_CLK_EXTERNAL) ==  ME_CAPS_CTR_CLK_EXTERNAL )
            {
                arrSubdevices[i_number_ctr_8254_subdevices].m_arrClockSources[ arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources ] = ME_CAPS_CTR_CLK_EXTERNAL;

                ++arrSubdevices[i_number_ctr_8254_subdevices].m_iNumberOfClockSources;
            }

            ++i_number_ctr_8254_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d 8254 counter sub-devices found:\n\n", i_number_ctr_8254_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ctr_8254_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

        for(int index_clock_type = 0; index_clock_type < arrSubdevices[index_subdevice].m_iNumberOfClockSources; index_clock_type++)
        {
            if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_type] == ME_CAPS_CTR_CLK_PREVIOUS)
            {
                printf("Previous");
            }
            else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_type] == ME_CAPS_CTR_CLK_INTERNAL_1MHZ)
            {
                printf("Internal 1 MHz");
            }
            else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_type] == ME_CAPS_CTR_CLK_INTERNAL_10MHZ)
            {
                printf("Internal 10 MHz");
            }
            else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_type] == ME_CAPS_CTR_CLK_EXTERNAL)
            {
                printf("External");
            }

            if(index_clock_type < arrSubdevices[index_subdevice].m_iNumberOfClockSources - 1)
            {
                printf(", ");
            }
            else
            {
                printf(" clock input\n");
            }
        }
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice;

        int i_number_function;

        bool b_terminate = false;

        while(true)
        {
            printf("Choose sub-device:\n\n");

            for(index_subdevice = 0; index_subdevice < i_number_ctr_8254_subdevices; index_subdevice++)
            {
                printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                        index_subdevice + 1,
                        arrSubdevices[index_subdevice].m_iDeviceIndex,
                        arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

                for(int index_clock_src = 0; index_clock_src < arrSubdevices[index_subdevice].m_iNumberOfClockSources; index_clock_src++)
                {
                    if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_src] == ME_CAPS_CTR_CLK_PREVIOUS)
                    {
                        printf("Previous");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_src] == ME_CAPS_CTR_CLK_INTERNAL_1MHZ)
                    {
                        printf("Internal 1 MHz");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_src] == ME_CAPS_CTR_CLK_INTERNAL_10MHZ)
                    {
                        printf("Internal 10 MHz");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrClockSources[index_clock_src] == ME_CAPS_CTR_CLK_EXTERNAL)
                    {
                        printf("External");
                    }

                    if(index_clock_src < arrSubdevices[index_subdevice].m_iNumberOfClockSources - 1)
                    {
                        printf(", ");
                    }
                    else
                    {
                        printf(" clock input\n");
                    }
                }
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ctr_8254_subdevices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
            {
                continue;
            }

            if( (index_subdevice < 1)||(index_subdevice > i_number_ctr_8254_subdevices) )
            {
                continue;
            }

            --index_subdevice;

            break;
        }

        if(b_terminate)
        {
            break;
        }

        while(true)
        {
            printf("Choose function:\n\n");

            printf(	"1. Reset\n"
                    "2. Config\n"
                    "3. Write\n"
                    "4. Read\n\n");

            printf("\nYour choice (1 - 4) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_number_function) != 1 ) )
            {
                continue;
            }

            if( (i_number_function < 1)||(i_number_function > 4) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int b_cancel = false;

        switch(i_number_function)
        {
        case 1:	// Reset

            printf(	"Press any key to call:\n\n"
                    "    meIOResetSubdevice( %-30d      (iDevice)\n"
                    "                        %-30d      (iSubdevice)\n"
                    "                        %-30s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "ME_IO_RESET_SUBDEVICE_NO_FLAGS"						);

            getch();

            i_me_error = meIOResetSubdevice(arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            ME_IO_RESET_SUBDEVICE_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOResetSubdevice - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d reset, press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            _getch();

            break;

        case 2: // Config

            int i_mode;

            while(true)
            {
                printf("Choose mode (0 - 5) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_mode) != 1 ) )
                {
                    continue;
                }

                if( (i_mode < 0)||(i_mode > 5 ) )
                {
                    continue;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            int index_src;

            if(arrSubdevices[index_subdevice].m_iNumberOfClockSources  > 1)
            {
                while(true)
                {
                    printf("Choose clock source:\n\n");

                    for(index_src = 0; index_src < arrSubdevices[index_subdevice].m_iNumberOfClockSources; index_src++)
                    {
                        printf("    %2d.   ", index_src + 1);

                        if(arrSubdevices[index_subdevice].m_arrClockSources[index_src] == ME_CAPS_CTR_CLK_PREVIOUS)
                        {
                            printf("Previous\n");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrClockSources[index_src] == ME_CAPS_CTR_CLK_INTERNAL_1MHZ)
                        {
                            printf("Internal 1 MHz\n");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrClockSources[index_src] == ME_CAPS_CTR_CLK_INTERNAL_10MHZ)
                        {
                            printf("Internal 10 MHz\n");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrClockSources[index_src] == ME_CAPS_CTR_CLK_EXTERNAL)
                        {
                            printf("External\n");
                        }
                    }

                    printf("\nYour choice (1 - %2d) (RETURN to cancel): ", arrSubdevices[index_subdevice].m_iNumberOfClockSources);

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_cancel = true;

                        break;
                    }

                    if( (sscanf(&buffer[0], "%d", &index_src) != 1 ) )
                    {
                        continue;
                    }

                    if( (index_src < 1)||(index_src > arrSubdevices[index_subdevice].m_iNumberOfClockSources) )
                    {
                        continue;
                    }

                    break;
                }

                if(b_cancel)
                {
                    break;
                }

                --index_src;
            }
            else
            {
                index_src = 0;
            }

            if(b_cancel)
            {
                break;
            }

            int i_ref;

            char* sz_ref;

            switch(arrSubdevices[index_subdevice].m_arrClockSources[index_src])
            {
            case ME_CAPS_CTR_CLK_PREVIOUS:

                i_ref = ME_REF_CTR_PREVIOUS;

                sz_ref = "ME_REF_CTR_PREVIOUS";

                break;

            case ME_CAPS_CTR_CLK_INTERNAL_1MHZ:

                i_ref = ME_REF_CTR_INTERNAL_1MHZ;

                sz_ref = "ME_CAPS_CTR_CLK_INTERNAL_1MHZ";

                break;

            case ME_CAPS_CTR_CLK_INTERNAL_10MHZ:

                i_ref = ME_REF_CTR_INTERNAL_10MHZ;

                sz_ref = "ME_REF_CTR_INTERNAL_10MHZ";

                break;

            case ME_CAPS_CTR_CLK_EXTERNAL:

                i_ref = ME_REF_CTR_EXTERNAL;

                sz_ref = "ME_REF_CTR_INTERNAL_10MHZ";

                break;
            }

            int i_single_config;

            char* sz_single_config;

            switch(i_mode)
            {
            case 0:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_0;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_0";

                break;

            case 1:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_1;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_1";

                break;

            case 2:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_2;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_2";

                break;

            case 3:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_3;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_3";

                break;

            case 4:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_4;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_4";

                break;

            case 5:

                i_single_config = ME_SINGLE_CONFIG_CTR_8254_MODE_5;

                sz_single_config = "ME_SINGLE_CONFIG_CTR_8254_MODE_5";

                break;
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingleConfig( %-35d      (iDevice)\n"
                    "                      %-35d      (iSubdevice)\n"
                    "                      %-35d      (iChannel)\n"
                    "                      %-35s      (iSingleConfig)\n"
                    "                      %-35s      (iRef)\n"
                    "                      %-35s      (iTrigChan)\n"
                    "                      %-35s      (iTrigType)\n"
                    "                      %-35s      (iTrigEdge)\n"
                    "                      %-35s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    0,
                    sz_single_config,
                    sz_ref,
                    "ME_TRIG_CHAN_DEFAULT",
                    "ME_TRIG_TYPE_NONE",
                    "ME_VALUE_NOT_USED",
                    "ME_IO_SINGLE_CONFIG_NO_FLAGS"						);

            getch();

            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            0,													// Channel
                                            i_single_config,									// Single config
                                            i_ref,												// Reference
                                            ME_TRIG_CHAN_DEFAULT,								// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            ME_IO_SINGLE_CONFIG_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d has been configured - press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            getch();

            break;

        case 3: // Write

            int i_value;

            while(true)
            {
                printf("Value to output (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_value) != 1 ) )
                {
                    continue;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingle( %-30s      (*pSingleList)\n"
                    "                %-30d      (iCount)\n"
                    "                %-30s  );  (iFlags)\n\n",
                    "&io_single[0]",
                    1,
                    "ME_IO_SINGLE_NO_FLAGS"						);

            printf(	"Where 'io_single' is an array of length one of meIOSingle_t structures:\n\n"
                    "    meIOSingle_t io_single[1]\n\n"
                    "and the first and only element of this array is filled as follows:\n\n"
                    "    %-30s = %-30d      (iDevice)\n"
                    "    %-30s = %-30d      (iSubdevice)\n"
                    "    %-30s = %-30d      (iChannel)\n"
                    "    %-30s = %-30s      (iDir)\n"
                    "    %-30s = %-30d      (iValue)\n"
                    "    %-30s = %-30d      (iTimeOut)\n"
                    "    %-30s = %-30s      (iFlags)\n\n",
                    "io_single[0].iDevice",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    "io_single[0].iSubdevice",
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "io_single[0].iChannel",
                    0,
                    "io_single[0].iDir",
                    "ME_DIR_OUTPUT",
                    "io_single[0].iValue",
                    i_value,
                    "io_single[0].iTimeOut",
                    0,
                    "io_single[0].iFlags",
                    "ME_IO_SINGLE_TYPE_NO_FLAGS"						);

            getch();

            meIOSingle_t io_single[1];

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= 0;
            io_single[0].iDir		= ME_DIR_OUTPUT;
            io_single[0].iValue		= i_value;
            io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
            io_single[0].iFlags		= ME_IO_SINGLE_TYPE_NO_FLAGS;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("%d output to Device: %d Subdevice: %d - press any key to continue\n\n", i_value, arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            getch();

            break;

        case 4: // Read

            printf(	"Press any key to call:\n\n"
                    "    meIOSingle( %-30s      (*pSingleList)\n"
                    "                %-30d      (iCount)\n"
                    "                %-30s  );  (iFlags)\n\n",
                    "&io_single[0]",
                    1,
                    "ME_IO_SINGLE_NO_FLAGS"						);

            printf(	"Where 'io_single' is an array of length one of meIOSingle_t structures:\n\n"
                    "    meIOSingle_t io_single[1]\n\n"
                    "and the first and only element of this array is filled as follows:\n\n"
                    "    %-30s = %-30d      (iDevice)\n"
                    "    %-30s = %-30d      (iSubdevice)\n"
                    "    %-30s = %-30d      (iChannel)\n"
                    "    %-30s = %-30s      (iDir)\n"
                    "    %-30s = %-30d      (iValue) - Result returned here\n"
                    "    %-30s = %-30d      (iTimeOut)\n"
                    "    %-30s = %-30s      (iFlags)\n\n",
                    "io_single[0].iDevice",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    "io_single[0].iSubdevice",
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "io_single[0].iChannel",
                    0,
                    "io_single[0].iDir",
                    "ME_DIR_INPUT",
                    "io_single[0].iValue",
                    0,
                    "io_single[0].iTimeOut",
                    0,
                    "io_single[0].iFlags",
                    "ME_IO_SINGLE_TYPE_NO_FLAGS"						);

            getch();

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= 0;
            io_single[0].iDir		= ME_DIR_INPUT;
            io_single[0].iValue		= 0;
            io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
            io_single[0].iFlags		= ME_IO_SINGLE_TYPE_NO_FLAGS;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Read %d from Device: %d Subdevice: %d, press any key to continue\n\n", io_single[0].iValue, arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            _getch();

            break;
        }
    }

    delete []arrSubdevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIODigitalIrqCallback C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIODigitalIrqCallback C++ Testprogram

// Con_meIODigitalIrqCallback.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

// Forward declaration for callback function

int _stdcall IrqCallback(int iDevice, int iSubdevice, int iChannel,
                            int iIrqCount, int iValue, void *pvContext, int iErrorCode);

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the DI sub-devices in the system that support bit mask or bit pattern IRQ

    int i_number_digital_irq_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & (ME_CAPS_DIO_BIT_PATTERN_IRQ | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) ) != 0 )
            {
                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & (ME_CAPS_DIO_BIT_PATTERN_IRQ | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) ) != 0 )
            {
                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & ME_CAPS_DIO_OVER_TEMP_IRQ ) == ME_CAPS_DIO_OVER_TEMP_IRQ )
            {
                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_digital_irq_subdevices == 0)
    {
        printf("****    No digital sub-devices found in system that support user IRQ   ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the digital sub-devices found in system that support user IRQ

    struct SIRQSource
    {
        int m_iType;

        int m_iEdge;
    };

    struct SDigitalIrqSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iType;

        int m_iWidth;

        int m_iNumberOfSources;

        SIRQSource m_arrSources[4];
    };

    SDigitalIrqSubddevice* arrSubdevices = new SDigitalIrqSubddevice[i_number_digital_irq_subdevices];

    i_number_digital_irq_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & (ME_CAPS_DIO_BIT_PATTERN_IRQ | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) ) != 0 )
            {
                arrSubdevices[i_number_digital_irq_subdevices].m_iDeviceIndex = index_device;

                arrSubdevices[i_number_digital_irq_subdevices].m_iSubdeviceIndex = index_subdevice;

                arrSubdevices[i_number_digital_irq_subdevices].m_iType = ME_TYPE_DI;

                int i_number_sources = 0;

                if( (i_caps & ME_CAPS_DIO_BIT_PATTERN_IRQ) == ME_CAPS_DIO_BIT_PATTERN_IRQ )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_PATTERN;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_VALUE_NOT_USED;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_RISING;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_FALLING;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_ANY;

                    ++i_number_sources;
                }

                int i_number_of_channels;

                i_me_error = meQueryNumberChannels(	index_device,					// Device
                                                    index_subdevice,				// Begin search at this sub-device
                                                    &i_number_of_channels);			// Number of channels returned here

                arrSubdevices[i_number_digital_irq_subdevices].m_iWidth = i_number_of_channels;

                arrSubdevices[i_number_digital_irq_subdevices].m_iNumberOfSources = i_number_sources;

                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & (ME_CAPS_DIO_BIT_PATTERN_IRQ | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING | ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) ) != 0 )
            {
                arrSubdevices[i_number_digital_irq_subdevices].m_iDeviceIndex = index_device;

                arrSubdevices[i_number_digital_irq_subdevices].m_iSubdeviceIndex = index_subdevice;

                arrSubdevices[i_number_digital_irq_subdevices].m_iType = ME_TYPE_DIO;

                int i_number_sources = 0;

                if( (i_caps & ME_CAPS_DIO_BIT_PATTERN_IRQ) == ME_CAPS_DIO_BIT_PATTERN_IRQ )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_PATTERN;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_VALUE_NOT_USED;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_RISING;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_FALLING;

                    ++i_number_sources;
                }

                if( (i_caps & ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY) == ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY )
                {
                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iType = ME_IRQ_SOURCE_DIO_MASK;

                    arrSubdevices[i_number_digital_irq_subdevices].m_arrSources[i_number_sources].m_iEdge = ME_IRQ_EDGE_ANY;

                    ++i_number_sources;
                }

                int i_number_of_channels;

                i_me_error = meQueryNumberChannels(	index_device,					// Device
                                                    index_subdevice,				// Begin search at this sub-device
                                                    &i_number_of_channels);			// Number of channels returned here

                arrSubdevices[i_number_digital_irq_subdevices].m_iWidth = i_number_of_channels;

                arrSubdevices[i_number_digital_irq_subdevices].m_iNumberOfSources = i_number_sources;

                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            if( (i_caps & ME_CAPS_DIO_OVER_TEMP_IRQ ) == ME_CAPS_DIO_OVER_TEMP_IRQ )
            {
                arrSubdevices[i_number_digital_irq_subdevices].m_iDeviceIndex = index_device;

                arrSubdevices[i_number_digital_irq_subdevices].m_iSubdeviceIndex = index_subdevice;

                arrSubdevices[i_number_digital_irq_subdevices].m_iType = ME_TYPE_DO;

                ++i_number_digital_irq_subdevices;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d digital sub-devices that support bit mask, bit pattern or excess temperature IRQ found:\n\n", i_number_digital_irq_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_digital_irq_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

        if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )
        {
            for(int index_source = 0; index_source < arrSubdevices[index_subdevice].m_iNumberOfSources; index_source++)
            {
                if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_PATTERN)
                {
                    printf("Pattern");
                }
                else
                {
                    printf("Mask - ");

                    if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_RISING)
                    {
                        printf("Rising edge");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_FALLING)
                    {
                        printf("Falling edge");
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_ANY)
                    {
                        printf("Any edge");
                    }
                }

                if(index_source < arrSubdevices[index_subdevice].m_iNumberOfSources - 1)
                {
                    printf(", ");
                }
                else
                {
                    printf("\n");
                }
            }
        }
        else
        {
            printf("Excess temperature\n");
        }
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    bool b_terminate = false;

    while(true)
    {
        int index_subdevice;

        if(i_number_digital_irq_subdevices > 1)
        {
            while(true)
            {
                printf("Choose Subdevice:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_digital_irq_subdevices; index_subdevice++)
                {
                    printf("    %2d.   Device: %2d  Sub-device: %2d Supports ",
                            index_subdevice + 1,
                            arrSubdevices[index_subdevice].m_iDeviceIndex,
                            arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

                    if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )
                    {
                        for(int index_source = 0; index_source < arrSubdevices[index_subdevice].m_iNumberOfSources; index_source++)
                        {
                            if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_PATTERN)
                            {
                                printf("Pattern");
                            }
                            else
                            {
                                printf("Mask - ");

                                if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_RISING)
                                {
                                    printf("Rising edge");
                                }
                                else if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_FALLING)
                                {
                                    printf("Falling edge");
                                }
                                else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_ANY)
                                {
                                    printf("Any edge");
                                }
                            }

                            if(index_source < arrSubdevices[index_subdevice].m_iNumberOfSources - 1)
                            {
                                printf(", ");
                            }
                            else
                            {
                                printf("\n");
                            }
                        }
                    }
                    else
                    {
                        printf("Excess temperature\n");
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_digital_irq_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_digital_irq_subdevices) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int index_source;

        if( ( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )&&(arrSubdevices[index_subdevice].m_iNumberOfSources  > 1  ) )
        {
            while(true)
            {
                printf("Choose Source:\n\n");

                for(index_source = 0; index_source < arrSubdevices[index_subdevice].m_iNumberOfSources; index_source++)
                {
                    printf("    %2d.   ", index_source + 1);

                    if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_PATTERN)
                    {
                        printf("Pattern\n");
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_MASK)
                    {
                        printf("Mask - ");

                        if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_RISING)
                        {
                            printf("Rising edge\n");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_FALLING)
                        {
                            printf("Falling edge\n");
                        }
                        else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_ANY)
                        {
                            printf("Any edge\n");
                        }
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfSources);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_source) != 1 ) )
                {
                    continue;
                }

                if( (index_source < 1)||(index_source > arrSubdevices[index_subdevice].m_iNumberOfSources) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_source;
        }
        else
        {
            index_source = 0;
        }

        int irq_start_arg;

        if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )
        {
            while(true)
            {
                if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_PATTERN)
                {
                    printf("Bit Pattern (Hex) (RETURN to terminate): 0x");
                }
                else //  // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_MASK)
                {
                    printf("Bit Mask (Hex, %d Bit) (RETURN to terminate): 0x", arrSubdevices[index_subdevice].m_iWidth);
                }

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%X", &irq_start_arg) != 1 ) )
                {
                    continue;
                }

                break;
            }
        }

        if(b_terminate)
        {
            break;
        }

        if(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO)
        {
            int i_config_flags;

            if(arrSubdevices[index_subdevice].m_iWidth == 8)
            {
                i_config_flags = ME_IO_SINGLE_CONFIG_DIO_BYTE;
            }
            else // if(arrSubdevices[index_subdevice].m_iWidth == 16)
            {
                i_config_flags = ME_IO_SINGLE_CONFIG_DIO_WORD;
            }

            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevcie index
                                            0,													// Channel
                                            ME_SINGLE_CONFIG_DIO_INPUT,							// Single config
                                            ME_VALUE_NOT_USED,									// Reference
                                            ME_TRIG_CHAN_DEFAULT,								// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            i_config_flags									);	// Flags
        }

        i_me_error = meIOIrqSetCallback(arrSubdevices[index_subdevice].m_iDeviceIndex,					// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,				// Subdevice index
                                        IrqCallback,													// Callback routine
                                        NULL,															// Callback contextz
                                        ME_IO_IRQ_SET_CALLBACK_NO_FLAGS						);			// Flags

        printf("Ready to monitor ");

        if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )
        {
            if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_PATTERN)
            {
                printf("Bit pattern interrupts (Pattern; 0x%02X) ", irq_start_arg);
            }
            else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType == ME_IRQ_SOURCE_DIO_MASK)
            {
                printf("Bit change interrupts, ");

                if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_RISING)
                {
                    if(arrSubdevices[index_subdevice].m_iWidth == 8)
                    {
                        printf("Rising edge (Mask:  0x%02X) ", irq_start_arg);
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iWidth == 16)
                    {
                        printf("Rising edge (Mask:  0x%04X) ", irq_start_arg);
                    }
                }
                else if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_FALLING)
                {
                    if(arrSubdevices[index_subdevice].m_iWidth == 8)
                    {
                        printf("Falling edge (Mask:  0x%02X) ", irq_start_arg);
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iWidth == 16)
                    {
                        printf("Falling edge (Mask:  0x%04X) ", irq_start_arg);
                    }
                }
                else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge == ME_IRQ_EDGE_ANY)
                {
                    if(arrSubdevices[index_subdevice].m_iWidth == 8)
                    {
                        printf("Any edge (Mask:  0x%02X) ", irq_start_arg);
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrSources[index_source].m_iWidth == 16)
                    {
                        printf("Any edge (Mask:  0x%04X) ", irq_start_arg);
                    }
                }
            }
        }
        else
        {
            printf("Excess temperature interrupts ");
        }

        printf("on Device: %d, Subdevice: %d\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        printf("Press any key to start monitoring digital interrupts\n\n");

        printf("Press the ESC key at any time to stop monitoring interrupts\n\n");

        _getch();

        if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DI)||(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) )
        {
            i_me_error =  meIOIrqStart(	arrSubdevices[index_subdevice].m_iDeviceIndex,							// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,						// Subdevice index
                                        0,																		// Channel index
                                        arrSubdevices[index_subdevice].m_arrSources[index_source].m_iType,		// IRQ source
                                        arrSubdevices[index_subdevice].m_arrSources[index_source].m_iEdge,		// Type of signal edge
                                        irq_start_arg,															// Additional argument - Not required here
                                        ME_IO_IRQ_START_NO_FLAGS											);	// Flags
        }
        else
        {
            i_me_error =  meIOIrqStart(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Subdevice index
                                        0,														// Channel index
                                        ME_IRQ_SOURCE_DIO_OVER_TEMP,							// IRQ source
                                        ME_VALUE_NOT_USED,										// Type of signal edge
                                        ME_VALUE_NOT_USED,										// Additional argument - Not required here
                                        ME_IO_IRQ_START_NO_FLAGS							);	// Flags
        }

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Monitoring interrupts\n\n");

        while(true)
        {
            if( _kbhit() != 0 )
            {
                if(_getch() == 27)
                {
                    break;
                }
            }
        }

        i_me_error = meIOIrqStop(	arrSubdevices[index_subdevice].m_iDeviceIndex,				// Device index
                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,			// Subdevice index
                                    0,															// Channel index
                                    ME_IO_IRQ_STOP_NO_FLAGS								);		// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Stopped monitoring interrupts\n\n");

        printf("Press any key to continue or ESC to exit\n");

        if(getch() == 27)
        {
            break;
        }
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("\n\nProgram completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}

int _stdcall IrqCallback(int iDevice, int iSubdevice, int iChannel,
                            int iIrqCount, int iValue, void *pvContext, int iErrorCode)
{
    if(iErrorCode == ME_ERRNO_SUCCESS)
    {
        printf("Interrupt: IRQ Count: %d  Value: %d\n", iIrqCount, iValue);
    }
    else
    {
        printf("****    IrqCallback - Error: %d    ****\n\n", iErrorCode);
    }

    return(0);
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOExtIrqCallback C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOExtIrqCallback C++ Testprogram

// Con_meIOExtIrqCallback.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

// Forward declaration for callback function

int _stdcall IrqCallback(int iDevice, int iSubdevice, int iChannel,
                            int iIrqCount, int iValue, void *pvContext, int iErrorCode);

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the External IRQ sub-devices in the system

    int i_number_ext_irq_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_EXT_IRQ,				// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ext_irq_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ext_irq_subdevices == 0)
    {
        printf("****    No External IRQ sub-devices found in system   ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the External IRQ sub-devices

    struct SExtIrqSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iNumberOfEdgeTypes;

        int m_arrEdgeTypes[3];
    };

    SExtIrqSubddevice* arrSubdevices = new SExtIrqSubddevice[i_number_ext_irq_subdevices];

    i_number_ext_irq_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_EXT_IRQ,				// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ext_irq_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ext_irq_subdevices].m_iSubdeviceIndex = index_subdevice;

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            int i_number_edge_types = 0;

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_RISING) == ME_CAPS_EXT_IRQ_EDGE_RISING )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_RISING;

                ++i_number_edge_types;
            }

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_FALLING) == ME_CAPS_EXT_IRQ_EDGE_FALLING )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_FALLING;

                ++i_number_edge_types;
            }

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_ANY) == ME_CAPS_EXT_IRQ_EDGE_ANY )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_ANY;

                ++i_number_edge_types;
            }

            arrSubdevices[i_number_ext_irq_subdevices].m_iNumberOfEdgeTypes = i_number_edge_types;

            ++i_number_ext_irq_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d External IRQ sub-devices found:\n\n", i_number_ext_irq_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ext_irq_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

        for(int index_edge_type = 0; index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge_type++)
        {
            if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_RISING)
            {
                printf("Rising edge");
            }
            else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_FALLING)
            {
                printf("Falling edge");
            }
            else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_ANY)
            {
                printf("Any edge");
            }

            if(index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes - 1)
            {
                printf(", ");
            }
            else
            {
                printf("\n");
            }
        }
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    bool b_terminate = false;

    while(true)
    {
        int index_subdevice;

        if(i_number_ext_irq_subdevices > 1)
        {
            while(true)
            {
                printf("Choose Subdevice:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_ext_irq_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                            index_subdevice + 1,
                            arrSubdevices[index_subdevice].m_iDeviceIndex,
                            arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

                    for(int index_edge_type = 0; index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge_type++)
                    {
                        if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_RISING)
                        {
                            printf("Rising edge");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_FALLING)
                        {
                            printf("Falling edge");
                        }
                        else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_ANY)
                        {
                            printf("Any edge");
                        }

                        if(index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes - 1)
                        {
                            printf(", ");
                        }
                        else
                        {
                            printf("\n");
                        }
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ext_irq_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_ext_irq_subdevices) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int index_edge;

        if(arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes  > 1)
        {
            while(true)
            {
                printf("Choose trigger edge:\n\n");

                for(index_edge = 0; index_edge < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge++)
                {
                    printf("    %2d.   ", index_edge + 1);

                    if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_RISING)
                    {
                        printf("Rising edge\n");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_FALLING)
                    {
                        printf("Falling edge\n");
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_ANY)
                    {
                        printf("Any edge\n");
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_edge) != 1 ) )
                {
                    continue;
                }

                if( (index_edge < 1)||(index_edge > arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_edge;
        }
        else
        {
            index_edge = 0;
        }

        if(b_terminate)
        {
            break;
        }

        printf(	"Press any key to call:\n\n"
                "    meIOIrqSetCallback( %-32d      (iDevice)\n"
                "                        %-32d      (iSubdevice)\n"
                "                        %-32s      (pCallback) - See code\n"
                "                        %-32s      (*pCallbackContext) Not required\n"
                "                        %-32s  );  (iFlags)\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                "IrqCallback",
                "NULL",
                "ME_IO_IRQ_SET_CALLBACK_NO_FLAGS"						);

        getch();

        i_me_error = meIOIrqSetCallback(arrSubdevices[index_subdevice].m_iDeviceIndex,					// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,				// Subdevice index
                                        IrqCallback,													// Callback routine
                                        NULL,															// Callback contextz
                                        ME_IO_IRQ_SET_CALLBACK_NO_FLAGS						);			// Flags

        char* sz_irq_edge;

        printf("Ready to monitor ");

        if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_RISING)
        {
            printf("Rising edge ");

            sz_irq_edge = "ME_IRQ_EDGE_RISING";
        }
        else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_FALLING)
        {
            printf("Falling edge ");

            sz_irq_edge = "ME_IRQ_EDGE_FALLING";
        }
        else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_ANY)
        {
            printf("Any edge ");

            sz_irq_edge = "ME_IRQ_EDGE_ANY";
        }

        printf("on Device: %d, Subdevice: %d\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        printf(	"Press any key to call:\n\n"
                "    meIOIrqStart( %-30d      (iDevice)\n"
                "                  %-30d      (iSubdevice)\n"
                "                  %-30d      (iChannel)\n"
                "                  %-30s      (iIrqSource)\n"
                "                  %-30s      (iIrqEdge)\n"
                "                  %-30s      (iIrqArg)\n"
                "                  %-30s  );  (iFlags)\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                0,
                "ME_IRQ_SOURCE_DIO_LINE",
                sz_irq_edge,
                "ME_VALUE_NOT_USED",
                "ME_IO_IRQ_START_NO_FLAGS"						);

        printf("and start monitoring external interrupts\n\n");

        printf("Press the ESC key at any time to stop monitoring interrupts\n\n");

        _getch();

        i_me_error =  meIOIrqStart(	arrSubdevices[index_subdevice].m_iDeviceIndex,					// Device index
                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,				// Subdevice index
                                    0,																// Channel index
                                    ME_IRQ_SOURCE_DIO_LINE,											// IRQ source
                                    arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge],		// Type of signal edge
                                    ME_VALUE_NOT_USED,												// Additional argument - Not required here
                                    ME_IO_IRQ_START_NO_FLAGS									);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Monitoring interrupts\n\n");

        while(true)
        {
            if( _kbhit() != 0 )
            {
                if(_getch() == 27)
                {
                    break;
                }
            }
        }

        printf(	"Calling:\n\n"
                "    meIOIrqStop( %-30d      (iDevice)\n"
                "                 %-30d      (iSubdevice)\n"
                "                 %-30d      (iChannel)\n"
                "                 %-30s  );  (iFlags)\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                0,
                "ME_IO_IRQ_STOP_NO_FLAGS"						);

        i_me_error = meIOIrqStop(	arrSubdevices[index_subdevice].m_iDeviceIndex,				// Device index
                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,			// Subdevice index
                                    0,															// Channel index
                                    ME_IO_IRQ_STOP_NO_FLAGS								);		// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Stopped monitoring interrupts\n\n");

        printf("Press any key to continue or ESC to exit\n\n");

        if(getch() == 27)
        {
            break;
        }
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("\n\nProgram completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}

int _stdcall IrqCallback(int iDevice, int iSubdevice, int iChannel,
                            int iIrqCount, int iValue, void *pvContext, int iErrorCode)
{
    if(iErrorCode == ME_ERRNO_SUCCESS)
    {
        printf("Interrupt: IRQ Count: %d  Value: %d\n", iIrqCount, iValue);
    }
    else
    {
        printf("****    IrqCallback - Error: %d    ****\n\n", iErrorCode);
    }

    return(0);
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOExtIrqWait C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOExtIrqWait C++ Testprogram

// Con_meIOExtIrqWait.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the External IRQ sub-devices in the system

    int i_number_ext_irq_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_EXT_IRQ,				// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ext_irq_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ext_irq_subdevices == 0)
    {
        printf("****    No External IRQ sub-devices found in system   ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the External IRQ sub-devices

    struct SExtIrqSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iNumberOfEdgeTypes;

        int m_arrEdgeTypes[3];
    };

    SExtIrqSubddevice* arrSubdevices = new SExtIrqSubddevice[i_number_ext_irq_subdevices];

    i_number_ext_irq_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_EXT_IRQ,				// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ext_irq_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ext_irq_subdevices].m_iSubdeviceIndex = index_subdevice;

            int i_caps;

            i_me_error = meQuerySubdeviceCaps(	index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                &i_caps				);			// sub-device caps returned here

            int i_number_edge_types = 0;

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_RISING) == ME_CAPS_EXT_IRQ_EDGE_RISING )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_RISING;

                ++i_number_edge_types;
            }

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_FALLING) == ME_CAPS_EXT_IRQ_EDGE_FALLING )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_FALLING;

                ++i_number_edge_types;
            }

            if( (i_caps & ME_CAPS_EXT_IRQ_EDGE_ANY) == ME_CAPS_EXT_IRQ_EDGE_ANY )
            {
                arrSubdevices[i_number_ext_irq_subdevices].m_arrEdgeTypes[i_number_edge_types] = ME_IRQ_EDGE_ANY;

                ++i_number_edge_types;
            }

            arrSubdevices[i_number_ext_irq_subdevices].m_iNumberOfEdgeTypes = i_number_edge_types;

            ++i_number_ext_irq_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d External IRQ sub-devices found:\n\n", i_number_ext_irq_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ext_irq_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

        for(int index_edge_type = 0; index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge_type++)
        {
            if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_RISING)
            {
                printf("Rising edge");
            }
            else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_FALLING)
            {
                printf("Falling edge");
            }
            else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_ANY)
            {
                printf("Any edge");
            }

            if(index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes - 1)
            {
                printf(", ");
            }
            else
            {
                printf("\n");
            }
        }
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    bool b_terminate = false;

    while(true)
    {
        int index_subdevice;

        if(i_number_ext_irq_subdevices > 1)
        {
            while(true)
            {
                printf("Choose Subdevice:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_ext_irq_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d Supports ",
                            index_subdevice + 1,
                            arrSubdevices[index_subdevice].m_iDeviceIndex,
                            arrSubdevices[index_subdevice].m_iSubdeviceIndex					);

                    for(int index_edge_type = 0; index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge_type++)
                    {
                        if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_RISING)
                        {
                            printf("Rising edge");
                        }
                        else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_FALLING)
                        {
                            printf("Falling edge");
                        }
                        else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge_type] == ME_IRQ_EDGE_ANY)
                        {
                            printf("Any edge");
                        }

                        if(index_edge_type < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes - 1)
                        {
                            printf(", ");
                        }
                        else
                        {
                            printf("\n");
                        }
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ext_irq_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_ext_irq_subdevices) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int index_edge;

        if(arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes  > 1)
        {
            while(true)
            {
                printf("Choose trigger edge:\n\n");

                for(index_edge = 0; index_edge < arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes; index_edge++)
                {
                    printf("    %2d.   ", index_edge + 1);

                    if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_RISING)
                    {
                        printf("Rising edge\n");
                    }
                    else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_FALLING)
                    {
                        printf("Falling edge\n");
                    }
                    else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_ANY)
                    {
                        printf("Any edge\n");
                    }
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_edge) != 1 ) )
                {
                    continue;
                }

                if( (index_edge < 1)||(index_edge > arrSubdevices[index_subdevice].m_iNumberOfEdgeTypes) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_edge;
        }
        else
        {
            index_edge = 0;
        }

        if(b_terminate)
        {
            break;
        }

        printf("Ready to monitor ");

        if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_RISING)
        {
            printf("Rising edge ");
        }
        else if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_FALLING)
        {
            printf("Falling edge ");
        }
        else // if(arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge] == ME_IRQ_EDGE_ANY)
        {
            printf("Any edge ");
        }

        printf("on Device: %d, Subdevice: %d\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        printf("Press any key to start monitoring external interrupts\n\n");

        printf("Press the ESC key at any time to stop monitoring interrupts\n\n");

        _getch();

        i_me_error =  meIOIrqStart(	arrSubdevices[index_subdevice].m_iDeviceIndex,					// Device index
                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,				// Subdevice index
                                    0,																// Channel index
                                    ME_IRQ_SOURCE_DIO_LINE,											// IRQ source
                                    arrSubdevices[index_subdevice].m_arrEdgeTypes[index_edge],		// Type of signal edge
                                    ME_VALUE_NOT_USED,												// Additional argument - Not required here
                                    ME_IO_IRQ_START_NO_FLAGS									);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Monitoring interrupts\n\n");

        while(true)
        {
            if( _kbhit() != 0 )
            {
                if(_getch() == 27)
                {
                    break;
                }
            }

            int i_irq_count;

            int i_value;

            i_me_error = meIOIrqWait(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Subdevice index
                                        0,														// Channel index
                                        &i_irq_count,											// IRQ count returned here
                                        &i_value,												// Value (oif appropriate) returned here
                                        10000,													// Timeout - 10000 Milliseconds
                                        ME_IO_IRQ_WAIT_NO_FLAGS								);	// Flags

            if(i_me_error == ME_ERRNO_SUCCESS)
            {
                printf("Interrupt: IRQ Count: %d  Value: %d\n", i_irq_count, i_value);
            }
            else if(i_me_error == ME_ERRNO_TIMEOUT)
            {
                printf("**** Timeout ****\n");
            }
            else
            {
                printf("****    meIOIrqWait - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to stop monitoring interrupts\n");

                _getch();

                break;
            }
        }

        i_me_error = meIOIrqStop(	arrSubdevices[index_subdevice].m_iDeviceIndex,				// Device index
                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,			// Subdevice index
                                    0,															// Channel index
                                    ME_IO_IRQ_STOP_NO_FLAGS								);		// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOIrqStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Stopped monitoring interrupts\n\n");

        printf("Press any key to continue or ESC to exit\n\n");

        if(getch() == 27)
        {
            break;
        }
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("\n\nProgram completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOSingleReadAnalog C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOSingleReadAnalog C++ Testprogram

// Con_meIOSingleReadAnalog.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the AI sub-devices in the system

    int i_number_ai_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here
                                        &i_device_id,				// Device ID returned here
                                        &i_serial_no,				// Serial number returned here
                                        &i_bus_type,				// Bus type returned here
                                        &i_bus_no,					// Bus number returned here
                                        &i_dev_no,					// Bus device number returned here
                                        &i_func_no,					// Bus function number returned here
                                        &i_plugged				);	// Plugged status returned here

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ai_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ai_subdevices == 0)
    {
        printf("****    No AI sub-devices found in system   ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    };

    // Make a list of the AI sub-devices

    struct SAIRange
    {
        int		m_iUnit;

        double	m_dPhysicalMin;
        double	m_dPhysicalMax;

        int		m_iDigitalMax;
    };

#define MAX_RANGES	 16

    struct SAISubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iNumberOfChannels;

        int m_iNumberOfRanges;

        SAIRange m_arrRanges[MAX_RANGES];
    };

    SAISubddevice* arrSubdevices = new SAISubddevice[i_number_ai_subdevices];

    i_number_ai_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here
                                        &i_device_id,				// Device ID returned here
                                        &i_serial_no,				// Serial number returned here
                                        &i_bus_type,				// Bus type returned here
                                        &i_bus_no,					// Bus number returned here
                                        &i_dev_no,					// Bus device number returned here
                                        &i_func_no,					// Bus function number returned here
                                        &i_plugged				);	// Plugged status returned here

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ai_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ai_subdevices].m_iSubdeviceIndex = index_subdevice;

            int i_number_of_channels;

            i_me_error =  meQueryNumberChannels(index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                &i_number_of_channels	);			// Number of ramges returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberChannels - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            arrSubdevices[i_number_ai_subdevices].m_iNumberOfChannels = i_number_of_channels;

            int i_number_of_ranges;

            i_me_error =  meQueryNumberRanges(	index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                ME_UNIT_ANY,					// Unit
                                                &i_number_of_ranges	);			// Number of ramges returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberRanges - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            if(i_number_of_ranges > MAX_RANGES)
            {
                i_number_of_ranges = MAX_RANGES;
            }

            arrSubdevices[i_number_ai_subdevices].m_iNumberOfRanges = i_number_of_ranges;

            for(int index_range = 0; index_range < i_number_of_ranges; index_range++)
            {
                int i_unit;

                double d_phys_min;
                double d_phys_max;

                int i_digital_max;

                i_me_error = meQueryRangeInfo(	index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                index_range,					// Range index
                                                &i_unit,							// Unit returned here - not require
                                                &d_phys_min,					// Physical minimum returned here
                                                &d_phys_max,					// Physical maximum returned here
                                                &i_digital_max				);	// Digital maximum value returned here

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("****    meQueryRangeInfo - Error: %d    ****\n\n", i_me_error);

                    printf("Press any key to terminate\n");

                    _getch();

                    meClose(0);

                    return -1;
                }

                arrSubdevices[i_number_ai_subdevices].m_arrRanges[index_range].m_iUnit = i_unit;

                arrSubdevices[i_number_ai_subdevices].m_arrRanges[index_range].m_dPhysicalMin = d_phys_min;
                arrSubdevices[i_number_ai_subdevices].m_arrRanges[index_range].m_dPhysicalMax = d_phys_max;

                arrSubdevices[i_number_ai_subdevices].m_arrRanges[index_range].m_iDigitalMax = i_digital_max;
            }

            ++i_number_ai_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d AI sub-devices found: in System\n\n", i_number_ai_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ai_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d  Channels: %2d  Ranges: %2d\n\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                arrSubdevices[index_subdevice].m_iNumberOfChannels,
                arrSubdevices[index_subdevice].m_iNumberOfRanges		);
    }

    printf("Press any key to continue\n");

    getch();

    printf("\n\n");

    char buffer[512];

    bool b_terminate = false;

    while(true)
    {
        int index_subdevice;

        if(i_number_ai_subdevices > 1)
        {
            while(true)
            {
                printf("Choose Subdevice:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_ai_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d  Channels: %2d  Ranges: %2d\n",
                    index_subdevice + 1,
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    arrSubdevices[index_subdevice].m_iNumberOfChannels,
                    arrSubdevices[index_subdevice].m_iNumberOfRanges		);
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ai_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_ai_subdevices) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int index_channel;

        if(arrSubdevices[index_subdevice].m_iNumberOfChannels > 1)
        {
            while(true)
            {
                printf("Channel number (0 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfChannels - 1);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_channel) != 1 ) )
                {
                    continue;
                }

                if( (index_channel < 0)||(index_channel >= arrSubdevices[index_subdevice].m_iNumberOfChannels) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }
        }
        else
        {
            index_channel = 0;
        }

        int index_range;

        if(arrSubdevices[index_subdevice].m_iNumberOfRanges > 1)
        {
            while(true)
            {
                printf("Choose Range:\n\n");

                for(index_range = 0; index_range < arrSubdevices[index_subdevice].m_iNumberOfRanges; index_range++)
                {
                    printf("%2d.   %8.3f - %8.3f %s\n",
                    index_range + 1,
                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMin,
                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMax,
                    ( (arrSubdevices[index_subdevice].m_arrRanges[index_range].m_iUnit == ME_UNIT_VOLT) ? "  Volt" : "Ampere" ) );
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfRanges);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_range) != 1 ) )
                {
                    continue;
                }

                if( (index_range < 1)||(index_range > arrSubdevices[index_subdevice].m_iNumberOfRanges) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_range;
        }
        else
        {
            index_range = 0;
        }

        // Configure the device

        i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Subdevice index,
                                        index_channel,											// Channel index
                                        index_range,											// Range index
                                        ME_REF_AI_GROUND,										// Reference
                                        ME_TRIG_CHAN_DEFAULT,									// Trigger channel - standard
                                        ME_TRIG_TYPE_SW,										// Trigger type - software
                                        ME_VALUE_NOT_USED,										// Trigger edge - not applicable
                                        ME_IO_SINGLE_CONFIG_NO_FLAGS						);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        char buffer[128];

        while(true)
        {
            printf("Press any key to acquire a sample (ESC to terminate)\n");

            if(getch() == 27)
            {
                printf("\n\n");

                break;
            }

            meIOSingle_t io_single[1];

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= index_channel;
            io_single[0].iDir		= ME_DIR_INPUT;
            io_single[0].iValue		= 0;
            io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
            io_single[0].iFlags		= ME_IO_SINGLE_TYPE_NO_FLAGS;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            double d_physical_value;;

            i_me_error = meUtilityDigitalToPhysical(arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMin,		// Minimum physiacal value
                                                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMax,		// Maximum physical value
                                                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_iDigitalMax,		// Maximum digital value
                                                    io_single[0].iValue,														// Digital value to convert
                                                    ME_VALUE_NOT_USED,															// Module type - not required
                                                    0.0,																		// Reference value - not required
                                                    &d_physical_value														);	// Corresponding physical value returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meUtilityDigitalToPhysical - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Input %5.2lf V (%5d)\n\n", d_physical_value, io_single[0].iValue);
        }
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOSingleReadDigital C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOSingleReadDigital C++ Testprogram

// Con_meIOSingleReadDigital.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the DI and DIO sub-devices in the system

    int i_number_di_dio_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_di_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,					// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_di_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_di_dio_subdevices == 0)
    {
        printf("****    No DI or DIO sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the DI and DIO sub-devices

    struct SDigitalInSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iType;

        int m_iWidth;
    };

    SDigitalInSubddevice* arrSubdevices = new SDigitalInSubddevice[i_number_di_dio_subdevices];

    i_number_di_dio_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_di_dio_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_di_dio_subdevices].m_iSubdeviceIndex = index_subdevice;

            arrSubdevices[i_number_di_dio_subdevices].m_iType = ME_TYPE_DI;

            i_me_error = meQueryNumberChannels(	index_device,										// Device
                                                index_subdevice,									// Sub-device
                                                &arrSubdevices[i_number_di_dio_subdevices].m_iWidth	);	// Number of channels returned here

            ++i_number_di_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,					// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_di_dio_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_di_dio_subdevices].m_iSubdeviceIndex = index_subdevice;

            arrSubdevices[i_number_di_dio_subdevices].m_iType = ME_TYPE_DIO;

            i_me_error = meQueryNumberChannels(	index_device,										// Device
                                                index_subdevice,									// Sub-device
                                                &arrSubdevices[i_number_di_dio_subdevices].m_iWidth	);	// Number of channels returned here

            ++i_number_di_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d DI or DIO sub-devices found:\n\n", i_number_di_dio_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_di_dio_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d  Type: %s  Width: %2d Bits\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                ( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) ? "DIO" : " DI"),
                arrSubdevices[index_subdevice].m_iWidth										);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice;

        if(i_number_di_dio_subdevices > 1)
        {
            printf("Choose Subdevice:\n\n");

            for(index_subdevice = 0; index_subdevice < i_number_di_dio_subdevices; index_subdevice++)
            {
                printf("    %2d.   Device: %2d  Sub-device: %2d  Type: %s  Width: %2d Bits\n",
                        index_subdevice + 1,
                        arrSubdevices[index_subdevice].m_iDeviceIndex,
                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                        ( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) ? "DIO" : " DI"),
                        arrSubdevices[index_subdevice].m_iWidth										);
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_di_dio_subdevices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                break;
            }

            if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
            {
                continue;
            }

            if( (index_subdevice < 1)||(index_subdevice > i_number_di_dio_subdevices) )
            {
                continue;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int i_config_flags;

        int i_read_flags;

        switch(arrSubdevices[index_subdevice].m_iWidth)
        {
        case 1:

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_BIT;

            i_read_flags = ME_IO_SINGLE_TYPE_DIO_BIT;

            break;

        case 8:

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_BYTE;

            i_read_flags = ME_IO_SINGLE_TYPE_DIO_BYTE;

            break;

        case 16:

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_WORD;

            i_read_flags = ME_IO_SINGLE_TYPE_DIO_WORD;

            break;

        case 32:

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_DWORD;

            i_read_flags = ME_IO_SINGLE_TYPE_DIO_DWORD;

            break;
        }

        printf("Press any key to read data from Device: %d Subdevice: %d\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        getch();

        printf("\n\n");

        if(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO)
        {
            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevcie index
                                            0,													// Channel
                                            ME_SINGLE_CONFIG_DIO_INPUT,							// Single config
                                            ME_VALUE_NOT_USED,									// Reference
                                            ME_TRIG_CHAN_DEFAULT,								// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            i_config_flags									);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }
        }

        meIOSingle_t io_single[1];

        io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

        io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
        io_single[0].iChannel	= 0;
        io_single[0].iDir		= ME_DIR_INPUT;
        io_single[0].iValue		= 0;
        io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
        io_single[0].iFlags		= i_read_flags;

        i_me_error = meIOSingle(&io_single[0],				// Output list
                                1,							// Number of elements in the above list
                                ME_IO_SINGLE_NO_FLAGS	);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        char sz_hex_value[16];

        switch(arrSubdevices[index_subdevice].m_iWidth)
        {
        case 1:

            sprintf(&sz_hex_value[0], "%d", (io_single[0].iValue & 0x00000001) );

            break;

        case 8:

            sprintf(&sz_hex_value[0], "0x%02X", (unsigned char)(io_single[0].iValue & 0x000000FF) );

            break;

        case 16:

            sprintf(&sz_hex_value[0], "0x%04X", (unsigned short)(io_single[0].iValue & 0x0000FFFF) );

            break;

        case 32:

            sprintf(&sz_hex_value[0], "0x%08X", io_single[0].iValue);

            break;
        }

        printf("Read %s from Device: %d Subdevice: %d - press any key to continue\n", &sz_hex_value[0], arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        _getch();
    }

    delete []arrSubdevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOSingleWriteAnalog C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOSingleWriteAnalog C++ Testprogram

// Con_meIOSingleWriteAnalog.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the AO sub-devices in the system

    int i_number_ao_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ao_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ao_subdevices == 0)
    {
        printf("****    No AO sub-devices found in system   ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    };

    // Make a list of the AO sub-devices

    struct SAORange
    {
        int		m_iUnit;

        double	m_dPhysicalMin;
        double	m_dPhysicalMax;

        int		m_iDigitalMax;
    };

#define MAX_RANGES	 16

    struct SAOSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iNumberOfChannels;

        int m_iNumberOfRanges;

        SAORange m_arrRanges[MAX_RANGES];
    };

    SAOSubddevice* arrSubdevices = new SAOSubddevice[i_number_ao_subdevices];

    i_number_ao_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ao_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ao_subdevices].m_iSubdeviceIndex = index_subdevice;

            int i_number_of_channels;

            i_me_error =  meQueryNumberChannels(index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                &i_number_of_channels	);			// Number of ramges returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberRanges - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            arrSubdevices[i_number_ao_subdevices].m_iNumberOfChannels = i_number_of_channels;

            int i_number_of_ranges;

            i_me_error =  meQueryNumberRanges(	index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                ME_UNIT_ANY,					// Unit
                                                &i_number_of_ranges	);			// Number of ramges returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberRanges - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            if(i_number_of_ranges > MAX_RANGES)
            {
                i_number_of_ranges = MAX_RANGES;
            }

            arrSubdevices[i_number_ao_subdevices].m_iNumberOfRanges = i_number_of_ranges;

            for(int index_range = 0; index_range < i_number_of_ranges; index_range++)
            {
                int i_unit;

                double d_phys_min;
                double d_phys_max;

                int i_digital_max;

                i_me_error = meQueryRangeInfo(	index_device,					// Device index
                                                index_subdevice,				// Subdevice index,
                                                index_range,					// Range index
                                                &i_unit,							// Unit returned here - not require
                                                &d_phys_min,					// Physical minimum returned here
                                                &d_phys_max,					// Physical maximum returned here
                                                &i_digital_max				);	// Digital maximum value returned here

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("****    meQueryRangeInfo - Error: %d    ****\n\n", i_me_error);

                    printf("Press any key to terminate\n");

                    _getch();

                    meClose(0);

                    return -1;
                }

                arrSubdevices[i_number_ao_subdevices].m_arrRanges[index_range].m_iUnit = i_unit;

                arrSubdevices[i_number_ao_subdevices].m_arrRanges[index_range].m_dPhysicalMin = d_phys_min;
                arrSubdevices[i_number_ao_subdevices].m_arrRanges[index_range].m_dPhysicalMax = d_phys_max;

                arrSubdevices[i_number_ao_subdevices].m_arrRanges[index_range].m_iDigitalMax = i_digital_max;
            }

            ++i_number_ao_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d AO sub-devices found: in System\n\n", i_number_ao_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ao_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d  Channels: %2d  Ranges: %2d\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                arrSubdevices[index_subdevice].m_iNumberOfChannels,
                arrSubdevices[index_subdevice].m_iNumberOfRanges		);
    }

    printf("Press any key to continue\n");

    getch();

    printf("\n\n");

    char buffer[512];

    bool b_terminate = false;

    while(true)
    {
        int index_subdevice;

        if(i_number_ao_subdevices > 1)
        {
            while(true)
            {
                printf("Choose Subdevice:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_ao_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d  Channels: %2d  Ranges: %2d\n",
                    index_subdevice + 1,
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    arrSubdevices[index_subdevice].m_iNumberOfChannels,
                    arrSubdevices[index_subdevice].m_iNumberOfRanges		);
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ao_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_ao_subdevices) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_subdevice;
        }
        else
        {
            index_subdevice = 0;
        }

        int index_channel;

        if(arrSubdevices[index_subdevice].m_iNumberOfChannels > 1)
        {
            while(true)
            {
                printf("Channel number (0 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfChannels - 1);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_channel) != 1 ) )
                {
                    continue;
                }

                if( (index_channel < 0)||(index_channel >= arrSubdevices[index_subdevice].m_iNumberOfChannels) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }
        }
        else
        {
            index_channel = 0;
        }

        int index_range;

        if(arrSubdevices[index_subdevice].m_iNumberOfRanges > 1)
        {
            while(true)
            {
                printf("Choose Range:\n\n");

                for(index_range = 0; index_range < arrSubdevices[index_subdevice].m_iNumberOfRanges; index_range++)
                {
                    printf("%2d.   %8.3f - %8.3f %s\n",
                    index_range + 1,
                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMin,
                    arrSubdevices[index_subdevice].m_arrRanges[index_range].m_dPhysicalMax,
                    ( (arrSubdevices[index_subdevice].m_arrRanges[index_range].m_iUnit == ME_UNIT_VOLT) ? "  Volt" : "Ampere" ) );
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", arrSubdevices[index_subdevice].m_iNumberOfRanges);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_range) != 1 ) )
                {
                    continue;
                }

                if( (index_range < 1)||(index_range > arrSubdevices[index_subdevice].m_iNumberOfRanges) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            --index_range;
        }
        else
        {
            index_range = 0;
        }

        // Configure the device

        i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Subdevice index,
                                        index_channel,											// Channel index
                                        index_range,											// Range index
                                        ME_REF_AO_GROUND,										// Reference
                                        ME_TRIG_CHAN_DEFAULT,									// Trigger channel - standard
                                        ME_TRIG_TYPE_SW,										// Trigger type - software
                                        ME_VALUE_NOT_USED,										// Trigger edge - not applicable
                                        ME_IO_SINGLE_CONFIG_NO_FLAGS						);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        // Fetch the range information which will be required to convert from
        // physical units to a digital value for the output below

        double d_phys_min;

        double d_phys_max;

        int i_digital_max;

        i_me_error = meQueryRangeInfo(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Subdevice index,
                                        index_range,											// Range index
                                        NULL,													// Unit returned here - not require
                                        &d_phys_min,											// Physical minimum returned here
                                        &d_phys_max,											// Physical maximum returned here
                                        &i_digital_max										);	// Digital maximum value returned here

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meQueryRangeInfo - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        char buffer[128];

        while(true)
        {
            double d_value;

            printf("Output value V (%5.2lf  - %5.2lf) (RETURN to terminate): ", d_phys_min, d_phys_max);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                break;
            }

            if( (sscanf(&buffer[0], "%lf", &d_value) != 1 ) )
            {
                continue;
            }

            if( (d_value < d_phys_min)||(d_phys_max < d_value) )
            {
                continue;
            }

            int i_digital_value;

            i_me_error = meUtilityPhysicalToDigital(d_phys_min,				// Minimum physiacal value
                                                    d_phys_max,				// Maximum physical value
                                                    i_digital_max,			// Maximum digital value
                                                    d_value,				// Physical value to convert
                                                    &i_digital_value	);	// Corresponding digital value for meIOSingle returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meUtilityPhysicalToDigital - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            meIOSingle_t io_single[1];

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= index_channel;
            io_single[0].iDir		= ME_DIR_OUTPUT;
            io_single[0].iValue		= i_digital_value;
            io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
            io_single[0].iFlags		= ME_IO_SINGLE_TYPE_NO_FLAGS;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf(	"Output %5.2lf V (%5d) to Device: %2d  Sub-device: %2d\n\n\n",
                    d_value,
                    i_digital_value,
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex					);
        }
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOSingleWriteDigital C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOSingleWriteDigital C++ Testprogram

// Con_meIOSingleWriteDigital.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the DO and DIO sub-devices in the system

    int i_number_do_dio_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_do_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,					// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_do_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_do_dio_subdevices == 0)
    {
        printf("****    No DO or DIO sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the DO and DIO sub-devices

    struct SDigitalOutSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;

        int m_iType;

        int m_iWidth;

        int m_bDOSinkSource;
    };

    SDigitalOutSubddevice* arrSubdevices = new SDigitalOutSubddevice[i_number_do_dio_subdevices];

    i_number_do_dio_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_do_dio_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_do_dio_subdevices].m_iSubdeviceIndex = index_subdevice;

            arrSubdevices[i_number_do_dio_subdevices].m_iType = ME_TYPE_DO;

            i_me_error = meQueryNumberChannels(	index_device,											// Device
                                                index_subdevice,										// Sub-device
                                                &arrSubdevices[i_number_do_dio_subdevices].m_iWidth	);	// Number of channels returned here

            int i_caps = 0;

            i_me_error = meQuerySubdeviceCaps(	index_device,			// Device
                                                index_subdevice,		// Sub-device
                                                &i_caps				);	// Number of channels returned here

            if( (i_caps & ME_CAPS_DIO_SINK_SOURCE) ==  ME_CAPS_DIO_SINK_SOURCE )
            {
                arrSubdevices[i_number_do_dio_subdevices].m_bDOSinkSource = 1;
            }
            else
            {
                arrSubdevices[i_number_do_dio_subdevices].m_bDOSinkSource = 0;
            }

            ++i_number_do_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }

        index_subdevice = 0;

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_DIO,					// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_do_dio_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_do_dio_subdevices].m_iSubdeviceIndex = index_subdevice;

            arrSubdevices[i_number_do_dio_subdevices].m_iType = ME_TYPE_DIO;

            i_me_error = meQueryNumberChannels(	index_device,											// Device
                                                index_subdevice,										// Sub-device
                                                &arrSubdevices[i_number_do_dio_subdevices].m_iWidth	);	// Number of channels returned here

            arrSubdevices[i_number_do_dio_subdevices].m_bDOSinkSource = 0;

            ++i_number_do_dio_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d DO or DIO sub-devices found:\n\n", i_number_do_dio_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_do_dio_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d  Type: %s  Width: %2d Bits\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                ( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) ? "DIO" : " DO"),
                arrSubdevices[index_subdevice].m_iWidth										);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice;

        bool b_terminate = false;

        while(true)
        {
            printf("Choose sub-device:\n\n");

            for(index_subdevice = 0; index_subdevice < i_number_do_dio_subdevices; index_subdevice++)
            {
                printf("    %2d.   Device: %2d  Sub-device: %2d  Type: %s  Width: %2d Bits\n",
                        index_subdevice + 1,
                        arrSubdevices[index_subdevice].m_iDeviceIndex,
                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                        ( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO) ? "DIO" : " DO"),
                        arrSubdevices[index_subdevice].m_iWidth										);
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_do_dio_subdevices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
            {
                continue;
            }

            if( (index_subdevice < 1)||(index_subdevice > i_number_do_dio_subdevices) )
            {
                continue;
            }

            --index_subdevice;

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int i_output_config;

        if( (arrSubdevices[index_subdevice].m_iType == ME_TYPE_DO)&&(arrSubdevices[index_subdevice].m_bDOSinkSource != 0) )
        {
            int i_index_config = 0;

            while(true)
            {
                printf("Choose output configuration:\n\n");

                printf(	"1.  High Impedance\n"
                        "2.  Sink\n"
                        "3.  Source\n"			);

                printf("\nYour choice (1 - 3) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_index_config) != 1 ) )
                {
                    continue;
                }

                if( (i_index_config < 1)||(i_index_config > 3) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            switch(i_index_config)
            {
            case 1:

                i_output_config = ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE;

                break;

            case 2:

                i_output_config = ME_SINGLE_CONFIG_DIO_SINK;

                break;

            case 3:

                i_output_config = ME_SINGLE_CONFIG_DIO_SOURCE;

                break;
            }
        }

        int i_hex_value;

        while(true)
        {
            printf("Value (Hex) to output (RETURN to terminate): 0x");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%X", &i_hex_value) != 1 ) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        char sz_hex_value[16];

        int i_config_flags;

        int i_write_flags;

        switch(arrSubdevices[index_subdevice].m_iWidth)
        {
        case 1:

            sprintf(&sz_hex_value[0], "%d", (i_hex_value & 0x00000001) );

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_BIT;

            i_write_flags = ME_IO_SINGLE_TYPE_DIO_BIT;

            break;

        case 8:

            sprintf(&sz_hex_value[0], "0x%02X", (unsigned char)(i_hex_value & 0x000000FF) );

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_BYTE;

            i_write_flags = ME_IO_SINGLE_TYPE_DIO_BYTE;

            break;

        case 16:

            sprintf(&sz_hex_value[0], "0x%04X", (unsigned short)(i_hex_value & 0x0000FFFF) );

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_WORD;

            i_write_flags = ME_IO_SINGLE_TYPE_DIO_WORD;

            break;

        case 32:

            sprintf(&sz_hex_value[0], "0x%08X", i_hex_value);

            i_config_flags = ME_IO_SINGLE_CONFIG_DIO_DWORD;

            i_write_flags = ME_IO_SINGLE_TYPE_DIO_DWORD;

            break;
        }

        printf("Press any key to output %s to Device: %d Subdevice: %d\n", &sz_hex_value[0], arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        getch();

        printf("\n\n");

        if(arrSubdevices[index_subdevice].m_iType == ME_TYPE_DIO)
        {
            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevcie index
                                            0,													// Channel
                                            ME_SINGLE_CONFIG_DIO_OUTPUT,						// Single config
                                            ME_VALUE_NOT_USED,									// Reference
                                            ME_TRIG_CHAN_DEFAULT,								// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            i_config_flags									);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }
        }
        else
        {
            if(arrSubdevices[index_subdevice].m_bDOSinkSource != 0)
            {
                i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                                arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevcie index
                                                0,													// Channel
                                                i_output_config,									// Single config
                                                ME_VALUE_NOT_USED,									// Reference
                                                ME_VALUE_NOT_USED,									// Trigger channel
                                                ME_VALUE_NOT_USED,									// Trigger type
                                                ME_VALUE_NOT_USED,									// Trigger edge
                                                i_config_flags									);	// Flags

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                    printf("Press any key to terminate\n");

                    _getch();

                    meClose(0);

                    return -1;
                }
            }
        }

        meIOSingle_t io_single[1];

        io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

        io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
        io_single[0].iChannel	= 0;
        io_single[0].iDir		= ME_DIR_OUTPUT;
        io_single[0].iValue		= i_hex_value;
        io_single[0].iTimeOut	= 0;							// No timeout - not required for software output
        io_single[0].iFlags		= i_write_flags;

        i_me_error = meIOSingle(&io_single[0],				// Output list
                                1,							// Number of elements in the above list
                                ME_IO_SINGLE_NO_FLAGS	);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("%s output to Device: %d Subdevice: %d - press any key to continue\n", &sz_hex_value[0], arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

        _getch();
    }

    delete []arrSubdevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamRead C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamRead C++ Testprogram

// Con_meIOStreamRead.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device	= -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                            0,								// Begin search at this sub-device
                                            ME_TYPE_AI,						// Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                            &i_stream_read_subdevice	);	// sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    int i_acq_ticks_low = 0;
    int i_acq_ticks_high = 0;

    double d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,							// Device index
                                        i_stream_read_subdevice,						// Subdevice indexe,
                                        ME_TIMER_ACQ_START,					// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_acq_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_acq_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_required_freq = 10.0;
    double d_achieved_freq = d_required_freq;

    int i_scan_ticks_low = 0;
    int i_scan_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,				// Device index
                                            i_stream_read_subdevice,			// Subdevice indexe,
                                            ME_TIMER_SCAN_START,				// Timer used
                                            &d_achieved_freq,					// Required frequency Hz, Achieved frequency returned here
                                            &i_scan_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                            &i_scan_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %f Achieved Freq: %f Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_scan_ticks_low, i_scan_ticks_high);

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,				// Device index
                                        i_stream_read_subdevice,			// Subdevice indexe,
                                        ME_TIMER_CONV_START,				// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_conv_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_conv_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    meIOStreamConfig_t arr_stream_config[1];

    arr_stream_config[0].iChannel = 0;

    arr_stream_config[0].iStreamConfig = 0;
    arr_stream_config[0].iRef = ME_REF_AI_GROUND;
    arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

    // int iAcqStartTrigEdge;
    stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;
    stream_trigger.iAcqStartTicksLow = i_acq_ticks_low;
    stream_trigger.iAcqStartTicksHigh = i_acq_ticks_high;
    // int iAcqStartArgs[10];
    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iScanStartTicksLow = i_scan_ticks_low;
    stream_trigger.iScanStartTicksHigh = i_scan_ticks_high;
    //int iScanStartArgs[10];
    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;
    //int iConvStartArgs[10];
    // int iScanStopTrigType;
    // int iScanStopCount;
    // int iScanStopArgs[10];
    // int iAcqStopTrigType;
    // int iAcqStopCount;
    // int iAcqStopArgs[10];
    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(	i_stream_read_device,				// Device index
                                    i_stream_read_subdevice,			// Subdevice index,
                                     &arr_stream_config[0],				// Pointer to an array of meIOStreamConfig_t structures
                                    1,									// Number of elements in the stream config array above
                                    &stream_trigger,					// Pointer to an meIOStreamTrigger_t structure
                                    2,									// FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_phys_min;

    double d_phys_max;

    int i_digital_max;

    i_me_error = meQueryRangeInfo(	i_stream_read_device,		// Device index
                                    i_stream_read_subdevice,	// Subdevice index,
                                    0,							// Range index
                                    NULL,						// Unit returned here - not require
                                    &d_phys_min,				// Physical minimum returned here
                                    &d_phys_max,				// Physical maximum returned here
                                    &i_digital_max			);	// Digital maximum value returned here

    printf("d_phys_min: %lf d_phys_max: %lf i_digital_max: %d\n\n", d_phys_min,	d_phys_max,	i_digital_max);

    printf("Press any key to start the acquisition\n\n");

    printf("Press the ESC key at any time to end the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                    1,								// Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    while(true)
    {
        if( _kbhit() != 0 )
        {
            if(_getch() == 27)
            {
                break;
            }
        }

        int i_buffer[4096];

        int i_count = 10;

        i_me_error = meIOStreamRead(i_stream_read_device,			// Device index
                                    i_stream_read_subdevice,		// Subdevice index,
                                    ME_READ_MODE_BLOCKING,			// Read mode
                                    &i_buffer[0],					// Acquired data values returned in this buffer
                                    &i_count,						// Size of buffer in data values - Number of data values returned here
                                    ME_IO_STREAM_READ_NO_FLAGS);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to end the acquisition\n");

            _getch();

            break;
        }

        for(int index_value = 0; index_value < i_count; index_value++)
        {
            double d_volt;

            i_me_error =  meUtilityDigitalToPhysical(	d_phys_min,							// Min physical value
                                                        d_phys_max,							// Max physical value
                                                        i_digital_max,						// Maximum digital value
                                                        i_buffer[index_value],				// Digital value to convert
                                                        ME_MODULE_TYPE_MULTISIG_NONE,		// Module type - not used
                                                        0.0,								// Reference value - not used
                                                        &d_volt							);	// Converted physical value returned here

            printf("%5d  -  %5.2lf V\n", i_buffer[index_value], d_volt);
        }
    }

    meIOStreamStop_t arr_stream_stop[1];

    arr_stream_stop[0].iDevice = i_stream_read_device;
    arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
    arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
    arr_stream_stop[0].iErrno = 0;

    i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                1,								// Number of elements in the stream stop array above
                                ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return(-1);
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamRead5200 C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamRead5200 C++ Testprogram

// Con_meIOStreamRead.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device    = -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice( index_device,               // Device index
                                        &i_vendor_id,               // Vendor ID returned here - not required
                                        &i_device_id,               // Device ID returned here - not required
                                        &i_serial_no,               // Serial number returned here - not required
                                        &i_bus_type,                // Bus type returned here - not required
                                        &i_bus_no,                  // Bus number returned here - not required
                                        &i_dev_no,                  // Bus device number returned here - not required
                                        &i_func_no,                 // Bus function number returned here - not required
                                        &i_plugged              );  // Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,                   // Device
                                            0,                              // Begin search at this sub-device
                                            ME_TYPE_AI,                     // Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,           // Sub-type of sub-device to search for
                                            &i_stream_read_subdevice    );  // sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    double d_required_freq = 10.0;
    double d_achieved_freq = d_required_freq;

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,               // Device index
                                            i_stream_read_subdevice,            // Subdevice indexe,
                                            ME_TIMER_CONV_START,                // Timer used
                                            &d_achieved_freq,                   // Required time seconds, Achieved time returned here
                                            &i_conv_ticks_low,                  // Lower 32 bits of the corresponding tick value returned here
                                            &i_conv_ticks_high,                 // Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %lf Achieved Freq: %lf Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_conv_ticks_low, i_conv_ticks_high);

    meIOStreamConfig_t arr_stream_config[1];

    arr_stream_config[0].iChannel = 0;

    arr_stream_config[0].iStreamConfig = 0;
    arr_stream_config[0].iRef = ME_REF_AI_GROUND;
    arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;
    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;

    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;

    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(  i_stream_read_device,               // Device index
                                    i_stream_read_subdevice,            // Subdevice index,
                                    &arr_stream_config[0],              // Pointer to an array of meIOStreamConfig_t structures
                                    1,                                  // Number of elements in the stream config array
                                    &stream_trigger,                    // Pointer to an meIOStreamTrigger_t structure
                                    2,                                  // FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS    );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_phys_min;

    double d_phys_max;

    int i_digital_max;

    i_me_error = meQueryRangeInfo(  i_stream_read_device,       // Device index
                                    i_stream_read_subdevice,    // Subdevice index,
                                    0,                          // Range index
                                    NULL,                       // Unit returned here - not required
                                    &d_phys_min,                // Physical minimum returned here
                                    &d_phys_max,                // Physical maximum returned here
                                    &i_digital_max          );  // Digital maximum value returned here

    printf("d_phys_min: %lf d_phys_max: %lf i_digital_max: %d\n\n", d_phys_min, d_phys_max, i_digital_max);

    printf("Press any key to start the acquisition\n\n");

    printf("Press the ESC key at any time to end the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(   &arr_stream_start[0],           // Pointer to an array of meIOStreamStart_t structures
                                    1,                              // Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    while(true)
    {
        if( _kbhit() != 0 )
        {
            if(_getch() == 27)
            {
                break;
            }
        }

        int i_buffer[4096];

        int i_count = 10;

        i_me_error = meIOStreamRead(i_stream_read_device,           // Device index
                                    i_stream_read_subdevice,        // Subdevice index,
                                    ME_READ_MODE_BLOCKING,          // Read mode
                                    &i_buffer[0],                   // Acquired data values returned in this buffer
                                    &i_count,                       // Size of buffer in data values - Number of data values returned here
                                    ME_IO_STREAM_READ_NO_FLAGS);    // No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to end the acquisition\n");

            _getch();

            break;
        }

        for(int index_value = 0; index_value < i_count; index_value++)
        {
            double d_volt;

            i_me_error =  meUtilityDigitalToPhysical(   d_phys_min,                         // Min physical value
                                                        d_phys_max,                         // Max physical value
                                                        i_digital_max,                      // Maximum digital value
                                                        i_buffer[index_value],              // Digital value to convert
                                                        ME_MODULE_TYPE_MULTISIG_NONE,       // Module type - not used
                                                        0.0,                                // Reference value - not used
                                                        &d_volt                         );  // Converted physical value returned here

            printf("%5d  -  %5.2lf V\n", i_buffer[index_value], d_volt);
        }
    }

    meIOStreamStop_t arr_stream_stop[1];

    arr_stream_stop[0].iDevice = i_stream_read_device;
    arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
    arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
    arr_stream_stop[0].iErrno = 0;

    i_me_error = meIOStreamStop(&arr_stream_stop[0],            // Pointer to an array of meIOStreamStop_t structures
                                1,                              // Number of elements in the stream stop array above
                                ME_IO_STREAM_STOP_NO_FLAGS);    // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return(-1);
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamReadCallbacks C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamReadCallbacks C++ Testprogram

// Con_meIOStreamReadCallbacks.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

// Forward declarations for the callback functions

int _stdcall StreamReadStartCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);
int _stdcall StreamReadNewValuesCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);
int _stdcall StreamReadEndCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);

struct SRange
{
    double m_dPhysicalMin;

    double m_dPhysicalMax;

    int m_iDigitalMax;
}
sChannelRange;

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device	= -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,					// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                            0,								// Begin search at this sub-device
                                            ME_TYPE_AI,						// Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                            &i_stream_read_subdevice	);	// sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    // Set callbacks

    i_me_error = meIOStreamSetCallbacks(i_stream_read_device,					// Device index
                                        i_stream_read_subdevice,				// Subdevice index
                                        StreamReadStartCallback,				// Start callback
                                        NULL,									// Start callback context
                                        StreamReadNewValuesCallback,			// New values callback
                                        &sChannelRange,							// New values callback context
                                        StreamReadEndCallback,					// End callback
                                        NULL,									// End callback context
                                        ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS	);	// Flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamSetCallbacks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    int i_acq_ticks_low = 0;
    int i_acq_ticks_high = 0;

    double d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,							// Device index
                                        i_stream_read_subdevice,						// Subdevice indexe,
                                        ME_TIMER_ACQ_START,					// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_acq_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_acq_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_required_freq = 100.0;
    double d_achieved_freq = d_required_freq;

    int i_scan_ticks_low = 0;
    int i_scan_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,				// Device index
                                            i_stream_read_subdevice,			// Subdevice indexe,
                                            ME_TIMER_SCAN_START,				// Timer used
                                            &d_achieved_freq,					// Required frequency Hz, Achieved frequency returned here
                                            &i_scan_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                            &i_scan_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %lf Achieved Freq: %lf Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_scan_ticks_low, i_scan_ticks_high);

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,				// Device index
                                        i_stream_read_subdevice,			// Subdevice indexe,
                                        ME_TIMER_CONV_START,				// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_conv_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_conv_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    meIOStreamConfig_t arr_stream_config[1];

    arr_stream_config[0].iChannel = 0;

    arr_stream_config[0].iStreamConfig = 0;
    arr_stream_config[0].iRef = ME_REF_AI_GROUND;
    arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

    // int iAcqStartTrigEdge;
    stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;
    stream_trigger.iAcqStartTicksLow = i_acq_ticks_low;
    stream_trigger.iAcqStartTicksHigh = i_acq_ticks_high;
    // int iAcqStartArgs[10];
    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iScanStartTicksLow = i_scan_ticks_low;
    stream_trigger.iScanStartTicksHigh = i_scan_ticks_high;
    //int iScanStartArgs[10];
    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;
    //int iConvStartArgs[10];
    // int iScanStopTrigType;
    // int iScanStopCount;
    // int iScanStopArgs[10];
    // int iAcqStopTrigType;
    // int iAcqStopCount;
    // int iAcqStopArgs[10];
    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(	i_stream_read_device,				// Device index
                                    i_stream_read_subdevice,			// Subdevice index,
                                     &arr_stream_config[0],				// Pointer to an array of meIOStreamConfig_t structures
                                    1,									// Number of elements in the stream config array above
                                    &stream_trigger,					// Pointer to an meIOStreamTrigger_t structure
                                    10, 								// FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    i_me_error = meQueryRangeInfo(	i_stream_read_device,				// Device index
                                    i_stream_read_subdevice,			// Subdevice index,
                                    0,									// Range index
                                    NULL,								// Unit returned here - not require
                                    &sChannelRange.m_dPhysicalMin,		// Physical minimum returned here
                                    &sChannelRange.m_dPhysicalMax,		// Physical maximum returned here
                                    &sChannelRange.m_iDigitalMax	);	// Digital maximum value returned here

    printf("Press any key to start the acquisition\n\n");

    printf("Press the ESC key at any time to end the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                    1,								// Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    while(true)
    {
        if( _kbhit() != 0 )
        {
            if(_getch() == 27)
            {
                break;
            }
        }
    }

    meIOStreamStop_t arr_stream_stop[1];

    arr_stream_stop[0].iDevice = i_stream_read_device;
    arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
    arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
    arr_stream_stop[0].iErrno = 0;

    i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                1,								// Number of elements in the stream stop array above
                                ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the aquisition\n");

        _getch();

        meClose(0);

        return(-1);
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}

int _stdcall StreamReadStartCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadStartCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    return(0);
}

int _stdcall StreamReadNewValuesCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadNewValuesCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    SRange* p_range = (SRange*)pvContext;

    int i_buffer[4096];

    int i_count = 100;

    int i_me_error;

    i_me_error = meIOStreamRead(iDevice,						// Device index
                                iSubdevice,						// Subdevice index,
                                ME_READ_MODE_BLOCKING,			// Read mode
                                &i_buffer[0],					// Acquired data values returned in this buffer
                                &i_count,						// Size of buffer in data values - Number of data values returned here
                                ME_IO_STREAM_READ_NO_FLAGS);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the acquisition\n");

        _getch();

        return(-1);;
    }

    for(int index_value = 0; index_value < i_count; index_value++)
    {
        double d_volt;

        i_me_error =  meUtilityDigitalToPhysical(	p_range->m_dPhysicalMin,			// Min physical value
                                                    p_range->m_dPhysicalMax,			// Max physical value
                                                    p_range->m_iDigitalMax,				// Maximum digital value
                                                    i_buffer[index_value],				// Digital value to convert
                                                    ME_MODULE_TYPE_MULTISIG_NONE,		// Module type - not used
                                                    0.0,								// Reference value - not used
                                                    &d_volt							);	// Converted physical value returned here

        printf("%5d - %5.2lf V\n", i_buffer[index_value], d_volt);
    }

    return(0);
}

int _stdcall StreamReadEndCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadEndCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    return(0);
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamReadCallbacks5200 C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamReadCallbacks5200 C++ Testprogram

// Con_meIOStreamReadCallbacks.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

// Forward declarations for the callback functions

int _stdcall StreamReadStartCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);
int _stdcall StreamReadNewValuesCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);
int _stdcall StreamReadEndCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode);

struct SRange
{
    double m_dPhysicalMin;

    double m_dPhysicalMax;

    int m_iDigitalMax;
}
sChannelRange;

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device    = -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice( index_device,               // Device index
                                        &i_vendor_id,               // Vendor ID returned here - not required
                                        &i_device_id,               // Device ID returned here - not required
                                        &i_serial_no,               // Serial number returned here - not required
                                        &i_bus_type,                    // Bus type returned here - not required
                                        &i_bus_no,                  // Bus number returned here - not required
                                        &i_dev_no,                  // Bus device number returned here - not required
                                        &i_func_no,                 // Bus function number returned here - not required
                                        &i_plugged              );  // Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,                   // Device
                                            0,                              // Begin search at this sub-device
                                            ME_TYPE_AI,                     // Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,           // Sub-type of sub-device to search for
                                            &i_stream_read_subdevice    );  // sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    // Set callbacks

    i_me_error = meIOStreamSetCallbacks(i_stream_read_device,                   // Device index
                                        i_stream_read_subdevice,                // Subdevice index
                                        StreamReadStartCallback,                // Start callback
                                        NULL,                                   // Start callback context
                                        StreamReadNewValuesCallback,            // New values callback
                                        &sChannelRange,                         // New values callback context
                                        StreamReadEndCallback,                  // End callback
                                        NULL,                                   // End callback context
                                        ME_IO_STREAM_SET_CALLBACKS_NO_FLAGS );  // Flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamSetCallbacks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_required_freq = 100.0;
    double d_achieved_freq = d_required_freq;

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,               // Device index
                                            i_stream_read_subdevice,            // Subdevice indexe,
                                            ME_TIMER_CONV_START,                // Timer used
                                            &d_achieved_freq,                   // Required time seconds, Achieved time returned here
                                            &i_conv_ticks_low,                  // Lower 32 bits of the corresponding tick value returned here
                                            &i_conv_ticks_high,                 // Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %lf Achieved Freq: %lf Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_conv_ticks_low, i_conv_ticks_high);

    meIOStreamConfig_t arr_stream_config[1];

    arr_stream_config[0].iChannel = 0;

    arr_stream_config[0].iStreamConfig = 0;
    arr_stream_config[0].iRef = ME_REF_AI_GROUND;
    arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;

    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;

    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(  i_stream_read_device,               // Device index
                                    i_stream_read_subdevice,            // Subdevice index,
                                    &arr_stream_config[0],              // Pointer to an array of meIOStreamConfig_t structures
                                    1,                                  // Number of elements in the stream config array above
                                    &stream_trigger,                    // Pointer to an meIOStreamTrigger_t structure
                                    10,                                 // FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS    );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    i_me_error = meQueryRangeInfo(  i_stream_read_device,               // Device index
                                    i_stream_read_subdevice,            // Subdevice index,
                                    0,                                  // Range index
                                    NULL,                               // Unit returned here - not require
                                    &sChannelRange.m_dPhysicalMin,      // Physical minimum returned here
                                    &sChannelRange.m_dPhysicalMax,      // Physical maximum returned here
                                    &sChannelRange.m_iDigitalMax    );  // Digital maximum value returned here

    printf("Press any key to start the acquisition\n\n");

    printf("Press the ESC key at any time to end the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(   &arr_stream_start[0],           // Pointer to an array of meIOStreamStart_t structures
                                    1,                              // Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    while(true)
    {
        if( _kbhit() != 0 )
        {
            if(_getch() == 27)
            {
                break;
            }
        }
    }

    meIOStreamStop_t arr_stream_stop[1];

    arr_stream_stop[0].iDevice = i_stream_read_device;
    arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
    arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
    arr_stream_stop[0].iErrno = 0;

    i_me_error = meIOStreamStop(&arr_stream_stop[0],            // Pointer to an array of meIOStreamStop_t structures
                                1,                              // Number of elements in the stream stop array above
                                ME_IO_STREAM_STOP_NO_FLAGS);    // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the aquisition\n");

        _getch();

        meClose(0);

        return(-1);
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}

int _stdcall StreamReadStartCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadStartCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    return(0);
}

int _stdcall StreamReadNewValuesCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadNewValuesCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    SRange* p_range = (SRange*)pvContext;

    int i_buffer[4096];

    int i_count = 100;

    int i_me_error;

    i_me_error = meIOStreamRead(iDevice,                        // Device index
                                iSubdevice,                     // Subdevice index,
                                ME_READ_MODE_BLOCKING,          // Read mode
                                &i_buffer[0],                   // Acquired data values returned in this buffer
                                &i_count,                       // Size of buffer in data values - Number of data values returned here
                                ME_IO_STREAM_READ_NO_FLAGS);    // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the acquisition\n");

        _getch();

        return(-1);;
    }

    for(int index_value = 0; index_value < i_count; index_value++)
    {
        double d_volt;

        i_me_error =  meUtilityDigitalToPhysical(   p_range->m_dPhysicalMin,            // Min physical value
                                                    p_range->m_dPhysicalMax,            // Max physical value
                                                    p_range->m_iDigitalMax,             // Maximum digital value
                                                    i_buffer[index_value],              // Digital value to convert
                                                    ME_MODULE_TYPE_MULTISIG_NONE,       // Module type - not used
                                                    0.0,                                // Reference value - not used
                                                    &d_volt                         );  // Converted physical value returned here

        printf("%5d - %5.2lf V\n", i_buffer[index_value], d_volt);
    }

    return(0);
}

int _stdcall StreamReadEndCallback(int iDevice, int iSubdevice, int iCount, void *pvContext, int iErrorCode)
{
    printf("StreamReadEndCallback called - iDevice: %d, iSubdevice: %d, iCount: %d, pvContext: %p, iErrorCode: %d\n\n",
                                                                        iDevice, iSubdevice, iCount, pvContext, iErrorCode);

    return(0);
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamReadScan C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamReadScan C++ Testprogram

// Con_meIOStreamReadScan.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

#include <windows.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

#define ACQUIRE_CHANNEL_LISTS	200

#define NUMBER_OF_CHANNELS	    4

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device	= -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,					// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                            0,								// Begin search at this sub-device
                                            ME_TYPE_AI,						// Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                            &i_stream_read_subdevice	);	// sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    int i_acq_ticks_low = 0;
    int i_acq_ticks_high = 0;

    double d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,				// Device index
                                        i_stream_read_subdevice,			// Subdevice indexe,
                                        ME_TIMER_ACQ_START,					// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_acq_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_acq_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_required_freq = 10.0;
    double d_achieved_freq = d_required_freq;

    int i_scan_ticks_low = 0;
    int i_scan_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,				// Device index
                                            i_stream_read_subdevice,			// Subdevice indexe,
                                            ME_TIMER_SCAN_START,				// Timer used
                                            &d_achieved_freq,					// Required frequency Hz, Achieved frequency returned here
                                            &i_scan_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                            &i_scan_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %f Achieved Freq: %f Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_scan_ticks_low, i_scan_ticks_high);

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    d_time = 0.0;

    i_me_error = meIOStreamTimeToTicks(	i_stream_read_device,				// Device index
                                        i_stream_read_subdevice,			// Subdevice indexe,
                                        ME_TIMER_CONV_START,				// Timer used
                                        &d_time,							// Required time seconds, Achieved time returned here
                                        &i_conv_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                        &i_conv_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                        ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    meIOStreamConfig_t arr_stream_config[NUMBER_OF_CHANNELS];

    for(int index_channel = 0; index_channel < NUMBER_OF_CHANNELS; index_channel++)
    {
        arr_stream_config[index_channel].iChannel = index_channel;

        arr_stream_config[index_channel].iStreamConfig = 0;
        arr_stream_config[index_channel].iRef = ME_REF_AI_GROUND;
        arr_stream_config[index_channel].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;
    }

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

    // int iAcqStartTrigEdge;
    stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;
    stream_trigger.iAcqStartTicksLow = i_acq_ticks_low;
    stream_trigger.iAcqStartTicksHigh = i_acq_ticks_high;
    // int iAcqStartArgs[10];
    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iScanStartTicksLow = i_scan_ticks_low;
    stream_trigger.iScanStartTicksHigh = i_scan_ticks_high;
    //int iScanStartArgs[10];
    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;
    //int iConvStartArgs[10];
    stream_trigger.iScanStopTrigType = ME_TRIG_TYPE_NONE;
    // int iScanStopCount;
    // int iScanStopArgs[10];
    stream_trigger.iAcqStopTrigType = ME_TRIG_TYPE_COUNT;
    stream_trigger.iAcqStopCount = ACQUIRE_CHANNEL_LISTS;
    // int iAcqStopArgs[10];
    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(	i_stream_read_device,				// Device index
                                    i_stream_read_subdevice,			// Subdevice index,
                                     &arr_stream_config[0],				// Pointer to an array of meIOStreamConfig_t structures
                                    NUMBER_OF_CHANNELS,					// Number of elements in the stream config array above
                                    &stream_trigger,					// Pointer to an meIOStreamTrigger_t structure
                                    2,									// FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_phys_min;

    double d_phys_max;

    int i_digital_max;

    i_me_error = meQueryRangeInfo(	i_stream_read_device,		// Device index
                                    i_stream_read_subdevice,	// Subdevice index,
                                    0,							// Range index
                                    NULL,						// Unit returned here - not require
                                    &d_phys_min,				// Physical minimum returned here
                                    &d_phys_max,				// Physical maximum returned here
                                    &i_digital_max			);	// Digital maximum value returned here

    printf("d_phys_min: %lf d_phys_max: %lf i_digital_max: %d\n\n", d_phys_min,	d_phys_max,	i_digital_max);

    printf("Press any key to start the acquisition\n\n");

    printf("Press the ESC key at any time to end the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                    1,								// Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS	);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    int i_count;

    while(true)
    {
        int i_status;

        i_me_error = meIOStreamStatus(	i_stream_read_device,				// Device index
                                        i_stream_read_subdevice,			// Subdevice index,
                                        ME_WAIT_NONE,						// Return immediately
                                        &i_status,							// Status returned here
                                        &i_count,							// Count returned here
                                        ME_IO_STREAM_STATUS_NO_FLAGS	);	// Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to end the acquisition\n");

            _getch();

            meIOStreamStop_t arr_stream_stop[1];

            arr_stream_stop[0].iDevice = i_stream_read_device;
            arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
            arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
            arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
            arr_stream_stop[0].iErrno = 0;

            i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                        1,								// Number of elements in the stream stop array above
                                        ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return(-1);
            }

            break;
        }

        if(i_status == ME_STATUS_BUSY)
        {
            printf("Acquisition running - Count: %d\n", i_count);
        }
        else if(i_status == ME_STATUS_IDLE)
        {
            printf("Acquisition ended - Count: %d\n", i_count);

            break;
        }
        else
        {
            printf("Unknown status: 0x%08X - Count: %d\n", i_status, i_count);
        }

        Sleep(400);
    }

    // The acquisition should stop after exactly ACQUIRE_CHANNEL_LISTS channel lists
    // have been acquired. This means after ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS
    // values have been acquired.
    //
    // We check this here and print an error message if it is not the case.

    if(i_count != ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS)
    {
        printf("****    Number of values incorrect should be: %d, is: %d    ****\n\n", ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS, i_count);

        printf("Press any key to continue\n");

        _getch();

        if(i_count > ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS)
        {
            i_count = ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS;
        }
    }

    int i_buffer[ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS];

    i_me_error = meIOStreamRead(i_stream_read_device,			// Device index
                                i_stream_read_subdevice,		// Subdevice index,
                                ME_READ_MODE_NONBLOCKING,		// Read mode
                                &i_buffer[0],					// Acquired data values returned in this buffer
                                &i_count,						// Size of buffer in data values - Number of data values returned here
                                ME_IO_STREAM_READ_NO_FLAGS);	// No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the acquisition\n");

        _getch();

        return(-1);
    }

    for(int index_value = 0; index_value < i_count; index_value++)
    {
        double d_volt;

        i_me_error =  meUtilityDigitalToPhysical(	d_phys_min,							// Min physical value
                                                    d_phys_max,							// Max physical value
                                                    i_digital_max,						// Maximum digital value
                                                    i_buffer[index_value],				// Digital value to convert
                                                    ME_MODULE_TYPE_MULTISIG_NONE,		// Module type - not used
                                                    0.0,								// Reference value - not used
                                                    &d_volt							);	// Converted physical value returned here

        printf("%5d - %5.2lf V    ", i_buffer[index_value], d_volt);

        if( ( (index_value + 1) % NUMBER_OF_CHANNELS ) == 0 )
        {
            printf("\n");
        }
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamReadScan5200 C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamReadScan5200 C++ Testprogram

// Con_meIOStreamReadScan.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

#include <windows.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

#define NUMBER_OF_CHANNELS      4

#define THRESHOLD				2

#define ACQUIRE_NUMBER_VALUES   NUMBER_OF_CHANNELS * 50

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_stream_read_device    = -1;
    int i_stream_read_subdevice = -1;

    // Search for an AI-Streaming subdevice in the system

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice( index_device,               // Device index
                                        &i_vendor_id,               // Vendor ID returned here - not required
                                        &i_device_id,               // Device ID returned here - not required
                                        &i_serial_no,               // Serial number returned here - not required
                                        &i_bus_type,                    // Bus type returned here - not required
                                        &i_bus_no,                  // Bus number returned here - not required
                                        &i_dev_no,                  // Bus device number returned here - not required
                                        &i_func_no,                 // Bus function number returned here - not required
                                        &i_plugged              );  // Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        i_me_error = meQuerySubdeviceByType(index_device,                   // Device
                                            0,                              // Begin search at this sub-device
                                            ME_TYPE_AI,                     // Type of sub-device to search for
                                            ME_SUBTYPE_STREAMING,           // Sub-type of sub-device to search for
                                            &i_stream_read_subdevice    );  // sub-device index returned here

        if(i_me_error == ME_ERRNO_SUCCESS)
        {
            i_stream_read_device = index_device;

            break;
        }
    }

    if(i_stream_read_device == -1)
    {
        printf("****    No AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d, Subdevice: %d is an AI-Streaming device\n\n", i_stream_read_device, i_stream_read_subdevice);

    meIOResetSubdevice(i_stream_read_device, i_stream_read_subdevice, ME_IO_RESET_SUBDEVICE_NO_FLAGS);

    double d_required_freq = 10.0;
    double d_achieved_freq = d_required_freq;

    int i_conv_ticks_low = 0;
    int i_conv_ticks_high = 0;

    i_me_error = meIOStreamFrequencyToTicks(i_stream_read_device,               // Device index
                                            i_stream_read_subdevice,            // Subdevice indexe,
                                            ME_TIMER_CONV_START,                // Timer used
                                            &d_achieved_freq,                   // Required time seconds, Achieved time returned here
                                            &i_conv_ticks_low,                  // Lower 32 bits of the corresponding tick value returned here
                                            &i_conv_ticks_high,                 // Upper 32 bits of the corresponding tick value returned here
                                            ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS); // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("meIOStreamFrequencyToTicks - Required Freq: %f Achieved Freq: %f Ticks low: %d Ticks high: %d\n\n", d_required_freq, d_achieved_freq, i_conv_ticks_low, i_conv_ticks_high);

    meIOStreamConfig_t arr_stream_config[NUMBER_OF_CHANNELS];

    for(int index_channel = 0; index_channel < NUMBER_OF_CHANNELS; index_channel++)
    {
        arr_stream_config[index_channel].iChannel = index_channel;

        arr_stream_config[index_channel].iStreamConfig = 0;
        arr_stream_config[index_channel].iRef = ME_REF_AI_GROUND;
        arr_stream_config[index_channel].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;
    }

    meIOStreamTrigger_t stream_trigger;

    memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

    stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

    stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;

    stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
    stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
    stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;
    stream_trigger.iScanStopTrigType = ME_TRIG_TYPE_NONE;

    stream_trigger.iAcqStopTrigType = ME_TRIG_TYPE_COUNT;
    stream_trigger.iAcqStopCount = ACQUIRE_NUMBER_VALUES;
    stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

    i_me_error = meIOStreamConfig(  i_stream_read_device,               // Device index
                                    i_stream_read_subdevice,            // Subdevice index,
                                    &arr_stream_config[0],              // Pointer to an array of meIOStreamConfig_t structures
                                    NUMBER_OF_CHANNELS,                 // Number of elements in the stream config array above
                                    &stream_trigger,                    // Pointer to an meIOStreamTrigger_t structure
                                    THRESHOLD,                          // FIFO IRQ threshold
                                    ME_IO_STREAM_CONFIG_NO_FLAGS    );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    double d_phys_min;

    double d_phys_max;

    int i_digital_max;

    i_me_error = meQueryRangeInfo(  i_stream_read_device,       // Device index
                                    i_stream_read_subdevice,    // Subdevice index,
                                    0,                          // Range index
                                    NULL,                       // Unit returned here - not require
                                    &d_phys_min,                // Physical minimum returned here
                                    &d_phys_max,                // Physical maximum returned here
                                    &i_digital_max          );  // Digital maximum value returned here

    printf("d_phys_min: %lf d_phys_max: %lf i_digital_max: %d\n\n", d_phys_min, d_phys_max, i_digital_max);

    printf("The acquisition will automatically stop after %d values\n\n", ACQUIRE_NUMBER_VALUES);

    printf("Press any key to start the acquisition\n\n");

    _getch();

    meIOStreamStart_t arr_stream_start[1];

    arr_stream_start[0].iDevice = i_stream_read_device;
    arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
    arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
    arr_stream_start[0].iTimeOut = 5;
    arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
    arr_stream_start[0].iErrno = 0;

    i_me_error = meIOStreamStart(   &arr_stream_start[0],           // Pointer to an array of meIOStreamStart_t structures
                                    1,                              // Number of elements in the stream start array above
                                    ME_IO_STREAM_START_NO_FLAGS );  // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Acquisition started\n\n");

    int i_count;

    while(true)
    {
        int i_status;

        i_me_error = meIOStreamStatus(  i_stream_read_device,               // Device index
                                        i_stream_read_subdevice,            // Subdevice index,
                                        ME_WAIT_NONE,                       // Return immediately
                                        &i_status,                          // Status returned here
                                        &i_count,                           // Count returned here
                                        ME_IO_STREAM_STATUS_NO_FLAGS    );  // Flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to end the acquisition\n");

            _getch();

            meIOStreamStop_t arr_stream_stop[1];

            arr_stream_stop[0].iDevice = i_stream_read_device;
            arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
            arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
            arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
            arr_stream_stop[0].iErrno = 0;

            i_me_error = meIOStreamStop(&arr_stream_stop[0],            // Pointer to an array of meIOStreamStop_t structures
                                        1,                              // Number of elements in the stream stop array above
                                        ME_IO_STREAM_STOP_NO_FLAGS);    // No flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return(-1);
            }

            break;
        }

        if(i_status == ME_STATUS_BUSY)
        {
            printf("Acquisition running - Count: %d\n", i_count);
        }
        else if(i_status == ME_STATUS_IDLE)
        {
            printf("Acquisition ended - Count: %d\n", i_count);

            break;
        }
        else
        {
            printf("Unknown status: 0x%08X - Count: %d\n", i_status, i_count);
        }

        Sleep(400);
    }

    // The acquisition should stop after exactly ACQUIRE_CHANNEL_LISTS channel lists
    // have been acquired. This means after ACQUIRE_CHANNEL_LISTS * NUMBER_OF_CHANNELS
    // values have been acquired.
    //
    // We check this here and print an error message if it is not the case.

    if(i_count != ACQUIRE_NUMBER_VALUES)
    {
        printf("****    Number of values incorrect should be: %d, is: %d    ****\n\n", ACQUIRE_NUMBER_VALUES, i_count);

        printf("Press any key to continue\n");

        _getch();

        if(i_count > ACQUIRE_NUMBER_VALUES)
        {
            i_count = ACQUIRE_NUMBER_VALUES;
        }
    }

    int i_buffer[ACQUIRE_NUMBER_VALUES];

    i_me_error = meIOStreamRead(i_stream_read_device,           // Device index
                                i_stream_read_subdevice,        // Subdevice index,
                                ME_READ_MODE_NONBLOCKING,       // Read mode
                                &i_buffer[0],                   // Acquired data values returned in this buffer
                                &i_count,                       // Size of buffer in data values - Number of data values returned here
                                ME_IO_STREAM_READ_NO_FLAGS);    // No flags

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to end the acquisition\n");

        _getch();

        return(-1);
    }

    for(int index_value = 0; index_value < i_count; index_value++)
    {
        double d_volt;

        i_me_error =  meUtilityDigitalToPhysical(   d_phys_min,                         // Min physical value
                                                    d_phys_max,                         // Max physical value
                                                    i_digital_max,                      // Maximum digital value
                                                    i_buffer[index_value],              // Digital value to convert
                                                    ME_MODULE_TYPE_MULTISIG_NONE,       // Module type - not used
                                                    0.0,                                // Reference value - not used
                                                    &d_volt                         );  // Converted physical value returned here

        printf("%5d - %5.2lf V    ", i_buffer[index_value], d_volt);

        if( ( (index_value + 1) % NUMBER_OF_CHANNELS ) == 0 )
        {
            printf("\n");
        }
    }

    printf("Acquisition ended\n\n");

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamWrite C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamWrite C++ Testprogram

// Con_meIOStreamWrite.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_number_ao_streaming_subdevices = 0;

    int i_me_error;

    // Count the number of AO-Streaming subdevice in the system

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,				// Device
                                                index_subdevice,			// Begin search at this sub-device
                                                ME_TYPE_AO,					// Type of sub-device to search for
                                                ME_SUBTYPE_STREAMING,		// Sub-type of sub-device to search for
                                                &index_subdevice		);	// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ao_streaming_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ao_streaming_subdevices == 0)
    {
        printf("****    No AO-Streaming sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    struct SAOStreamingSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;
    };

    // Make a list of the AO-Streaming sub-devices

    SAOStreamingSubddevice* arrSubdevices = new SAOStreamingSubddevice[i_number_ao_streaming_subdevices];

    i_number_ao_streaming_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AO,						// Type of sub-device to search for
                                                ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ao_streaming_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ao_streaming_subdevices].m_iSubdeviceIndex = index_subdevice;

            ++i_number_ao_streaming_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d AO streaming sub-devices found:\n\n", i_number_ao_streaming_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ao_streaming_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex	);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice;

        bool b_terminate = false;

        while(true)
        {
            printf("Choose sub_device:\n\n");

            for(index_subdevice = 0; index_subdevice < i_number_ao_streaming_subdevices; index_subdevice++)
            {
                printf("    %2d.   Device: %2d  Sub-device: %2d\n",
                        index_subdevice + 1,
                        arrSubdevices[index_subdevice].m_iDeviceIndex,
                        arrSubdevices[index_subdevice].m_iSubdeviceIndex	);
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ao_streaming_subdevices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
            {
                continue;
            }

            if( (index_subdevice < 1)||(index_subdevice > i_number_ao_streaming_subdevices) )
            {
                continue;
            }

            --index_subdevice;

            break;
        }

        if(b_terminate)
        {
            break;
        }

        double d_req_freq = 2000.0;
        double d_achieved_freq = d_req_freq;

        int i_ticks_low = 0;
        int i_ticks_high = 0;

        i_me_error = meIOStreamFrequencyToTicks(arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                                arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                                ME_TIMER_CONV_START,								// Timer used
                                                &d_achieved_freq,									// Required frequency Hz, Achieved frequency returned here
                                                &i_ticks_low,										// Lower 32 bits of the corresponding tick value returned here
                                                &i_ticks_high,										// Upper 32 bits of the corresponding tick value returned here
                                                ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS				);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("meIOStreamFrequencyToTicks - Required Freq: %lf Achieved Freq: %lf Ticks low: %d Ticks high: %d\n\n", d_req_freq, d_achieved_freq, i_ticks_low, i_ticks_high);

        // Configure the device

        meIOStreamConfig_t arr_stream_config[1];

        arr_stream_config[0].iChannel = 0;

        arr_stream_config[0].iStreamConfig = 0;
        arr_stream_config[0].iRef = ME_REF_AO_GROUND;
        arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

        meIOStreamTrigger_t stream_trigger;

        memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

        stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

        // int iAcqStartTrigEdge;
        stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;
        stream_trigger.iAcqStartTicksLow = 0;
        stream_trigger.iAcqStartTicksHigh = 0;
        // int iAcqStartArgs[10];

        stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;
        //int iScanStartTicksLow;
        //int iScanStartTicksHigh;
        //int iScanStartArgs[10];

        stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
        stream_trigger.iConvStartTicksLow = i_ticks_low;
        stream_trigger.iConvStartTicksHigh = i_ticks_high;
        //int iConvStartArgs[10];

        // int iScanStopTrigType;
        // int iScanStopCount;
        // int iScanStopArgs[10];

        // int iAcqStopTrigType;
        // int iAcqStopCount;
        // int iAcqStopArgs[10];

        stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

        i_me_error = meIOStreamConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                         &arr_stream_config[0],								// Pointer to an array of meIOStreamConfig_t structures
                                        1,													// Number of elements in the stream config array above
                                        &stream_trigger,									// Pointer to an meIOStreamTrigger_t structure
                                        0,													// FIFO IRQ threshold - not used here
                                        ME_IO_STREAM_CONFIG_NO_FLAGS					);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        // Fetch the range information for range index 0.
        // We want to create a signal that covers the entire digital range

        double d_phys_min;

        double d_phys_max;

        int i_digital_max;

        i_me_error = meQueryRangeInfo(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                        0,													// Range index
                                        NULL,												// Unit returned here - not require
                                        &d_phys_min,										// Physical minimum returned here
                                        &d_phys_max,										// Physical maximum returned here
                                        &i_digital_max									);	// Digital maximum value returned here

        int i_buffer[20000];

        int i_count = 20000;

        for(int index_value = 0; index_value < 20000; index_value++)
        {
            i_buffer[index_value] = index_value * i_digital_max / 20000;
        }

        i_me_error = meIOStreamWrite(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                        ME_WRITE_MODE_PRELOAD,								// Write mode
                                        &i_buffer[0],										// Buffer containing the values to write
                                        &i_count,											// Size of buffer in data values - Number of data values returned here
                                        ME_IO_STREAM_WRITE_NO_FLAGS						);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamWrite - ME_WRITE_MODE_PRELOAD - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Press any key to start the output\n\n");

        printf("Press the ESC key at any time to end the output\n\n");

        _getch();

        meIOStreamStart_t arr_stream_start[1];

        arr_stream_start[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;
        arr_stream_start[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
        arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
        arr_stream_start[0].iTimeOut = 5;
        arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
        arr_stream_start[0].iErrno = 0;

        i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                        1,								// Number of elements in the stream start array above
                                        ME_IO_STREAM_START_NO_FLAGS	);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Output started - \n\n");

        bool b_falling = false;

        while(true)
        {
            printf("Press ESC to terminate or SPACE to add a new buffer\n\n");

            while(true)
            {
                if( _kbhit() != 0 )
                {
                    char ch = _getch();

                    if(ch == 27)
                    {
                        b_terminate = true;

                        break;
                    }
                    else if(ch == ' ')
                    {
                        if(b_falling)
                        {
                            for(int index_value = 0; index_value < 20000; index_value++)
                            {
                                i_buffer[index_value] = index_value * i_digital_max / 20000;
                            }

                            b_falling = false;
                        }
                        else
                        {
                            for(int index_value = 0; index_value < 20000; index_value++)
                            {
                                i_buffer[index_value] = (20000 - index_value) * i_digital_max / 20000;
                            }

                            b_falling = true;
                        }

                        i_count = 20000;

                        i_me_error = meIOStreamWrite(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                                        ME_WRITE_MODE_BLOCKING,								// Write mode
                                                        &i_buffer[0],										// Buffer containing the values to write
                                                        &i_count,											// Size of buffer in data values - Number of data values returned here
                                                        ME_IO_STREAM_WRITE_NO_FLAGS						);	// No flags

                        break;
                    }
                }
            }

            if(b_terminate)
            {
                break;
            }
        }

        meIOStreamStop_t arr_stream_stop[1];

        arr_stream_stop[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;
        arr_stream_stop[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
        arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
        arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
        arr_stream_stop[0].iErrno = 0;

        i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                    1,								// Number of elements in the stream stop array above
                                    ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Output ended\n\n");

        printf("Press any key to continue\n");

        _getch();
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOStreamWriteWraparound C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOStreamWriteWraparound C++ Testprogram

// Con_meIOStreamWriteWraparound.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_number_ao_streaming_subdevices = 0;

    int i_me_error;

    // Search for an AO-Streaming subdevice in the system

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,					// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,				// Device
                                                index_subdevice,			// Begin search at this sub-device
                                                ME_TYPE_AO,					// Type of sub-device to search for
                                                ME_SUBTYPE_STREAMING,		// Sub-type of sub-device to search for
                                                &index_subdevice		);	// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_ao_streaming_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_ao_streaming_subdevices == 0)
    {
        printf("****    No AO-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    struct SAOStreamingSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;
    };

    SAOStreamingSubddevice* arrSubdevices = new SAOStreamingSubddevice[i_number_ao_streaming_subdevices];

    i_number_ao_streaming_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_AO,						// Type of sub-device to search for
                                                ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_ao_streaming_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_ao_streaming_subdevices].m_iSubdeviceIndex = index_subdevice;

            ++i_number_ao_streaming_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d AO streaming sub-devices found:\n\n", i_number_ao_streaming_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_ao_streaming_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex	);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice;

        bool b_terminate = false;

        while(true)
        {
            printf("Choose sub_device:\n\n");

            for(index_subdevice = 0; index_subdevice < i_number_ao_streaming_subdevices; index_subdevice++)
            {
                printf("    %2d.   Device: %2d  Sub-device: %2d\n",
                        index_subdevice + 1,
                        arrSubdevices[index_subdevice].m_iDeviceIndex,
                        arrSubdevices[index_subdevice].m_iSubdeviceIndex	);
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_ao_streaming_subdevices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
            {
                continue;
            }

            if( (index_subdevice < 1)||(index_subdevice > i_number_ao_streaming_subdevices) )
            {
                continue;
            }

            --index_subdevice;

            break;
        }

        if(b_terminate)
        {
            break;
        }

        double d_req_freq = 1000.0;
        double d_achieved_freq = d_req_freq;

        int i_ticks_low = 0;
        int i_ticks_high = 0;

        i_me_error = meIOStreamFrequencyToTicks(arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                                arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                                ME_TIMER_CONV_START,								// Timer used
                                                &d_achieved_freq,									// Required frequency Hz, Achieved frequency returned here
                                                &i_ticks_low,										// Lower 32 bits of the corresponding tick value returned here
                                                &i_ticks_high,										// Upper 32 bits of the corresponding tick value returned here
                                                ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS				);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamFrequencyToTicks - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("meIOStreamFrequencyToTicks - Required Freq: %lf Achieved Freq: %lf Ticks low: %d Ticks high: %d\n\n", d_req_freq, d_achieved_freq, i_ticks_low, i_ticks_high);

        meIOStreamConfig_t arr_stream_config[1];

        arr_stream_config[0].iChannel = 0;

        arr_stream_config[0].iStreamConfig = 0;
        arr_stream_config[0].iRef = ME_REF_AO_GROUND;
        arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;

        meIOStreamTrigger_t stream_trigger;

        memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

        stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

        // int iAcqStartTrigEdge;
        stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;
        stream_trigger.iAcqStartTicksLow = 0;
        stream_trigger.iAcqStartTicksHigh = 0;
        // int iAcqStartArgs[10];

        stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;
        //int iScanStartTicksLow;
        //int iScanStartTicksHighw;
        //int iScanStartArgs[10];

        stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
        stream_trigger.iConvStartTicksLow = i_ticks_low;
        stream_trigger.iConvStartTicksHigh = i_ticks_high;
        //int iConvStartArgs[10];

        // int iScanStopTrigType;
        // int iScanStopCount;
        // int iScanStopArgs[10];

        // int iAcqStopTrigType;
        // int iAcqStopCount;
        // int iAcqStopArgs[10];

        stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

        i_me_error = meIOStreamConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                         &arr_stream_config[0],								// Pointer to an array of meIOStreamConfig_t structures
                                        1,													// Number of elements in the stream config array above
                                        &stream_trigger,									// Pointer to an meIOStreamTrigger_t structure
                                        0,													// FIFO IRQ threshold - not used here
                                        ME_IO_STREAM_CONFIG_WRAPAROUND					);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        double d_phys_min;

        double d_phys_max;

        int i_digital_max;

        i_me_error = meQueryRangeInfo(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                        0,													// Range index
                                        NULL,												// Unit returned here - not require
                                        &d_phys_min,										// Physical minimum returned here
                                        &d_phys_max,										// Physical maximum returned here
                                        &i_digital_max									);	// Digital maximum value returned here

        int i_buffer[20000];

        int i_count = 20000;

        for(int index_value = 0; index_value < 20000; index_value++)
        {
            i_buffer[index_value] = index_value * i_digital_max / 20000;
        }

        i_me_error = meIOStreamWrite(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                        arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index,
                                        ME_WRITE_MODE_PRELOAD,								// Write mode
                                        &i_buffer[0],										// Buffer containing the values to write
                                        &i_count,											// Size of buffer in data values - Number of data values returned here
                                        ME_IO_STREAM_WRITE_NO_FLAGS						);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamWrite - ME_WRITE_MODE_PRELOAD - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Press any key to start the output\n\n");

        _getch();

        meIOStreamStart_t arr_stream_start[1];

        arr_stream_start[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;
        arr_stream_start[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
        arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;
        arr_stream_start[0].iTimeOut = 5;
        arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
        arr_stream_start[0].iErrno = 0;

        i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                        1,								// Number of elements in the stream start array above
                                        ME_IO_STREAM_START_NO_FLAGS	);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Output started - \n\n");

        printf("Press 'I' to terminate immediately or 'L' to terminate on the last buffer value\n\n");

        bool b_falling = true;

        bool b_terminate_immediately = false;

        while(true)
        {
            if( _kbhit() != 0 )
            {
                char ch = _getch();

                if( (ch == 'i')||(ch == 'I') )
                {
                    b_terminate_immediately = true;

                    break;
                }
                else if( (ch == 'l')||(ch == 'L') )
                {
                    b_terminate_immediately = false;

                    break;
                }
            }
        }

        meIOStreamStop_t arr_stream_stop[1];

        arr_stream_stop[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;
        arr_stream_stop[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;

        if(b_terminate_immediately)
        {
            arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
        }
        else
        {
            arr_stream_stop[0].iStopMode = ME_STOP_MODE_LAST_VALUE;
        }

        arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
        arr_stream_stop[0].iErrno = 0;

        i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                    1,								// Number of elements in the stream stop array above
                                    ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Output ended\n\n");

        printf("Press any key to continue\n");

        _getch();
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOFrequencyIn C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOFrequencyIn C++ Testprogram

// Con_meIOFrequencyIn.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

#include <string.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the Counter sub-devices in the system

    int i_number_fi_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_FI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_fi_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_fi_subdevices == 0)
    {
        printf("****    No FI sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the FI sub-devices

    struct SFISubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;
    };

    SFISubddevice* arrSubdevices = new SFISubddevice[i_number_fi_subdevices];

    i_number_fi_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_FI,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_fi_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_fi_subdevices].m_iSubdeviceIndex = index_subdevice;

            ++i_number_fi_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d FI sub-devices found:\n\n", i_number_fi_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_fi_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice = 0;

        int i_number_function;

        bool b_terminate = false;

        if(i_number_fi_subdevices > 1)
        {
            while(true)
            {
                printf("Choose sub-device:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_fi_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d\n",
                            index_subdevice + 1,
                            arrSubdevices[index_subdevice].m_iDeviceIndex,
                            arrSubdevices[index_subdevice].m_iSubdeviceIndex					);
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_fi_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_fi_subdevices) )
                {
                    continue;
                }

                --index_subdevice;

                break;
            }
        }

        if(b_terminate)
        {
            break;
        }

        int i_number_of_channels = 0;

        i_me_error = meQueryNumberChannels(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            &i_number_of_channels							);	// number of channels returned here

        int index_channel = 0;

        if(i_number_of_channels > 1)
        {
            while(true)
            {
                printf("Choose channel 0 - %2d ((RETURN to terminate): ", i_number_of_channels - 1);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_channel) != 1 ) )
                {
                    continue;
                }

                if( (index_channel < 0)||(index_channel >= i_number_of_channels) )
                {
                    continue;
                }

                break;
            }
        }

        if(b_terminate)
        {
            break;
        }

        printf(	"Using Device: %d    Sub-device: %d    Channel: %d\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                index_channel											);

        while(true)
        {
            printf("Choose function:\n\n");

            printf(	"1. Reset\n"
                    "2. Config\n"
                    "3. Read\n\n");

            printf("\nYour choice (1 - 3) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_number_function) != 1 ) )
            {
                continue;
            }

            if( (i_number_function < 1)||(i_number_function > 3) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int b_cancel = false;

        switch(i_number_function)
        {
        case 1:	// Reset

            printf(	"Press any key to call:\n\n"
                    "    meIOResetSubdevice( %-30d      (iDevice)\n"
                    "                        %-30d      (iSubdevice)\n"
                    "                        %-30s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "ME_IO_RESET_SUBDEVICE_NO_FLAGS"						);

            getch();

            i_me_error = meIOResetSubdevice(arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            ME_IO_RESET_SUBDEVICE_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOResetSubdevice - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d reset, press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            _getch();

            break;

        case 2: // Config

            printf(	"Press any key to call:\n\n"
                    "    meIOSingleConfig( %-35d      (iDevice)\n"
                    "                      %-35d      (iSubdevice)\n"
                    "                      %-35d      (iChannel)\n"
                    "                      %-35s      (iSingleConfig)\n"
                    "                      %-35s      (iRef)\n"
                    "                      %-35s      (iTrigChan)\n"
                    "                      %-35s      (iTrigType)\n"
                    "                      %-35s      (iTrigEdge)\n"
                    "                      %-35s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    index_channel,
                    "ME_SINGLE_CONFIG_FIO_INPUT",
                    "ME_VALUE_NOT_USED",
                    "ME_TRIG_CHAN_DEFAULT",
                    "ME_TRIG_TYPE_NONE",
                    "ME_VALUE_NOT_USED",
                    "ME_IO_SINGLE_CONFIG_NO_FLAGS"						);

            getch();

            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            index_channel,										// Channel
                                            ME_SINGLE_CONFIG_FIO_INPUT,							// Single config
                                            ME_VALUE_NOT_USED,									// Reference
                                            ME_TRIG_CHAN_DEFAULT,								// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            ME_IO_SINGLE_CONFIG_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d Channel: %d has been configured - press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex, index_channel);

            getch();

            break;

        case 3: // Read

            int i_flags;

            i_flags = ME_IO_SINGLE_TYPE_NO_FLAGS;

            int i_single_flag;

            int i_timeout_ms = 0;

            while(true)
            {
                printf("Choose return mode:\n\n");

                printf(	"1. Next value (No flags)\n"
                        "2. Last value ('ME_IO_SINGLE_TYPE_FI_LAST_VALUE')\n\n"				);

                printf("Choose return mode (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FI_LAST_VALUE;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Timeout milliseconds (0  - 10000, 0 --> No Timeout) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_timeout_ms) != 1 ) )
                {
                    continue;
                }

                if( (i_timeout_ms < 0)||(10000 < i_timeout_ms) )
                {
                    continue;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Choose return type:\n\n");

                printf(	"1. Ticks total ('ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL')\n"
                        "2. Ticks first phase ('ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE')\n\n"				);

                printf("Choose return type (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 1)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL;
                }
                else // if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            char sz_st_flags[128];

            sz_st_flags[0] = 0;

            int b_first_flag = 1;

            if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL) == ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL )
            {
                if(b_first_flag == 0)
                {
                    strcat(&sz_st_flags[0], " | ");
                }

                strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL");

                b_first_flag = 0;
            }
            else if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE) == ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE )
            {
                if(b_first_flag == 0)
                {
                    strcat(&sz_st_flags[0], " | ");
                }

                strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE");

                b_first_flag = 0;
            }

            if( (i_flags & ME_IO_SINGLE_TYPE_FI_LAST_VALUE) == ME_IO_SINGLE_TYPE_FI_LAST_VALUE )
            {
                if(b_first_flag == 0)
                {
                    strcat(&sz_st_flags[0], " | ");
                }

                strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FREQ_LAST_VALUE");

                b_first_flag = 0;
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingle( %-30s      (*pSingleList)\n"
                    "                %-30d      (iCount)\n"
                    "                %-30s  );  (iFlags)\n\n",
                    "&io_single[0]",
                    1,
                    "ME_IO_SINGLE_NO_FLAGS"						);

            printf(	"Where 'io_single' is an array of length one of meIOSingle_t structures:\n\n"
                    "    meIOSingle_t io_single[1]\n\n"
                    "and the first and only element of this array is filled as follows:\n\n"
                    "    %-30s = %-30d      (iDevice)\n"
                    "    %-30s = %-30d      (iSubdevice)\n"
                    "    %-30s = %-30d      (iChannel)\n"
                    "    %-30s = %-30s      (iDir)\n"
                    "    %-30s = %-30d      (iValue) - Result returned here\n"
                    "    %-30s = %-30d      (iTimeOut)\n"
                    "    %-30s = %-30s      (iFlags)\n\n",
                    "io_single[0].iDevice",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    "io_single[0].iSubdevice",
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "io_single[0].iChannel",
                    index_channel,
                    "io_single[0].iDir",
                    "ME_DIR_INPUT",
                    "io_single[0].iValue",
                    0,
                    "io_single[0].iTimeOut",
                    i_timeout_ms,
                    "io_single[0].iFlags",
                    &sz_st_flags[0]															);

            getch();

            meIOSingle_t io_single[1];

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= index_channel;
            io_single[0].iDir		= ME_DIR_INPUT;
            io_single[0].iValue		= 0;
            io_single[0].iTimeOut	= i_timeout_ms;
            io_single[0].iFlags		= i_flags;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            int i_timer;

            if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL) == ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL )
            {
                i_timer = ME_TIMER_FIO_TOTAL;
            }
            else if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE) == ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE )
            {
                i_timer = ME_TIMER_FIO_FIRST_PHASE;
            }

            double d_time;

            i_me_error = meIOSingleTicksToTime(	arrSubdevices[index_subdevice].m_iDeviceIndex,			// Device
                                                arrSubdevices[index_subdevice].m_iSubdeviceIndex,		// Sub-device
                                                i_timer,												// iTimer
                                                io_single[0].iValue,									// Ticks low
                                                0,														// Ticks high
                                                &d_time,												// Corresponding time returned here
                                                ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS					);	// flags

            printf(	"Read %d ticks (%g seconds) from Device: %d Subdevice: %d Channel: %d, press any key to continue\n\n",
                    io_single[0].iValue,
                    d_time,
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    index_channel																							);

            _getch();

            break;
        }
    }

    delete []arrSubdevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOFrequencyOut C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOFrequencyOut C++ Testprogram

// Con_meIOFrequencyOut.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

#include <string.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the Counter sub-devices in the system

    int i_number_fo_subdevices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_FO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            ++i_number_fo_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_fo_subdevices == 0)
    {
        printf("****    No FO sub-devices found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the FO sub-devices

    struct SFOSubddevice
    {
        int	m_iDeviceIndex;

        int m_iSubdeviceIndex;
    };

    SFOSubddevice* arrSubdevices = new SFOSubddevice[i_number_fo_subdevices];

    i_number_fo_subdevices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_FO,						// Type of sub-device to search for
                                                ME_SUBTYPE_ANY,					// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrSubdevices[i_number_fo_subdevices].m_iDeviceIndex = index_device;

            arrSubdevices[i_number_fo_subdevices].m_iSubdeviceIndex = index_subdevice;

            ++i_number_fo_subdevices;

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d FO sub-devices found:\n\n", i_number_fo_subdevices);

    for(int index_subdevice = 0; index_subdevice < i_number_fo_subdevices; index_subdevice++)
    {
        printf("%2d.   Device: %2d  Sub-device: %2d\n",
                index_subdevice + 1,
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex					);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int index_subdevice = 0;

        int i_number_function;

        bool b_terminate = false;

        if(i_number_fo_subdevices > 1)
        {
            while(true)
            {
                printf("Choose sub-device:\n\n");

                for(index_subdevice = 0; index_subdevice < i_number_fo_subdevices; index_subdevice++)
                {
                    printf("%2d.   Device: %2d  Sub-device: %2d\n",
                            index_subdevice + 1,
                            arrSubdevices[index_subdevice].m_iDeviceIndex,
                            arrSubdevices[index_subdevice].m_iSubdeviceIndex					);
                }

                printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_fo_subdevices);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_subdevice) != 1 ) )
                {
                    continue;
                }

                if( (index_subdevice < 1)||(index_subdevice > i_number_fo_subdevices) )
                {
                    continue;
                }

                --index_subdevice;

                break;
            }
        }

        if(b_terminate)
        {
            break;
        }

        int i_number_of_channels = 0;

        i_me_error = meQueryNumberChannels(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            &i_number_of_channels							);	// number of channels returned here

        int index_channel = 0;

        if(i_number_of_channels > 1)
        {
            while(true)
            {
                printf("Choose channel 0 - %2d ((RETURN to terminate): ", i_number_of_channels - 1);

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &index_channel) != 1 ) )
                {
                    continue;
                }

                if( (index_channel < 0)||(index_channel >= i_number_of_channels) )
                {
                    continue;
                }

                break;
            }
        }

        if(b_terminate)
        {
            break;
        }

        printf(	"Using Device: %d    Sub-device: %d    Channel: %d\n\n",
                arrSubdevices[index_subdevice].m_iDeviceIndex,
                arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                index_channel											);

        while(true)
        {
            printf("Choose function:\n\n");

            printf(	"1. Reset\n"
                    "2. Config\n"
                    "3. Read\n"
                    "4. Write\n\n");

            printf("\nYour choice (1 - 4) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_number_function) != 1 ) )
            {
                continue;
            }

            if( (i_number_function < 1)||(i_number_function > 4) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int b_cancel = false;

        switch(i_number_function)
        {
        case 1:	// Reset

            printf(	"Press any key to call:\n\n"
                    "    meIOResetSubdevice( %-30d      (iDevice)\n"
                    "                        %-30d      (iSubdevice)\n"
                    "                        %-30s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "ME_IO_RESET_SUBDEVICE_NO_FLAGS"						);

            getch();

            i_me_error = meIOResetSubdevice(arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            ME_IO_RESET_SUBDEVICE_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOResetSubdevice - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d reset, press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex);

            _getch();

            break;

        case 2: // Config

            int i_trigger_channel;

            char* sz_trigger_channel;

            while(true)
            {
                printf("Choose iTrigChan:\n\n");

                printf(	"1. 'ME_TRIG_CHAN_DEFAULT' (Immediate output)\n"
                        "2. 'ME_TRIG_CHAN_SYNCHRONOUS'\n\n"				);

                printf("Choose trigger channel (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_trigger_channel) != 1 ) )
                {
                    continue;
                }

                if( (i_trigger_channel < 1)||(i_trigger_channel > 2 ) )
                {
                    continue;
                }

                if(i_trigger_channel == 1)
                {
                    i_trigger_channel = ME_TRIG_CHAN_DEFAULT;

                    sz_trigger_channel = "ME_TRIG_CHAN_DEFAULT";
                }
                else
                {
                    i_trigger_channel = ME_TRIG_CHAN_SYNCHRONOUS;

                    sz_trigger_channel = "ME_TRIG_CHAN_SYNCHRONOUS";
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingleConfig( %-35d      (iDevice)\n"
                    "                      %-35d      (iSubdevice)\n"
                    "                      %-35d      (iChannel)\n"
                    "                      %-35s      (iSingleConfig)\n"
                    "                      %-35s      (iRef)\n"
                    "                      %-35s      (iTrigChan)\n"
                    "                      %-35s      (iTrigType)\n"
                    "                      %-35s      (iTrigEdge)\n"
                    "                      %-35s  );  (iFlags)\n\n",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    index_channel,
                    "ME_SINGLE_CONFIG_FIO_OUTPUT",
                    "ME_VALUE_NOT_USED",
                    sz_trigger_channel,
                    "ME_TRIG_TYPE_NONE",
                    "ME_VALUE_NOT_USED",
                    "ME_IO_SINGLE_CONFIG_NO_FLAGS"						);

            getch();

            i_me_error = meIOSingleConfig(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device index
                                            arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Subdevice index
                                            index_channel,										// Channel
                                            ME_SINGLE_CONFIG_FIO_OUTPUT,						// Single config
                                            ME_VALUE_NOT_USED,									// Reference
                                            i_trigger_channel,									// Trigger channel
                                            ME_TRIG_TYPE_NONE,									// Trigger type
                                            ME_VALUE_NOT_USED,									// Trigger edge
                                            ME_IO_SINGLE_CONFIG_NO_FLAGS					);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingleConfig - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Device: %d Subdevice: %d Channel: %d has been configured - press any key to continue\n\n", arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex, index_channel);

            getch();

            break;

        case 3: // Read

            int i_flags;

            char* sz_flags;

            while(true)
            {
                printf("Choose return type:\n\n");

                printf(	"1. Ticks total ('ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL')\n"
                        "2. Ticks first phase ('ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE')\n\n"				);

                printf("Choose return type (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_flags) != 1 ) )
                {
                    continue;
                }

                if( (i_flags < 1)||(i_flags > 2 ) )
                {
                    continue;
                }

                if(i_flags == 1)
                {
                    i_flags = ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL;

                    sz_flags = "ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL";
                }
                else
                {
                    i_flags = ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE;

                    sz_flags = "ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE";
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingle( %-30s      (*pSingleList)\n"
                    "                %-30d      (iCount)\n"
                    "                %-30s  );  (iFlags)\n\n",
                    "&io_single[0]",
                    1,
                    "ME_IO_SINGLE_NO_FLAGS"						);

            printf(	"Where 'io_single' is an array of length one of meIOSingle_t structures:\n\n"
                    "    meIOSingle_t io_single[1]\n\n"
                    "and the first and only element of this array is filled as follows:\n\n"
                    "    %-30s = %-30d      (iDevice)\n"
                    "    %-30s = %-30d      (iSubdevice)\n"
                    "    %-30s = %-30d      (iChannel)\n"
                    "    %-30s = %-30s      (iDir)\n"
                    "    %-30s = %-30d      (iValue) - Result returned here\n"
                    "    %-30s = %-30d      (iTimeOut)\n"
                    "    %-30s = %-30s      (iFlags)\n\n",
                    "io_single[0].iDevice",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    "io_single[0].iSubdevice",
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "io_single[0].iChannel",
                    index_channel,
                    "io_single[0].iDir",
                    "ME_DIR_INPUT",
                    "io_single[0].iValue",
                    0,
                    "io_single[0].iTimeOut",
                    0,
                    "io_single[0].iFlags",
                    sz_flags																	);

            getch();

            meIOSingle_t io_single[1];

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= index_channel;
            io_single[0].iDir		= ME_DIR_INPUT;
            io_single[0].iValue		= 0;
            io_single[0].iTimeOut	= 0;
            io_single[0].iFlags		= i_flags;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Read %d from Device: %d Subdevice: %d Channel: %d, press any key to continue\n\n", io_single[0].iValue, arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex, index_channel);

            _getch();

            break;

        case 4: // Write

            i_flags = ME_IO_SINGLE_TYPE_NO_FLAGS;

            int i_single_flag = 0;

            while(true)
            {
                printf("Choose output type:\n\n");

                printf(	"1. Ticks total ('ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL')\n"
                        "2. Ticks first phase ('ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE')\n\n"				);

                printf("Choose output type (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 1)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL;
                }
                else // if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Choose start level:\n\n");

                printf(	"1. High (No flags)\n"
                        "2. Low ('ME_IO_SINGLE_TYPE_FO_START_LOW')\n\n"				);

                printf("Choose start level (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FO_START_LOW;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Choose start type:\n\n");

                printf(	"1. Hard (No flags)\n"
                        "2. Soft - Controlled start ('ME_IO_SINGLE_TYPE_FO_START_SOFT')\n\n"				);

                printf("Choose start level (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FO_START_SOFT;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Choose write type:\n\n");

                printf(	"1. Direct (No flags)\n"
                        "2. Update ('ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY')\n\n"				);

                printf("Choose start level (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            while(true)
            {
                printf("Choose write mode:\n\n");

                printf(	"1. Direct (No flags)\n"
                        "2. Synchronous ('ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS')\n\n"				);

                printf("Choose start level (1 - 2) (RETURN to cancel): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_cancel = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_single_flag) != 1 ) )
                {
                    continue;
                }

                if( (i_single_flag < 1)||(i_single_flag > 2 ) )
                {
                    continue;
                }

                if(i_single_flag == 2)
                {
                    i_flags|= ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS;
                }

                break;
            }

            if(b_cancel)
            {
                break;
            }

            int i_ticks_low;

            double d_seconds;

            while(true)
            {
                printf("Output value in seconds (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    break;
                }

                if( (sscanf(&buffer[0], "%lf", &d_seconds) != 1 ) )
                {
                    continue;
                }

                double d_seconds_req = d_seconds;

                int i_timer;

                if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL) == ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL )
                {
                    i_timer = ME_TIMER_FIO_TOTAL;
                }
                else if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE) == ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE )
                {
                    i_timer = ME_TIMER_FIO_FIRST_PHASE;
                }

                int i_ticks_high;

                i_me_error = meIOSingleTimeToTicks(	arrSubdevices[index_subdevice].m_iDeviceIndex,		// Device
                                                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,	// Sub-device
                                                    i_timer,											// iTimer
                                                    &d_seconds,											// Required time, achieved time retuned here
                                                    &i_ticks_low,										// Ticks low
                                                    &i_ticks_high,										// Ticks high
                                                    ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS				);	// Flags

                printf("Required time: %g seconds, achieved time: %g seconds (ticks: %d), press any key to continue\n\n", d_seconds_req, d_seconds, i_ticks_low);

                _getch();

                break;
            }

            char sz_st_flags[256];

            if(i_flags == ME_IO_SINGLE_TYPE_NO_FLAGS)
            {
                strcpy(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_NO_FLAGS");
            }
            else
            {
                sz_st_flags[0] = 0;

                int b_first_flag = 1;

                if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL) == ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL");

                    b_first_flag = 0;
                }
                else // if( (i_flags & ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE) == ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE");

                    b_first_flag = 0;
                }

                if( (i_flags & ME_IO_SINGLE_TYPE_FO_START_LOW) == ME_IO_SINGLE_TYPE_FO_START_LOW )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FO_START_LOW");

                    b_first_flag = 0;
                }

                if( (i_flags & ME_IO_SINGLE_TYPE_FO_START_SOFT) == ME_IO_SINGLE_TYPE_FO_START_SOFT )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FO_START_SOFT");

                    b_first_flag = 0;
                }

                if( (i_flags & ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY) == ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY");

                    b_first_flag = 0;
                }

                if( (i_flags & ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS) == ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS )
                {
                    if(b_first_flag == 0)
                    {
                        strcat(&sz_st_flags[0], " | ");
                    }

                    strcat(&sz_st_flags[0], "ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS");

                    b_first_flag = 0;
                }
            }

            printf(	"Press any key to call:\n\n"
                    "    meIOSingle( %-30s      (*pSingleList)\n"
                    "                %-30d      (iCount)\n"
                    "                %-30s  );  (iFlags)\n\n",
                    "&io_single[0]",
                    1,
                    "ME_IO_SINGLE_NO_FLAGS"						);

            printf(	"Where 'io_single' is an array of length one of meIOSingle_t structures:\n\n"
                    "    meIOSingle_t io_single[1]\n\n"
                    "and the first and only element of this array is filled as follows:\n\n"
                    "    %-30s = %-30d      (iDevice)\n"
                    "    %-30s = %-30d      (iSubdevice)\n"
                    "    %-30s = %-30d      (iChannel)\n"
                    "    %-30s = %-30s      (iDir)\n"
                    "    %-30s = %-30d      (iValue) - ticks\n"
                    "    %-30s = %-30d      (iTimeOut)\n"
                    "    %-30s = %-30s      (iFlags)\n\n",
                    "io_single[0].iDevice",
                    arrSubdevices[index_subdevice].m_iDeviceIndex,
                    "io_single[0].iSubdevice",
                    arrSubdevices[index_subdevice].m_iSubdeviceIndex,
                    "io_single[0].iChannel",
                    index_channel,
                    "io_single[0].iDir",
                    "ME_DIR_OUTPUT",
                    "io_single[0].iValue",
                    i_ticks_low,
                    "io_single[0].iTimeOut",
                    0,
                    "io_single[0].iFlags",
                    &sz_st_flags[0]															);

            getch();

            io_single[0].iDevice = arrSubdevices[index_subdevice].m_iDeviceIndex;

            io_single[0].iSubdevice = arrSubdevices[index_subdevice].m_iSubdeviceIndex;
            io_single[0].iChannel	= index_channel;
            io_single[0].iDir		= ME_DIR_OUTPUT;
            io_single[0].iValue		= i_ticks_low;
            io_single[0].iTimeOut	= 0;
            io_single[0].iFlags		= i_flags;

            i_me_error = meIOSingle(&io_single[0],				// Output list
                                    1,							// Number of elements in the above list
                                    ME_IO_SINGLE_NO_FLAGS	);	// Flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOSingle - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            printf("Wrote %d (%g seconds) to Device: %d Subdevice: %d Channel: %d, press any key to continue\n\n", io_single[0].iValue, d_seconds, arrSubdevices[index_subdevice].m_iDeviceIndex, arrSubdevices[index_subdevice].m_iSubdeviceIndex, index_channel);

            _getch();

            break;
        }
    }

    delete []arrSubdevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meLockSubdevice C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meLockSubdevice C++ Testprogram

// Con_meLockSubdevice.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    printf(	"Press any key to try to lock Device 0, Subdevice 0\n\n");

    getch();

    int i_me_error = meLockSubdevice(0, 0, ME_LOCK_SET, 0);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meLockSubdevice, ME_LOCK_SET - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        meClose(0);

        _getch();

        return(-1);
    }

    printf(	"Lock set on Device 0, Subdevice 0\n\n"
            "Press any key to release lock\n\n");

    getch();

    i_me_error = meLockSubdevice(0, 0, ME_LOCK_RELEASE, 0);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meLockSubdevice, ME_LOCK_RELEASE - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        meClose(0);

        _getch();

        return(-1);
    }

    meClose(0);

    printf(	"Lock released on Device 0, Subdevice 0\n\n"
            "Press any key to terminate\n\n");

    getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOResetDevice C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOResetDevice C++ Testprogram

// Con_meResetDevice.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    printf(	"Press any key to reset all devices\n"
            "(and therefore, automatically, all sub-devices).\n\n");

    getch();

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        meIOResetDevice(index_device, ME_IO_RESET_DEVICE_NO_FLAGS);
    }

    meClose(0);

    printf(	"All ME-iDS devices reset\n\n"
            "Press any key to terminate\n\n");

    getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meUtilityPWM C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meUtilityPWM C++ Testprogram

// Con_meUtilityPWM.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    // Count the devices in the system which are candidates for PWM.
    // These must have at least three counter sub-devices.

    int i_number_of_pwm_devices = 0;

    int i_me_error;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        int i_number_ctr_8254_subdevices = 0;

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_CTR,					// Type of sub-device to search for
                                                ME_SUBTYPE_CTR_8254,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            if(++i_number_ctr_8254_subdevices >= 3)
            {
                ++i_number_of_pwm_devices;

                break;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    if(i_number_of_pwm_devices == 0)
    {
        printf("****    No device for PWM found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    // Make a list of the devices which have at least three counter sub-devices,
    // and note the indexes of the first three such sub-devices

    struct SPWMDevice
    {
        int	m_iDeviceIndex;

        int m_iNumberOfCounterSubdevices;

        int m_arrCounterSubdevices[3];
    };

    SPWMDevice* arrPWMDevices = new SPWMDevice[i_number_of_pwm_devices];

    i_number_of_pwm_devices = 0;

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        int i_vendor_id;
        int i_device_id;
        int i_serial_no;
        int i_bus_type;
        int i_bus_no;
        int i_dev_no;
        int i_func_no;
        int i_plugged;

        i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                        &i_vendor_id,				// Vendor ID returned here - not required
                                        &i_device_id,				// Device ID returned here - not required
                                        &i_serial_no,				// Serial number returned here - not required
                                        &i_bus_type,				// Bus type returned here - not required
                                        &i_bus_no,					// Bus number returned here - not required
                                        &i_dev_no,					// Bus device number returned here - not required
                                        &i_func_no,					// Bus function number returned here - not required
                                        &i_plugged				);	// Plugged status returned hee - not required

        if(i_plugged != ME_PLUGGED_IN)
        {
            continue;
        }

        arrPWMDevices[i_number_of_pwm_devices].m_iDeviceIndex = index_device;

        arrPWMDevices[i_number_of_pwm_devices].m_iNumberOfCounterSubdevices = 0;

        int index_subdevice = 0;

        int i_number_of_subdevices;

        i_me_error = meQueryNumberSubdevices(	index_device,				// Device index
                                                &i_number_of_subdevices);	// Number of subdevices returned here

        while(true)
        {
            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                index_subdevice,				// Begin search at this sub-device
                                                ME_TYPE_CTR,					// Type of sub-device to search for
                                                ME_SUBTYPE_CTR_8254,			// Sub-type of sub-device to search for
                                                &index_subdevice	);			// sub-device index returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                break;
            }

            arrPWMDevices[i_number_of_pwm_devices].m_arrCounterSubdevices[ arrPWMDevices[i_number_of_pwm_devices].m_iNumberOfCounterSubdevices ] = index_subdevice;

            if(++arrPWMDevices[i_number_of_pwm_devices].m_iNumberOfCounterSubdevices >= 3)
            {
                ++i_number_of_pwm_devices;

                break;
            }

            if(++index_subdevice >= i_number_of_subdevices)
            {
                break;
            }
        }
    }

    printf("%d devices found for PWM:\n\n", i_number_of_pwm_devices);

    for(int index_device = 0; index_device < i_number_of_pwm_devices; index_device++)
    {
        printf(	"%2d.   On Device: %2d, sub-devices %2d, %2d and %2d are 8254 counter sub-devices\n",
                index_device + 1,
                arrPWMDevices[index_device].m_iDeviceIndex,
                arrPWMDevices[index_device].m_arrCounterSubdevices[0],
                arrPWMDevices[index_device].m_arrCounterSubdevices[1],
                arrPWMDevices[index_device].m_arrCounterSubdevices[2]		);
    }

    printf("\n\nPress any key to continue\n\n");

    getch();

    char buffer[512];

    while(true)
    {
        int i_list_index_device;

        bool b_terminate = false;

        while(true)
        {
            printf("Choose a device and sub-devices for PWM:\n\n");

            for(int index_device = 0; index_device < i_number_of_pwm_devices; index_device++)
            {
                printf(	"%2d.   Device: %2d, sub-devices %2d, %2d and %2d\n",
                        index_device + 1,
                        arrPWMDevices[index_device].m_iDeviceIndex,
                        arrPWMDevices[index_device].m_arrCounterSubdevices[0],
                        arrPWMDevices[index_device].m_arrCounterSubdevices[1],
                        arrPWMDevices[index_device].m_arrCounterSubdevices[2]		);
            }

            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_of_pwm_devices);

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_list_index_device) != 1 ) )
            {
                continue;
            }

            if( (i_list_index_device < 1)||(i_list_index_device > i_number_of_pwm_devices) )
            {
                continue;
            }

            --i_list_index_device;

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int i_ref;

        char* sz_ref;

        int i_iref_choice;

        while(true)
        {
            printf("Choose a value for 'iRef':\n\n");

            printf(	"1.   ME_REF_CTR_EXTERNAL\n"
                    "2.   ME_REF_CTR_INTERNAL_1MHZ\n"
                    "3.   ME_REF_CTR_INTERNAL_10MHZ\n"
                    "4.   ME_REF_CTR_PREVIOUS\n"		);

            printf("\nYour choice (1 - 4) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_iref_choice) != 1 ) )
            {
                continue;
            }

            if( (i_iref_choice < 1)||(i_iref_choice > 4) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        switch(i_iref_choice)
        {
        case 1:

            i_ref = ME_REF_CTR_EXTERNAL;

            sz_ref = "ME_REF_CTR_EXTERNAL";

            break;

        case 2:

            i_ref = ME_REF_CTR_INTERNAL_1MHZ;

            sz_ref = "ME_REF_CTR_INTERNAL_1MHZ";

            break;

        case 3:

            i_ref = ME_REF_CTR_INTERNAL_10MHZ;

            sz_ref = "ME_REF_CTR_INTERNAL_10MHZ";

            break;

        case 4:

            i_ref = ME_REF_CTR_PREVIOUS;

            sz_ref = "ME_REF_CTR_PREVIOUS";

            break;
        }

        int i_prescaler;

        while(true)
        {
            printf("Please enter a pre-scaler between 1 and 65534 (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_prescaler) != 1 ) )
            {
                continue;
            }

            if( (i_prescaler < 1)||(i_prescaler > 65534) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int i_duty_cycle;

        while(true)
        {
            printf("Please enter a duty cycle between 1%% and 99%% (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_duty_cycle) != 1 ) )
            {
                continue;
            }

            if( (i_duty_cycle < 1)||(i_duty_cycle > 99) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int i_flag;

        char* sz_flag;

        int i_flag_choice;

        while(true)
        {
            printf("Choose a value for 'iREF':\n\n");

            printf(	"1.   ME_PWM_START_NO_FLAGS\n"
                    "2.   ME_PWM_START_CONNECT_INTERNAL\n"	);

            printf("\nYour choice (1 - 2) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_flag_choice) != 1 ) )
            {
                continue;
            }

            if( (i_flag_choice < 1)||(i_flag_choice > 2) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        if(i_flag_choice == 1)
        {
            i_flag = ME_PWM_START_NO_FLAGS;

            sz_flag = "ME_PWM_START_NO_FLAGS";
        }
        else
        {
            i_flag = ME_PWM_START_CONNECT_INTERNAL;

            sz_flag = "ME_PWM_START_CONNECT_INTERNAL";
        }

        printf(	"Press RETURN to terminate or any other key to call:\n\n"
                "    meUtilityPWMStart( %-30d      (iDevice)\n"
                "                       %-30d      (iSubdevice1)\n"
                "                       %-30d      (iSubdevice2)\n"
                "                       %-30d      (iSubdevice3)\n"
                "                       %-30s      (iRef)\n"
                "                       %-30d      (iPrescaler)\n"
                "                       %-30d      (iDutyCycle)\n"
                "                       %-30s  );  (iFlag)\n",
                arrPWMDevices[i_list_index_device].m_iDeviceIndex,
                arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[0],
                arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[1],
                arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[2],
                sz_ref,
                i_prescaler,
                i_duty_cycle,
                sz_flag													);

        getch();

        i_me_error = meUtilityPWMStart(	arrPWMDevices[i_list_index_device].m_iDeviceIndex,
                                        arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[0],
                                        arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[1],
                                        arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[2],
                                        i_ref,
                                        i_prescaler,
                                        i_duty_cycle,
                                        i_flag													);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("\n\n****    meUtilityPWMStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to continue\n");

            _getch();

            continue;
        }

        printf( "\n\nPWM Started!\n\n"
                "Press any key to call:\n\n"
                "    meUtilityPWMStop(  %-2d      (iDevice)\n"
                "                       %-2d );   (iSubdevice1)\n",
                arrPWMDevices[i_list_index_device].m_iDeviceIndex,
                arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[0]	);

        getch();

        meUtilityPWMStop(	arrPWMDevices[i_list_index_device].m_iDeviceIndex,
                            arrPWMDevices[i_list_index_device].m_arrCounterSubdevices[0]	);

        printf( "\n\nPWM Stopped!\n\n");
    }

    delete []arrPWMDevices;

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIOMEphistoScopeStreamRead C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIOMEphistoScopeStreamRead C++ Testprogram

// Con_meIOMEphistoScopeStreamRead.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <stdio.h>
#include <conio.h>

#include <memory.h>

#include <string.h>

extern "C"
{
#include "..\\medriver.h"
}

#include "..\\TestConsoleGeneric.h"

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

#define MODE_ANALOG_OSCILLOSCOPE								1
#define MODE_ANALOG_DATA_LOGGER									2
#define MODE_DIGITAL_OSCILLOSCOPE								3
#define MODE_DIGITAL_DATA_LOGGER								4

#define ANALOG_TRIGGER_TYPE_MANUAL								1
#define ANALOG_TRIGGER_TYPE_THRESHOLD_ABOVE						2
#define ANALOG_TRIGGER_TYPE_THRESHOLD_BELOW						3
#define ANALOG_TRIGGER_TYPE_WINDOW_ENTER						4
#define ANALOG_TRIGGER_TYPE_WINDOW_LEAVE						5
#define ANALOG_TRIGGER_TYPE_EDGE_RISING							6
#define ANALOG_TRIGGER_TYPE_EDGE_FALLING						7
#define ANALOG_TRIGGER_TYPE_SLOPE_POSITIVE						8
#define ANALOG_TRIGGER_TYPE_SLOPE_NEGATIVE						9
#define ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING		10
#define ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING		11

#define DIGITAL_TRIGGER_TYPE_MANUAL								101
#define DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING		102
#define DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING		103
#define DIGITAL_TRIGGER_TYPE_BIT_PATTERN						104

int iOscilloscopeBufferSize = 0;

int* piOscilloscopeBuffer = NULL;

int _tmain(int argc, _TCHAR* argv[])
{
    // Call generic console function in parent directory to
    // open system and list the available devices and subdevices.

    int i_number_of_devices = TestConsoleMEIDSProlog();

    if(i_number_of_devices <= 0)
    {
        return(-1);
    }

    // ---------------------------------------------------------------------

    int i_mephisto_scope_device	= -1;
    int i_stream_read_subdevice = -1;

    // Search for a MEphisto Scope device in the system

    int i_me_error;

    // Iterate through the devices in the system

    for(int index_device = 0; index_device < i_number_of_devices; index_device++)
    {
        char sz_device_name[ME_DEVICE_NAME_MAX_COUNT];

        // Query the device name

        i_me_error = meQueryNameDevice(index_device, &sz_device_name[0], ME_DEVICE_NAME_MAX_COUNT);

        // If the device name begins with "MEphisto Scope" (for example "MEphisto Scope 1") then we have found a suitable device

        if( strnicmp("MEphisto Scope", &sz_device_name[0], strlen("MEphisto Scope") ) == 0 )
        {
            // We've found a MEPhisto Scope device, make sure it is 'plugged in', that's to say actually present in the system.

            int i_vendor_id;
            int i_device_id;
            int i_serial_no;
            int i_bus_type;
            int i_bus_no;
            int i_dev_no;
            int i_func_no;
            int i_plugged;

            i_me_error = meQueryInfoDevice(	index_device,				// Device index
                                            &i_vendor_id,				// Vendor ID returned here - not required
                                            &i_device_id,				// Device ID returned here - not required
                                            &i_serial_no,				// Serial number returned here - not required
                                            &i_bus_type,				// Bus type returned here - not required
                                            &i_bus_no,					// Bus number returned here - not required
                                            &i_dev_no,					// Bus device number returned here - not required
                                            &i_func_no,					// Bus function number returned here - not required
                                            &i_plugged				);	// Plugged status returned hee - not required

            if(i_plugged != ME_PLUGGED_IN)
            {
                // The device isn't present at the moment, continue the search.

                continue;
            }

            // Search for the AI-Streaming sub-device on this device.
            // If we know exactly which device we're dealing with then we would have this information anyway, but this
            // is the proper, flexible way to do things.

            i_me_error = meQuerySubdeviceByType(index_device,					// Device
                                                0,								// Begin search at this sub-device
                                                ME_TYPE_AI,						// Type of sub-device to search for
                                                ME_SUBTYPE_STREAMING,			// Sub-type of sub-device to search for
                                                &i_stream_read_subdevice	);	// sub-device index returned here

            if(i_me_error == ME_ERRNO_SUCCESS)
            {
                // In fact, since a MEphisto Scope always has an AI-Streaming sub.device, we don't really need to check
                // for success, but once again this is the flexible way to do things

                i_mephisto_scope_device = index_device;

                break;
            }
        }
    }

    if(i_mephisto_scope_device == -1)
    {
        printf("****    No MEphisto Scope device with AI-Streaming sub-device found in system    ****\n\n");

        printf("Press any key to terminate\n");

        _getch();

        meClose(0);

        return -1;
    }

    printf("Device: %d is a MEphisto Scope device and Subdevice: %d is its AI-Streaming sub-device\n\n", i_mephisto_scope_device, i_stream_read_subdevice);

    bool b_terminate = false;

    char buffer[128];

    while(true)
    {
        int i_mode = 0;

        // Let the user choose the mode

        while(true)
        {
            printf(	"Operation mode:\n\n"
                    "1) Analog Oscilloscope\n"
                    "2) Analog Data Logger\n"
                    "3) Digital Oscilloscope (Logic Analyzer)\n"
                    "4) Digital Data Logger\n\n"	);

            printf("\nYour choice (1 - 4) (RETURN to terminate): ");

            gets(&buffer[0]);

            printf("\n\n");

            if(buffer[0] == 0)
            {
                b_terminate = true;

                break;
            }

            if( (sscanf(&buffer[0], "%d", &i_mode) != 1 ) )
            {
                continue;
            }

            if( (i_mode < 1)||(i_mode > 4) )
            {
                continue;
            }

            break;
        }

        if(b_terminate)
        {
            break;
        }

        int i_number_of_channels_to_sample = 0;

        int i_sample_channels[2];

        int i_channel_range[2];

        double d_channel_physical_min[2];

        double d_channel_physical_max[2];

        double d_channel_offset[2];

        int i_trigger_type;

        int i_trigger_channel;

        int i_trigger_args[2];

        int i_trigger_timeout_seconds;

        int i_memory_depth;

        int i_trigger_point_percent;

        int i_bit_pattern;

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_ANALOG_DATA_LOGGER) )
        {
            // Let the user choose which channels to sample

            // Query the available ranges so that we can present the user with a list

            // First query the number of the available ranges

            int i_number_of_ranges;

            i_me_error =  meQueryNumberRanges(	i_mephisto_scope_device,		// Device index
                                                i_stream_read_subdevice,		// Subdevice index,
                                                ME_UNIT_ANY,					// Unit
                                                &i_number_of_ranges		);		// Number of ranges returned here

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meQueryNumberRanges - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to terminate\n");

                _getch();

                meClose(0);

                return -1;
            }

            // Now make a list of the ranges

            double* p_d_range_physical_minimum = new double[i_number_of_ranges];

            double* p_d_range_physical_maximum = new double[i_number_of_ranges];

            for(int index_range = 0; index_range < i_number_of_ranges; index_range++)
            {
                int i_unit;

                int i_digital_max;

                i_me_error = meQueryRangeInfo(	i_mephisto_scope_device,						// Device index
                                                i_stream_read_subdevice,						// Subdevice index,
                                                index_range,									// Range index
                                                &i_unit,										// Unit returned here - not require
                                                &p_d_range_physical_minimum[index_range],		// Physical minimum returned here
                                                &p_d_range_physical_maximum[index_range],		// Physical maximum returned here
                                                &i_digital_max								);	// Digital maximum value returned here

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("****    meQueryRangeInfo - Error: %d    ****\n\n", i_me_error);

                    printf("Press any key to terminate\n");

                    _getch();

                    meClose(0);

                    return -1;
                }
            }

            // Ask the user for each channel in turn whether he wishes to sample it, and if so which range he wants to use

            for(int index_channel = 0; index_channel < 2; index_channel++)
            {
                while(true)
                {
                    printf("Sample Channel %d (Y/N) (RETURN to terminate): ", index_channel + 1);

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    if( (buffer[0] == 'y')||(buffer[0] == 'Y') )
                    {
                        // User wants to sample this channel, let him choose the range.

                        int index_range;

                        while(true)
                        {
                            printf("Choose Range:\n\n");

                            for(index_range = 0; index_range < i_number_of_ranges; index_range++)
                            {
                                printf("%2d.   %8.3f - %8.3f Volt\n",
                                index_range + 1,
                                p_d_range_physical_minimum[index_range],
                                p_d_range_physical_maximum[index_range]	 );
                            }

                            printf("\nYour choice (1 - %2d) (RETURN to terminate): ", i_number_of_ranges);

                            gets(&buffer[0]);

                            printf("\n\n");

                            if(buffer[0] == 0)
                            {
                                b_terminate = true;

                                break;
                            }

                            if( (sscanf(&buffer[0], "%d", &index_range) != 1 ) )
                            {
                                continue;
                            }

                            if( (index_range < 1)||(index_range > i_number_of_ranges) )
                            {
                                continue;
                            }

                            --index_range; // Range index starts at 0

                            break;
                        }

                        if(b_terminate)
                        {
                            break;
                        }

                        double d_offset;

                        while(true)
                        {
                            printf("Offset in Volts (RETURN to terminate): ");

                            gets(&buffer[0]);

                            printf("\n\n");

                            if(buffer[0] == 0)
                            {
                                b_terminate = true;

                                break;
                            }

                            double d_required_offset;

                            if( (sscanf(&buffer[0], "%lf", &d_required_offset) != 1 ) )
                            {
                                continue;
                            }

                            d_offset = d_required_offset;

                            meIOSetChannelOffset(	i_mephisto_scope_device,			// Device index
                                                    i_stream_read_subdevice,			// Sub-device index
                                                    index_channel,						// Channel index
                                                    index_range,						// Range index
                                                    &d_offset,							// Required offset, actual offset returned here
                                                    ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS);	// Flags

                            printf("Offset of %f Volts required - %f Volts will be used\n\n", d_required_offset, d_offset);

                            printf("Press any key to continue\n\n");

                            getch();

                            break;
                        }

                        if(b_terminate)
                        {
                            break;
                        }

                        i_sample_channels[i_number_of_channels_to_sample] = index_channel;
                        i_channel_range[i_number_of_channels_to_sample] = index_range;

                        d_channel_physical_min[i_number_of_channels_to_sample] = p_d_range_physical_minimum[index_range];

                        d_channel_physical_max[i_number_of_channels_to_sample] = p_d_range_physical_maximum[index_range];

                        d_channel_offset[i_number_of_channels_to_sample] = d_offset;

                        ++i_number_of_channels_to_sample;

                        break;
                    }
                    else if( (buffer[0] == 'n')||(buffer[0] == 'N') )
                    {
                        break;
                    }
                }

                if(b_terminate)
                {
                    break;
                }
            }

            delete p_d_range_physical_minimum;

            delete p_d_range_physical_maximum;

            if(b_terminate)
            {
                break;
            }

            if(i_number_of_channels_to_sample <= 0)
            {
                printf("Please choose at least one channel to sample\n\n");

                printf("Press any key to continue\n\n");

                getch();

                continue;
            }

            // Let the user choose the trigger type

            while(true)
            {
                printf(	"Trigger type:\n\n"
                        " 1) Manual (Software)\n"
                        " 2) Threshold, above\n"
                        " 3) Threshold, below\n"
                        " 4) Window, on entering\n"
                        " 5) Window, on leaving\n"
                        " 6) Edge, rising\n"
                        " 7) Edge, falling\n"
                        " 8) Slope, positive\n"
                        " 9) Slope, negative\n"
                        "10) External digital, falling edge\n"
                        "11) External digital, rising edge\n\n"	);

                printf("\nYour choice (1 - 11) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_trigger_type) != 1 ) )
                {
                    continue;
                }

                if( (i_trigger_type < 1)||(i_trigger_type > 11) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            if( (i_trigger_type != ANALOG_TRIGGER_TYPE_MANUAL)&&(i_trigger_type != ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING)&&(i_trigger_type != ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING) )
            {
                while(true)
                {
                    printf("Trigger channel, 1 or 2 (RETURN to terminate): ");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    if( (sscanf(&buffer[0], "%d", &i_trigger_channel) != 1 ) )
                    {
                        continue;
                    }

                    if( (i_trigger_channel != 1)&&(i_trigger_channel != 2) )
                    {
                        continue;
                    }

                    --i_trigger_channel;

                    break;
                }
            }

            if(b_terminate)
            {
                break;
            }

            // Additional parameters for the various trigger types

            if( (i_trigger_type == ANALOG_TRIGGER_TYPE_THRESHOLD_ABOVE)||
                        (i_trigger_type == ANALOG_TRIGGER_TYPE_THRESHOLD_BELOW)||
                                (i_trigger_type == ANALOG_TRIGGER_TYPE_EDGE_RISING)||
                                    (i_trigger_type == ANALOG_TRIGGER_TYPE_EDGE_FALLING) )
            {
                while(true)
                {
                    printf("Threshold in Volts (RETURN to terminate): ");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    double d_volts;

                    if( (sscanf(&buffer[0], "%lf", &d_volts) != 1 ) )
                    {
                        continue;
                    }

                    // ME-iDS requires this parameter in microvolts

                    i_trigger_args[0] = (int)(d_volts * 1000000.0);

                    break;
                }

                if(b_terminate)
                {
                    break;
                }
            }
            else if( (i_trigger_type == ANALOG_TRIGGER_TYPE_WINDOW_ENTER)||
                                (i_trigger_type == ANALOG_TRIGGER_TYPE_WINDOW_LEAVE) )
            {
                while(true)
                {
                    printf("Fenster upper limit in Volts (RETURN to terminate): ");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    double d_volts;

                    if( (sscanf(&buffer[0], "%lf", &d_volts) != 1 ) )
                    {
                        continue;
                    }

                    // ME-iDS requires this parameter in microvolts

                    i_trigger_args[0] = (int)(d_volts * 1000000.0);

                    break;
                }

                if(b_terminate)
                {
                    break;
                }

                while(true)
                {
                    printf("Fenster lower limit in Volts (RETURN to terminate): ");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    double d_volts;

                    if( (sscanf(&buffer[0], "%lf", &d_volts) != 1 ) )
                    {
                        continue;
                    }

                    // ME-iDS requires this parameter in microvolts

                    i_trigger_args[1] = (int)(d_volts * 1000000.0);

                    break;
                }

                if(b_terminate)
                {
                    break;
                }
            }
            else if( (i_trigger_type == ANALOG_TRIGGER_TYPE_SLOPE_POSITIVE)||
                        (i_trigger_type == ANALOG_TRIGGER_TYPE_SLOPE_NEGATIVE) )
            {
                while(true)
                {
                    printf("Slope in Volts per sample(RETURN to terminate): ");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    double d_volts;

                    if( (sscanf(&buffer[0], "%lf", &d_volts) != 1 ) )
                    {
                        continue;
                    }

                    // ME-iDS requires this parameter in microvolts per sample

                    i_trigger_args[0] = (int)(d_volts * 1000000.0);

                    break;
                }

                if(b_terminate)
                {
                    break;
                }
            }

        }
        else if( (i_mode == MODE_DIGITAL_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_DATA_LOGGER) )
        {
            // Let the user choose the trigger type

            i_number_of_channels_to_sample = 1;

            while(true)
            {
                printf(	"Trigger type:\n\n"
                        "1) Manual (Software)\n"
                        "2) External digital, falling edge\n"
                        "3) External digital, rising edge\n"
                        "4) Bit Pattern\n\n"					);

                printf("\nYour choice (1 - 4) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_trigger_type) != 1 ) )
                {
                    continue;
                }

                if( (i_trigger_type < 1)||(i_trigger_type > 4) )
                {
                    continue;
                }

                i_trigger_type+= 100;

                break;
            }

            if(b_terminate)
            {
                break;
            }

            // Additional parameter for bit pattern trigger

            if(i_trigger_type == DIGITAL_TRIGGER_TYPE_BIT_PATTERN)
            {
                while(true)
                {
                    printf("Bit pattern (RETURN to terminate): 0X");

                    gets(&buffer[0]);

                    printf("\n\n");

                    if(buffer[0] == 0)
                    {
                        b_terminate = true;

                        break;
                    }

                    if( (sscanf(&buffer[0], "%X", &i_bit_pattern) != 1 ) )
                    {
                        continue;
                    }

                    break;
                }
            }
        }

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            while(true)
            {
                printf("Memory depth (Minimum 100) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_memory_depth) != 1 ) )
                {
                    continue;
                }

                if(i_memory_depth < 100)
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }

            while(true)
            {
                printf("Trigger point, 0 - 100 %% (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_trigger_point_percent) != 1 ) )
                {
                    continue;
                }

                if( (i_trigger_point_percent < 0)||(i_trigger_point_percent > 100) )
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }
        }

        // Time-out

        if( (i_trigger_type != ANALOG_TRIGGER_TYPE_MANUAL)&&(i_trigger_type != DIGITAL_TRIGGER_TYPE_MANUAL) )
        {
            while(true)
            {
                printf("Trigger time-out in seconds ( > 0 ) (RETURN to terminate): ");

                gets(&buffer[0]);

                printf("\n\n");

                if(buffer[0] == 0)
                {
                    b_terminate = true;

                    break;
                }

                if( (sscanf(&buffer[0], "%d", &i_trigger_timeout_seconds) != 1 ) )
                {
                    continue;
                }

                if(i_trigger_timeout_seconds < 1)
                {
                    continue;
                }

                break;
            }

            if(b_terminate)
            {
                break;
            }
        }

        double d_required_sampling_time = 0.1;
        double d_achieved_sampling_time = d_required_sampling_time;

        int i_conv_ticks_low = 0;
        int i_conv_ticks_high = 0;

        int i_flags;

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            i_flags = ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE;
        }
        else
        {
            i_flags = ME_IO_TIME_TO_TICKS_NO_FLAGS;
        }

        i_me_error = meIOStreamTimeToTicks(	i_mephisto_scope_device,			// Device index
                                            i_stream_read_subdevice,			// Subdevice index,
                                            ME_TIMER_CONV_START,				// Timer used
                                            &d_achieved_sampling_time,			// Required sampling time un seconds, Achieved sampling time returned here
                                            &i_conv_ticks_low,					// Lower 32 bits of the corresponding tick value returned here
                                            &i_conv_ticks_high,					// Upper 32 bits of the corresponding tick value returned here
                                            i_flags						);		// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamTimeToTicks - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("meIOStreamTimeToTicks - Required Sampling Time: %f Achieved Sampling Time: %f Ticks low: %d Ticks high: %d\n\n", d_required_sampling_time, d_achieved_sampling_time, i_conv_ticks_low, i_conv_ticks_high);

        meIOStreamConfig_t arr_stream_config[2];

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_ANALOG_DATA_LOGGER) )
        {
            for(int index_channel = 0; index_channel < i_number_of_channels_to_sample; index_channel++)
            {
                arr_stream_config[index_channel].iChannel = i_sample_channels[index_channel];

                arr_stream_config[index_channel].iStreamConfig = i_channel_range[index_channel];

                arr_stream_config[index_channel].iRef = ME_REF_AI_GROUND;

                arr_stream_config[index_channel].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;
            }
        }
        else // if( (i_mode == MODE_DIGITAL_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_DATA_LOGGER) )
        {
            i_number_of_channels_to_sample = 1;

            arr_stream_config[0].iChannel = 0;

            arr_stream_config[0].iStreamConfig = 0;

            arr_stream_config[0].iRef = ME_REF_AI_GROUND;

            arr_stream_config[0].iFlags = ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS;
        }

        meIOStreamTrigger_t stream_trigger;

        memset( &stream_trigger, 0, sizeof(meIOStreamTrigger_t) );

        switch(i_trigger_type)
        {
        case ANALOG_TRIGGER_TYPE_MANUAL:
        case DIGITAL_TRIGGER_TYPE_MANUAL:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SW;

            stream_trigger.iAcqStartTrigChan = ME_TRIG_CHAN_DEFAULT;

            break;

        case ANALOG_TRIGGER_TYPE_THRESHOLD_ABOVE:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_THRESHOLD;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_ABOVE;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_THRESHOLD_BELOW:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_THRESHOLD;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_BELOW;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_WINDOW_ENTER:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_WINDOW;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_ENTRY;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            stream_trigger.iAcqStartArgs[1] = i_trigger_args[1];

            break;

        case ANALOG_TRIGGER_TYPE_WINDOW_LEAVE:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_WINDOW;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_EXIT;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            stream_trigger.iAcqStartArgs[1] = i_trigger_args[1];

            break;

        case ANALOG_TRIGGER_TYPE_EDGE_RISING:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_EDGE;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_RISING;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_EDGE_FALLING:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_EDGE;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_FALLING;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_SLOPE_POSITIVE:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SLOPE;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_RISING;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_SLOPE_NEGATIVE:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_SLOPE;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_FALLING;

            stream_trigger.iAcqStartTrigChan = i_trigger_channel;

            stream_trigger.iAcqStartArgs[0] = i_trigger_args[0];

            break;

        case ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING:
        case DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_EXT_DIGITAL;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_RISING;

            break;

        case ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING:
        case DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_EXT_DIGITAL;

            stream_trigger.iAcqStartTrigEdge = ME_TRIG_EDGE_FALLING;

            break;

        case DIGITAL_TRIGGER_TYPE_BIT_PATTERN:

            stream_trigger.iAcqStartTrigType = ME_TRIG_TYPE_PATTERN;

            stream_trigger.iAcqStartTrigChan = i_bit_pattern;

            break;
        }

        stream_trigger.iAcqStartTicksLow = 0;
        stream_trigger.iAcqStartTicksHigh = 0;
        // int iAcqStartArgs[10];
        stream_trigger.iScanStartTrigType = ME_TRIG_TYPE_FOLLOW;
        stream_trigger.iScanStartTicksLow = 0;
        stream_trigger.iScanStartTicksHigh = 0;
        //int iScanStartArgs[10];
        stream_trigger.iConvStartTrigType = ME_TRIG_TYPE_TIMER;
        stream_trigger.iConvStartTicksLow = i_conv_ticks_low;
        stream_trigger.iConvStartTicksHigh = i_conv_ticks_high;
        //int iConvStartArgs[10];

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            stream_trigger.iScanStopTrigType = ME_TRIG_TYPE_COUNT;

            stream_trigger.iScanStopCount = i_memory_depth;

            stream_trigger.iScanStopArgs[0] = i_trigger_point_percent;
        }

        // int iScanStopTrigType;
        // int iScanStopCount;
        // int iScanStopArgs[10];
        // int iAcqStopTrigType;
        // int iAcqStopCount;
        // int iAcqStopArgs[10];
        stream_trigger.iFlags = ME_IO_STREAM_TRIGGER_TYPE_NO_FLAGS;

        if( (i_mode == MODE_DIGITAL_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_DATA_LOGGER) )
        {
            i_flags = ME_IO_STREAM_CONFIG_BIT_PATTERN;
        }
        else
        {
            i_flags = ME_IO_STREAM_CONFIG_NO_FLAGS;
        }

        i_me_error = meIOStreamConfig(	i_mephisto_scope_device,			// Device index
                                        i_stream_read_subdevice,			// Subdevice index,
                                         &arr_stream_config[0],				// Pointer to an array of meIOStreamConfig_t structures
                                        i_number_of_channels_to_sample,		// Number of elements in the stream config array above
                                        &stream_trigger,					// Pointer to an meIOStreamTrigger_t structure
                                        0,									// FIFO IRQ threshold - Not used in the MEphisto Scope
                                        i_flags							);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamConfig - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("\n\n");

        switch(i_mode)
        {
        case MODE_ANALOG_OSCILLOSCOPE:

            printf("Calling the Analog Oscilloscope with the following parameters:\n\n");

            break;

        case MODE_ANALOG_DATA_LOGGER:

            printf("Calling the Analog Data Logger with the following parameters:\n\n");

            break;

        case MODE_DIGITAL_OSCILLOSCOPE:

            printf("Calling the Digital Oscilloscope (Logic Analyzer) with the following parameters:\n\n");

            break;

        case MODE_DIGITAL_DATA_LOGGER:

            printf("Calling the Digital Data Logger with the following parameters:\n\n");

            break;
        }

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_ANALOG_DATA_LOGGER) )
        {
            printf("    Sampled channels:\n\n");

            for(int index_channel = 0; index_channel < i_number_of_channels_to_sample; index_channel++)
            {
                printf(	"        %d. Channel: %d    Range: %5.2f - %5.2f Volts\n",
                        index_channel + 1,
                        i_sample_channels[index_channel] + 1,
                        d_channel_physical_min[index_channel] + d_channel_offset[index_channel],
                        d_channel_physical_max[index_channel] + d_channel_offset[index_channel]				);
            }

            printf("\n");
        }

        printf("    Sampling Time: %f Seconds\n\n", d_achieved_sampling_time);

        if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            printf("    Memory depth:  %d Samples\n", stream_trigger.iScanStopCount);
            printf("    Trigger point: %d %%\n\n", stream_trigger.iScanStopArgs[0]);
        }

        printf("    Trigger type\n\n");

        switch(i_trigger_type)
        {
        case ANALOG_TRIGGER_TYPE_MANUAL:
        case DIGITAL_TRIGGER_TYPE_MANUAL:

            printf("        Manual\n");

            break;

        case ANALOG_TRIGGER_TYPE_THRESHOLD_ABOVE:

            printf("        Above Threshold at: %7.3f Volt\n", (double)stream_trigger.iAcqStartArgs[0] / 10000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_THRESHOLD_BELOW:

            printf("        Below Threshold at: %7.3f Volt\n", (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_WINDOW_ENTER:

            printf("        Enter Window from: %7.3f Volt to %7.3f Volt\n", (double)stream_trigger.iAcqStartArgs[1] / 1000000.0, (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_WINDOW_LEAVE:

            printf("        Leave Window from: %7.3f Volt to %7.3f Volt\n", (double)stream_trigger.iAcqStartArgs[1] / 1000000.0, (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_EDGE_RISING:

            printf("        Cross the Threshold at %7.3f Volt from above\n", (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_EDGE_FALLING:

            printf("        Cross the Threshold at %7.3f Volt from below\n", (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_SLOPE_POSITIVE:

            printf("        Positive slope greater than %7.3f Volts / Sample\n", (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_SLOPE_NEGATIVE:

            printf("        Negative slope greater than %7.3f Volts / Sample\n", (double)stream_trigger.iAcqStartArgs[0] / 1000000.0);

            break;

        case ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING:
        case DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_RISING:
            printf("        Digital signal, rising edge\n");

            break;

        case ANALOG_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING:
        case DIGITAL_TRIGGER_TYPE_EXTERNAL_DIGITAL_EDGE_FALLING:

            printf("        Digital signal, falling edge\n");

            break;

        case DIGITAL_TRIGGER_TYPE_BIT_PATTERN:

            printf("        Digital pattern: 0x%08X\n", stream_trigger.iAcqStartTrigChan);

            break;
        }

        if( (i_trigger_type == ANALOG_TRIGGER_TYPE_THRESHOLD_ABOVE)||
                (i_trigger_type == ANALOG_TRIGGER_TYPE_THRESHOLD_BELOW)||
                    (i_trigger_type == ANALOG_TRIGGER_TYPE_WINDOW_ENTER)||
                        (i_trigger_type == ANALOG_TRIGGER_TYPE_WINDOW_LEAVE)||
                            (i_trigger_type == ANALOG_TRIGGER_TYPE_EDGE_RISING)||
                                (i_trigger_type == ANALOG_TRIGGER_TYPE_EDGE_FALLING)||
                                    (i_trigger_type == ANALOG_TRIGGER_TYPE_SLOPE_POSITIVE)||
                                        (i_trigger_type == ANALOG_TRIGGER_TYPE_SLOPE_NEGATIVE) )
        {
            printf("        Trigger channel: %d\n\n", i_trigger_channel);
        }
        else
        {
            printf("\n");
        }

        printf("Press any key to start the acquisition\n\n");

        if( (i_mode == MODE_ANALOG_DATA_LOGGER)||(i_mode == MODE_DIGITAL_DATA_LOGGER) )
        {
            printf("Press the ESC key at any time to end the acquisition\n\n");
        }
        else // if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            printf("Then please wait until all the data is available\n\n");
        }

        _getch();

        meIOStreamStart_t arr_stream_start[1];

        arr_stream_start[0].iDevice = i_mephisto_scope_device;
        arr_stream_start[0].iSubdevice = i_stream_read_subdevice;
        arr_stream_start[0].iStartMode = ME_START_MODE_BLOCKING;

        if( (i_trigger_type == ANALOG_TRIGGER_TYPE_MANUAL)||(i_trigger_type == DIGITAL_TRIGGER_TYPE_MANUAL) )
        {
            arr_stream_start[0].iTimeOut = 0;
        }
        else
        {
            arr_stream_start[0].iTimeOut = i_trigger_timeout_seconds * 1000;	// ME-iDS time-out is in milliseconds
        }

        arr_stream_start[0].iFlags = ME_IO_STREAM_START_TYPE_NO_FLAGS;
        arr_stream_start[0].iErrno = 0;

        i_me_error = meIOStreamStart(	&arr_stream_start[0],			// Pointer to an array of meIOStreamStart_t structures
                                        1,								// Number of elements in the stream start array above
                                        ME_IO_STREAM_START_NO_FLAGS	);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStart - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return -1;
        }

        printf("Acquisition started\n\n");

        if( (i_mode == MODE_ANALOG_DATA_LOGGER)||(i_mode == MODE_DIGITAL_DATA_LOGGER) )
        {
            while(true)
            {
                if( _kbhit() != 0 )
                {
                    if(_getch() == 27)
                    {
                        break;
                    }
                }

                int i_buffer[4096];

                int i_count = 10;

                i_me_error = meIOStreamRead(i_mephisto_scope_device,		// Device index
                                            i_stream_read_subdevice,		// Subdevice index,
                                            ME_READ_MODE_BLOCKING,			// Read mode
                                            &i_buffer[0],					// Acquired data values returned in this buffer
                                            &i_count,						// Size of buffer in data values - Number of data values returned here
                                            ME_IO_STREAM_READ_NO_FLAGS);	// No flags

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

                    printf("Press any key to end the acquisition\n");

                    _getch();

                    break;
                }

                for(int index_value = 0; index_value < i_count; )
                {
                    for(int index_channel = 0; index_channel < i_number_of_channels_to_sample; index_channel++)
                    {
                        if(i_mode == MODE_ANALOG_DATA_LOGGER)
                        {
                            double d_volt;

                            i_me_error =  meUtilityDigitalToPhysical(	d_channel_physical_min[index_channel],		// Min physical value
                                                                        d_channel_physical_max[index_channel],		// Max physical value
                                                                        0xFFFF,										// Maximum digital value
                                                                        i_buffer[index_value],						// Digital value to convert
                                                                        ME_MODULE_TYPE_MULTISIG_NONE,				// Module type - not used
                                                                        0.0,										// Reference value - not used
                                                                        &d_volt									);	// Converted physical value returned here

                            printf( "%5d  -  %5.2lf V    ", i_buffer[index_value], d_volt + d_channel_offset[index_channel] );
                        }
                        else
                        {
                            printf( "0X%04X", (unsigned short)i_buffer[index_value] );
                        }

                        index_value++;
                    }

                    printf("\n");
                }
            }
        }
        else // if( (i_mode == MODE_ANALOG_OSCILLOSCOPE)||(i_mode == MODE_DIGITAL_OSCILLOSCOPE) )
        {
            // In this mode all the data has to be read in one action

            if(stream_trigger.iScanStopCount > iOscilloscopeBufferSize)
            {
                if(piOscilloscopeBuffer != NULL)
                {
                    delete piOscilloscopeBuffer;
                }

                iOscilloscopeBufferSize = stream_trigger.iScanStopCount;

                piOscilloscopeBuffer = new int[iOscilloscopeBufferSize];
            }

            int i_count = stream_trigger.iScanStopCount;

            i_me_error = meIOStreamRead(i_mephisto_scope_device,		// Device index
                                        i_stream_read_subdevice,		// Subdevice index,
                                        ME_READ_MODE_BLOCKING,			// Read mode
                                        &piOscilloscopeBuffer[0],		// Acquired data values returned in this buffer
                                        &i_count,						// Size of buffer in data values - Number of data values returned here
                                        ME_IO_STREAM_READ_NO_FLAGS);	// No flags

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("****    meIOStreamRead - Error: %d    ****\n\n", i_me_error);

                printf("Press any key to end the acquisition\n");

                _getch();

                break;
            }

            for(int index_value = 0; index_value < i_count; )
            {
                printf("%5d.    ", index_value + 1);

                for(int index_channel = 0; index_channel < i_number_of_channels_to_sample; index_channel++)
                {
                    if(i_mode == MODE_ANALOG_OSCILLOSCOPE)
                    {
                        double d_volt;

                        i_me_error =  meUtilityDigitalToPhysical(	d_channel_physical_min[index_channel],		// Min physical value
                                                                    d_channel_physical_max[index_channel],		// Max physical value
                                                                    0xFFFF,										// Maximum digital value
                                                                    piOscilloscopeBuffer[index_value],			// Digital value to convert
                                                                    ME_MODULE_TYPE_MULTISIG_NONE,				// Module type - not used
                                                                    0.0,										// Reference value - not used
                                                                    &d_volt									);	// Converted physical value returned here

                        printf("%5d  -  %5.2lf V    ", piOscilloscopeBuffer[index_value], d_volt + d_channel_offset[index_channel]);
                    }
                    else
                    {
                        printf("0X%04X", (unsigned short)piOscilloscopeBuffer[index_value] );
                    }

                    index_value++;
                }

                printf("\n");
            }
        }

        meIOStreamStop_t arr_stream_stop[1];

        arr_stream_stop[0].iDevice = i_mephisto_scope_device;
        arr_stream_stop[0].iSubdevice = i_stream_read_subdevice;
        arr_stream_stop[0].iStopMode = ME_STOP_MODE_IMMEDIATE;
        arr_stream_stop[0].iFlags = ME_IO_STREAM_STOP_TYPE_NO_FLAGS;
        arr_stream_stop[0].iErrno = 0;

        i_me_error = meIOStreamStop(&arr_stream_stop[0],			// Pointer to an array of meIOStreamStop_t structures
                                    1,								// Number of elements in the stream stop array above
                                    ME_IO_STREAM_STOP_NO_FLAGS);	// No flags

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("****    meIOStreamStop - Error: %d    ****\n\n", i_me_error);

            printf("Press any key to terminate\n");

            _getch();

            meClose(0);

            return(-1);
        }

        printf("Acquisition ended\n\n");

        printf("Press any key to continue\n");

        getch();
    }

    // ---------------------------------------------------------------------

    meClose(0);

    printf("Program completed successfully - Press any key to terminate\n\n");

    _getch();

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Con_meIDSSystemProperties C++ Testprogram

  • Description of the C++ Console Test Programs

Con_meIDSSystemProperties C++ Testprogram

// TestConsole_meIDSSystemProperties.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <windows.h>

#include <stdio.h>
#include <conio.h>

#include <memory.h>

extern "C"
{
#include "..\\medriver.h"
}

#ifdef WIN64

#pragma comment (lib, "..\\meIDSmain64.lib")

#else

#pragma comment (lib, "..\\meIDSmain.lib")

#endif

int iIndent;

char szIndent[64];

int PrintContainerProperties(char* szContainerPath);

int _tmain(int argc, _TCHAR* argv[])
{
    // Increase the size of the console buffer

    HANDLE  h_console = GetStdHandle(STD_OUTPUT_HANDLE);

    COORD coord;

    coord.X = 160;

    coord.Y = 2000;

    SetConsoleScreenBufferSize(h_console, coord);

    printf("Press any key to continue\n");

    getch();

    // Enable the default error procedure

    meErrorSetDefaultProc(ME_SWITCH_ENABLE);

    // Open the driver system

    int i_me_error = meOpen(0);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("****    meOpen - Error: %d    ****\n\n", i_me_error);

        printf("Press any key to terminate\n\n");

        _getch();

        return(-1);
    }

    iIndent = 0;

    szIndent[0] = 0;

    // Use the routine PrintContainerProperties below to print the properties of the root container "\\".

    // As this routine is recursive (it is called internally recursívely for each container found in the
    // container it is processing) it will thus print all the proerties found in the system.

    i_me_error = PrintContainerProperties("\\");

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("PrintContainerProperties, <%s> - Error: %d\n", "\\", i_me_error);
    }

    meClose(0);

    printf(	"Press any key to terminate\n\n");

    getch();

    return 0;
}

int PrintContainerProperties(char* szContainerPath)
{
    char sz_buffer[1024];

    strcpy_s(&sz_buffer[0], 1024, szContainerPath);

    strcat_s(&sz_buffer[0], 1024, "\\NumberOfElements");

    int i_number_of_elements;

    int i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_number_of_elements);

    if(i_me_error != ME_ERRNO_SUCCESS)
    {
        printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
    }

    for(int index_element = 0; index_element < i_number_of_elements; index_element++)
    {
        sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\PropertyName", szContainerPath, index_element);

        char sz_name[64];

        i_me_error = mePropertyGetStringA(&sz_buffer[0], &sz_name[0], 64);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("mePropertyGetStringA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
        }

        sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\PropertyType", szContainerPath, index_element);

        int i_property_type;

        i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_property_type);

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
        }

        sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\PropertyDescription", szContainerPath, index_element);

        char sz_property_description[1024];

        i_me_error = mePropertyGetStringA( &sz_buffer[0], &sz_property_description[0], 1024 );

        if(i_me_error != ME_ERRNO_SUCCESS)
        {
            printf("mePropertyGetStringA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
        }

        if(i_property_type == ME_PROPERTY_TYPE_CONTAINER)
        {
            printf("%s%s - Beschreibung: %s\n", &szIndent[0], &sz_name[0], &sz_property_description[0]);

            sprintf_s(&sz_buffer[0], 1024, "%s\\%s", szContainerPath, &sz_name[0]);

            iIndent+= 4;

            memset(&szIndent[0], ' ', iIndent);

            szIndent[iIndent] = 0;

            i_me_error = PrintContainerProperties( &sz_buffer[0] );

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("PrintContainerProperties, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
            }

            iIndent-= 4;

            szIndent[iIndent] = 0;
        }
        else
        {
            sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\PropertyAccess", szContainerPath, index_element);

            int i_access_type;

            i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_access_type);

            if(i_me_error != ME_ERRNO_SUCCESS)
            {
                printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
            }

            sprintf_s(&sz_buffer[0], 1024, "%s\\%d", szContainerPath, index_element);

            switch(i_property_type)
            {
            case ME_PROPERTY_TYPE_BOOL:

                int b_value;

                i_me_error = mePropertyGetIntA(&sz_buffer[0], &b_value);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                printf("%s%s    %s    %s - Beschreibung: %s\n", &szIndent[0], &sz_name[0], ( (b_value == 0) ? "False" : "True" ), ( (i_access_type == ME_PROPERTY_ACCESS_READ_ONLY) ? "Read only" : "Read/Write" ), &sz_property_description[0] );

                if(i_access_type == ME_PROPERTY_ACCESS_READ_WRITE)
                {
                    i_me_error = mePropertySetIntA(&sz_buffer[0], b_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertySetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }
                }

                break;

            case ME_PROPERTY_TYPE_INT:

                int i_value;

                i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_value);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_WRITE)
                {
                    i_me_error = mePropertySetIntA(&sz_buffer[0], i_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertySetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_ONLY)
                {
                    printf("%s%s    %d    Read only - Beschreibung: %s\n", &szIndent[0], &sz_name[0], i_value, &sz_property_description[0]);
                }
                else
                {
                    sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\MinValue", szContainerPath, index_element);

                    int i_min_value;

                    i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_min_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }

                    sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\MaxValue", szContainerPath, index_element);

                    int i_max_value;

                    i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_max_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }

                    printf("%s%s    %d    (Range %d - %d) Read/Write - Beschreibung: %s\n", &szIndent[0], &sz_name[0], i_value, i_min_value, i_max_value, &sz_property_description[0]);
                }

                break;

            case ME_PROPERTY_TYPE_DOUBLE:

                double d_value;

                i_me_error = mePropertyGetDoubleA(&sz_buffer[0], &d_value);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetDoubleA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_WRITE)
                {
                    i_me_error = mePropertySetDoubleA(&sz_buffer[0], d_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertySetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_ONLY)
                {
                    printf("%s%s    %lg    Read only - Beschreibung: %s\n", &szIndent[0], &sz_name[0], d_value, &sz_property_description[0]);
                }
                else
                {
                    sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\MinValue", szContainerPath, index_element);

                    double d_min_value;

                    i_me_error = mePropertyGetDoubleA(&sz_buffer[0], &d_min_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertyGetDoubleA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }

                    sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\MaxValue", szContainerPath, index_element);

                    double d_max_value;

                    i_me_error = mePropertyGetDoubleA(&sz_buffer[0], &d_max_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertyGetDoubleA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }

                    printf("%s%s    %lg    (Range %lg - %lg) Read/Write - Beschreibung: %s\n", &szIndent[0], &sz_name[0], d_value, d_min_value, d_max_value, &sz_property_description[0]);
                }

                break;

            case ME_PROPERTY_TYPE_STRING:

                char sz_value[512];

                i_me_error = mePropertyGetStringA(&sz_buffer[0], &sz_value[0], 512);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetStringA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                printf("%s%s    %s    %s - Beschreibung: %s\n", &szIndent[0], &sz_name[0], &sz_value[0], ( (i_access_type == ME_PROPERTY_ACCESS_READ_ONLY) ? "Read only" : "Read/Write" ), &sz_property_description[0] );

                break;

            case ME_PROPERTY_TYPE_DEFINE:

                i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_value);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_WRITE)
                {
                    i_me_error = mePropertySetIntA(&sz_buffer[0], i_value);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertySetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }
                }

                i_me_error = mePropertyGetStringA(&sz_buffer[0], &sz_value[0], 512);

                if(i_me_error != ME_ERRNO_SUCCESS)
                {
                    printf("mePropertyGetStringA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                }

                if(i_access_type == ME_PROPERTY_ACCESS_READ_ONLY)
                {
                    printf("%s%s    %s (0x%08X)    Read only - Beschreibung: %s\n", &szIndent[0], &sz_name[0], &sz_value[0], i_value, &sz_property_description[0]);
                }
                else
                {
                    printf("%s%s    %s (0x%08X)    ( Choices: ", &szIndent[0], &sz_name[0], &sz_value[0], i_value);

                    sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\NumberOfSelections", szContainerPath, index_element);

                    int i_number_of_selections;

                    i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_number_of_selections);

                    if(i_me_error != ME_ERRNO_SUCCESS)
                    {
                        printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                    }

                    for(int i_selection = 0; i_selection < i_number_of_selections; i_selection++)
                    {
                        sprintf_s(&sz_buffer[0], 1024, "%s\\%d\\Selection%d", szContainerPath, index_element, i_selection);

                        i_me_error = mePropertyGetIntA(&sz_buffer[0], &i_value);

                        if(i_me_error != ME_ERRNO_SUCCESS)
                        {
                            printf("mePropertyGetIntA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                        }

                        i_me_error = mePropertyGetStringA(&sz_buffer[0], &sz_value[0], 512);

                        if(i_me_error != ME_ERRNO_SUCCESS)
                        {
                            printf("mePropertyGetStringA, <%s> - Error: %d\n", &sz_buffer[0], i_me_error);
                        }

                        printf("%s (0x%08X)", &sz_value[0], i_value);

                        if(i_selection < i_number_of_selections - 1)
                        {
                            printf(", ");
                        }
                    }

                    printf(" ) Read/Write - Beschreibung: %s\n", &sz_property_description[0]);
                }

                break;
            }
        }
    }

    return 0;
}


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Description of the C-Sharp Test Programs

Description of the C-Sharp Test Programs

The C-Sharp test programs correspond exactly to the C++ console test programs of the same name. See Description of the C++ Console Test Programs

Con_meIDSSystemInfo

See C++ test program Con_meIDSSystemInfo

Con_meIOExtIrqCallback

See C++ test program Con_meIOExtIrqCallback

Con_meIOSingleReadAnalog

See C++ test program Con_meIOSingleReadAnalog

Con_meIOSingleWriteAnalog

See C++ test program Con_meIOSingleWriteAnalog

Con_meIOStreamRead

See C++ test program Con_meIOStreamRead

Con_meIOStreamWrite

See C++ test program Con_meIOStreamWrite

Con_meIOResetDevice

See C++ test program Con_meIOResetDevice

Con_meUtilityPWM

See C++ test program Con_meUtilityPWM


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: FAQ (Frequently Asked Questions).

FAQ (Frequently Asked Questions).

Contents:

  • What is the meaning of the parameter 'iFifoIrqThreshold' in the routine meIOStreamConfig and what is a suitable value to use here?
  • How can I read or write a single bit on a digital sub-device (DI/DO/DIO)?
  • Which function in the ME-iDS driver system corresponds to the 'AIScan' function in the former (legacy) ME46xx driver?

What is the meaning of the parameter 'iFifoIrqThreshold' in the routine meIOStreamConfig and what is a suitable value to use here?

This parameter is only meaningful for the AI-Streaming sub-device on the ME-46XX family of boards.
The AI hardware on these boards can be set to generate an interrupt each time a particular number of data values has been sampled. It is this number of data values which is determined directly by the parameter 'iFifoIrqThreshold'.
When the interrupt arrives the data values are removed from the hardware FIFO on the board and put into a much larger software buffer.
It is clear then, that the minimum value for this parameter is 1 and the maximum value is equal to the hardware FIFO size (setting a larger value in the hardware would cause an immediate FIFO overflow, data would be lost and the acquisition would be terminated).

In practice however, this parameter is subject to much more stringent restrictions.

Consider first a slow acquisition let's say at 10 Hz:
If you set iFifoIrqThreshold to 1000 here then an interrupt will only be generated every 100 seconds (10Hz * 100s = 1000 values). Since your application can not even 'see' the data as long as it is still in the hardware FIFO on the board, it will only be able to react to new data every 100 seconds. This is normally not what you want unless processing the data as it arrives is of no importance for you.
If however you set iFifoIrqThreshold to 1 here then 10 interrupts will be generated every second, a rate which any computer can cope with and you will be able to processs every single data value as it arrives.

Now consider a very fast data acquisition, let's say at 500 kHz:
If you set iFifoIrqThreshold to 1 here, this will generate 500,000 interrupts in the second. The system will be unable to cope with this and a FIFO overflow will result almost immediately.
Here it is necessary to set iFifoIrqThreshold to a much larger value, for example half the size of the FIFO. The FIFO size can be determined by calling the routine meQuerySubdeviceCapsArgs for the AI sub-device with the parameter 'iCap' set to 'ME_CAP_AI_FIFO_SIZE'. On standard boards, the FIFO size is 2048 values.

At very high sampling rates you must however be careful not to choose too large a value for iFifoIrqThreshold. Here's an example to illustrate this problem :
Once again we're sampling at 500 kHz with a standard board with a FIFO size of 2048 values. What happens if we set iFifoIrqThreshold to 2024 here?
When the interrupt is generated there are 2024 samples in the FIFO. There is only room in the FIFO for an additional 24 samples. At 500 kHz, these remaining 24 values are sampled in 48 microseconds. In other words, if for any reason (e.g other higher priority interrupts on the system) the internal interrupt routine for the board is delayed by more than these 48 microseconds then the result will also be a FIFO overflow.

In general, at very high sampling speeds, a value for iFifoIrqThreshold between one third and two thirds the FIFO size should be used. However, the optimal value depends on your hardware, on your own application and on the applications and services running concurrently with your application.

Currently, if you enter a value of '0' for iFifoIrqThreshold then the software will internally use a value which is half the size of the FIFO.

Everything said above applies both to the 'standard' PCI and to the synapse versions of the ME-46xx boards. The synapse versions are however not able to reach the highest sampling rates for continuous acquisitions. Furthermore, on the synapse boards, it is important to try and generate as few interrupts as possible.

How can I read or write a single bit on a digital sub-device (DI/DO/DIO)?

The key parameter here is the seventh one, 'iFlags' in the structure meIOSingle. An array of these structures is passed to the routine meIOSingle, one element for each sub-device on which an input or output operation is to be executed.
Possible values for this parameter for a DI, DO or DIO sub-device are ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE, ME_IO_SINGLE_TYPE_DIO_WORD or ME_IO_SINGLE_TYPE_DIO_DWORD.
The meaning of the third parameter in the meIOSingle structure, 'iChannel' depends on the value used for the seventh parameter 'iFlag'. If for example you use ME_IO_SINGLE_TYPE_DIO_BIT for the 'iFlag' parameter in the structure meIOSingle, then channel 0 is bit 0 on the port, channel 1 is bit 1 etc. If on the other hand you use ME_IO_SINGLE_TYPE_DIO_BYTE for the 'iFlag' parameter in the structure meIOSingle, then channel 0 is the first byte on the port, i.e. bits 0 to 7, channel 1 is the second byte, i.e. bits 8 to 15 etc.
In addition, the parameter 'iDirection' must be set correctly to ME_DIR_INPUT ot ME_DIR_OUTPUT.

The function meIOSingleConfig on the other hand, when used on a DI, DO or DIO sub-device serves only to set the port direction. For this reason, it is normally not even necessary to call meIOSingleConfig for a DI or DO sub-device as here the port direction is fixed. The only exception to this rule is the ME-8100 board family where meIOSingleConfig is used on the DO sub-devices with the parameter 'iSingleConfig' set to one of ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK or ME_SINGLE_CONFIG_DIO_SOURCE.
meIOSingleConfig should be called before meIOSingle to set the port direction for a DIO sub-device. The parameters 'iChannel' and 'iFlags' are used in this case to determine which part of the port should have it's direction set. For example, given a 16-bit wide DIO port, by calling meIOSingleConfig with 'iChannel' = 1 and 'iFlags' = ME_IO_SINGLE_CONFIG_DIO_BYTE it might be possible to change the direction of the port's second byte (bits 8 to 15) without changing the direction of the first byte (bit 0 to 7). However, on all current boards, if you want to change a port direction you must change the direction of the entire port. This means that for 'iChannel' you must use 0 and for 'iFlags' you must use the flag (ME_IO_SINGLE_CONFIG_DIO_...) corresponding to the ports' width or the constant ME_VALUE_DEFAULT (0).

The width of a DI, DO or DIO port can be determined by calling the function meQueryNumberChannels for the sub-device.

The width of the smallest unit on a DI, DO or DIO port whose direction can be changed can be determined by calling the function meQuerySubdeviceCaps for the sub-device and checking which of the bits ME_CAPS_DIO_DIR_BIT, ME_CAPS_DIO_DIR_BYTE, ME_CAPS_DIO_DIR_WORD or ME_CAPS_DIO_DIR_DWORD is set in the result returned in 'piCaps'. As explained above, at the prewsent time the result of his last query will always correspond exactly to the value returned from meQueryNumberChannels.

Which function in the ME-iDS driver system corresponds to the 'AIScan' function in the former (legacy) ME46xx driver?

By using a combination of 'Streaming' functions called with the appropriate parameters you can do exactly what you were able to do using the AIScan function in the legacy driver.
The AIScan function for the legacy driver fulfilled two goals.
  • Run a data acquisition to collect a certain pre-determined number of data samples and stop automatically after the last sample has been acquired.

    In the ME-iDS system, to cause a data acquisiton to terminate after a definite number of samples have been collected, it is only necessary to set the parameters in the trigger structure passed to meIOStreamConfig correctly. Please see the details here.
  • Automatically transfer the aquired data to a user-defined buffer.

    Using the ME-iDS system, if the total number of data values you which to sample is less than the size of the internal ring buffer (currently 64K values), than you could simply start the acquisition and immediately call meIOStreamRead in blocking mode to wait for exactly that number of data values.

    If, however, the number of data values is greater than the size of the internal ring-buffer, then you must regularly call meIOStreamRead either in an installed call-back function or directly to transfer the data samples from the internal ring-buffer to your own allocated buffer.

    This is exactly what was done automatically in the background in the AIScan function for the legacy driver.

    Our philosophy was to provide a 'bare-bones' API to the driver system and not to include (at least in the basic interface) any functions which the user could easily construct for himself with the help of existing API routines.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Supported Hardware

Supported Hardware

  • ME-1000 Description
  • ME-1400 Description
  • ME-1600 Description
  • ME-46xx Description
  • ME-5xxx Description
  • ME-Axon Description
  • ME-6x00 Description
  • ME-630 Description
  • ME-8100 Description
  • ME-8200 Description
  • ME-9x Description
  • MEphistoScope Description


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1000 Description

  • Supported Hardware

ME-1000 Description

ME-1000 Description - Contents:

  • Device types.
    • ME-1000
    • ME-5310
  • Using the ME-iDS API with an ME-1000 board.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-1000 Description

Device Types

Device Types

The ME-1000 board exists in the following varieties:

ME-1000

4 Subdevices

  • 0: Digital Input/Output subdevice - 32 bits wide
  • 1: Digital Input/Output subdevice - 32 bits wide
  • 2: Digital Input/Output subdevice - 32 bits wide
  • 3: Digital Input/Output subdevice - 32 bits wide

ME-5310

Modern replacement of the legacy ME-1000

4 Subdevices

  • 0: Digital Input/Output subdevice - 32 bits wide
  • 1: Digital Input/Output subdevice - 32 bits wide
  • 2: Digital Input/Output subdevice - 32 bits wide
  • 3: Digital Input/Output subdevice - 32 bits wide


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-1000 boards.

  • ME-1000 Description

Using the ME-iDS API with the ME-1000 boards.

Using the ME-iDS API with the ME-1000 / ME-5310 boards.

  • Digital input/output sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-1000 Description
  • Using the ME-iDS API with the ME-1000 boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 32 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_DWORD for 'piCaps'.
This means that the port direction can only be changed 32-bit-wise. In other words, the entire port must be set either for input or for output.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_DWORD.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0 for the lower 16 bits or 1 for the upper 16 bits.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 for the lower 16 bits, 1 for bits 8 to 15, 2 for bits 16 to 23 or 3 for bits 24 to 31.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 31 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD then the port value between Hex 0 and Hex FFFFFFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then the 16-bit value between Hex 0 and Hex FFFF of the corresponding port word will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then the 8-bit value between Hex 0 and Hex FF of the corresponding port byte will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD this should be a value between Hex 0 and Hex FFFFFFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE, ME_IO_SINGLE_TYPE_DIO_WORD or ME_IO_SINGLE_TYPE_DIO_BYTE.
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1400 Description

ME-1400 Description

ME-1400 Description - Contents:

  • Device types.
    • ME-1400, ME-1400E, ME-1400 - USB (Mephisto Digi), ME-1400E - USB (Mephisto Digi)
    • ME-1400A, ME-1400EA
    • ME-1400A - USB (Mephisto Digi), ME-1400EA - USB (Mephisto Digi)
    • ME-1400B, ME-1400EB
    • ME-1400B - USB (Mephisto Digi), ME-1400EB - USB (Mephisto Digi)
    • ME-1400C
    • ME-1400C - USB (Mephisto Digi)
    • ME-1400D
    • ME-1400D - USB (Mephisto Digi)
    • ME-5314A
    • ME-5314B
    • ME-5314C
  • Special features.
    • Digital Counter sub-devices
  • Using the ME-iDS API with an ME-1400 board.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
    • External IRQ sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1400 Device Types

  • ME-1400 Description

ME-1400 Device Types

ME-1400 Device Types

The ME-1400 board exists in the following varieties:

ME-1400, ME-1400E, ME-1400 - USB (Mephisto Digi), ME-1400E - USB (Mephisto Digi)

3 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide

ME-1400A, ME-1400EA

7 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4
  • 6: External IRQ subdevice

ME-1400A - USB (Mephisto Digi), ME-1400EA - USB (Mephisto Digi)

6 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4

ME-1400B, ME-1400EB

13 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide
  • 6: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: External IRQ subdevice

ME-1400B - USB (Mephisto Digi), ME-1400EB - USB (Mephisto Digi)

12 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide
  • 6: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10

ME-1400C

19 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4
  • 6: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 5
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 8
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 11
  • 13: 8254 Counter subdevice - Clock source: external or sub-device 12
  • 14: 8254 Counter subdevice - Clock source: external or sub-device 13
  • 15: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 14
  • 16: 8254 Counter subdevice - Clock source: external or sub-device 15
  • 17: 8254 Counter subdevice - Clock source: external or sub-device 16
  • 18: External IRQ subdevice

ME-1400C - USB (Mephisto Digi)

18 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4
  • 6: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 5
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 8
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 11
  • 13: 8254 Counter subdevice - Clock source: external or sub-device 12
  • 14: 8254 Counter subdevice - Clock source: external or sub-device 13
  • 15: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 14
  • 16: 8254 Counter subdevice - Clock source: external or sub-device 15
  • 17: 8254 Counter subdevice - Clock source: external or sub-device 16

ME-1400D

38 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide
  • 6: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 8
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 11
  • 13: 8254 Counter subdevice - Clock source: external or sub-device 12
  • 14: 8254 Counter subdevice - Clock source: external or sub-device 13
  • 15: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 14
  • 16: 8254 Counter subdevice - Clock source: external or sub-device 15
  • 17: 8254 Counter subdevice - Clock source: external or sub-device 16
  • 18: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 17
  • 19: 8254 Counter subdevice - Clock source: external or sub-device 18
  • 20: 8254 Counter subdevice - Clock source: external or sub-device 19
  • 21: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 22: 8254 Counter subdevice - Clock source: external or sub-device 21
  • 23: 8254 Counter subdevice - Clock source: external or sub-device 22
  • 24: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 23
  • 25: 8254 Counter subdevice - Clock source: external or sub-device 24
  • 26: 8254 Counter subdevice - Clock source: external or sub-device 25
  • 27: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 26
  • 28: 8254 Counter subdevice - Clock source: external or sub-device 27
  • 29: 8254 Counter subdevice - Clock source: external or sub-device 28
  • 30: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 29
  • 31: 8254 Counter subdevice - Clock source: external or sub-device 30
  • 32: 8254 Counter subdevice - Clock source: external or sub-device 31
  • 33: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 32
  • 34: 8254 Counter subdevice - Clock source: external or sub-device 33
  • 35: 8254 Counter subdevice - Clock source: external or sub-device 34
  • 36: External IRQ subdevice
  • 37: External IRQ subdevice

ME-1400D - USB (Mephisto Digi)

36 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide
  • 6: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 8
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 11
  • 13: 8254 Counter subdevice - Clock source: external or sub-device 12
  • 14: 8254 Counter subdevice - Clock source: external or sub-device 13
  • 15: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 14
  • 16: 8254 Counter subdevice - Clock source: external or sub-device 15
  • 17: 8254 Counter subdevice - Clock source: external or sub-device 16
  • 18: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 17
  • 19: 8254 Counter subdevice - Clock source: external or sub-device 18
  • 20: 8254 Counter subdevice - Clock source: external or sub-device 19
  • 21: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 22: 8254 Counter subdevice - Clock source: external or sub-device 21
  • 23: 8254 Counter subdevice - Clock source: external or sub-device 22
  • 24: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 23
  • 25: 8254 Counter subdevice - Clock source: external or sub-device 24
  • 26: 8254 Counter subdevice - Clock source: external or sub-device 25
  • 27: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 26
  • 28: 8254 Counter subdevice - Clock source: external or sub-device 27
  • 29: 8254 Counter subdevice - Clock source: external or sub-device 28
  • 30: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 29
  • 31: 8254 Counter subdevice - Clock source: external or sub-device 30
  • 32: 8254 Counter subdevice - Clock source: external or sub-device 31
  • 33: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 32
  • 34: 8254 Counter subdevice - Clock source: external or sub-device 33
  • 35: 8254 Counter subdevice - Clock source: external or sub-device 34

ME-5314A

Modern replacement of the legacy ME-1400A

7 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4
  • 6: External IRQ subdevice

ME-5314B

Modern replacement of the legacy ME-1400B

13 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide
  • 6: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: External IRQ subdevice

ME-5314C

Modern replacement of the legacy ME-1400C

19 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide
  • 1: Digital Input/Output subdevice - 8 bits wide
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: 8254 Counter subdevice - Clock source: external or internal (1 or 10 MHZ)
  • 4: 8254 Counter subdevice - Clock source: external or sub-device 3
  • 5: 8254 Counter subdevice - Clock source: external or sub-device 4
  • 6: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 5
  • 7: 8254 Counter subdevice - Clock source: external or sub-device 6
  • 8: 8254 Counter subdevice - Clock source: external or sub-device 7
  • 9: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 8
  • 10: 8254 Counter subdevice - Clock source: external or sub-device 9
  • 11: 8254 Counter subdevice - Clock source: external or sub-device 10
  • 12: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 11
  • 13: 8254 Counter subdevice - Clock source: external or sub-device 12
  • 14: 8254 Counter subdevice - Clock source: external or sub-device 13
  • 15: 8254 Counter subdevice - Clock source: external, internal (1 or 10 MHZ) or sub-device 14
  • 16: 8254 Counter subdevice - Clock source: external or sub-device 15
  • 17: 8254 Counter subdevice - Clock source: external or sub-device 16
  • 18: External IRQ subdevice


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1400 Special features

  • ME-1400 Description

ME-1400 Special features

ME-1400 Special features

The sub-devices on the ME-1400 boards (or on some of its variants) posess the following special features:

Digital Counter sub-devices

As well as admitting an external impulse as a clock source, some of these sub-devices can be driven with an internal clock (1 MHz or 10 MHz) and some can be software configured to use the output of the previous counter sub-device as a source pulse.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-1400 boards.

  • ME-1400 Description

Using the ME-iDS API with the ME-1400 boards.

Using the ME-iDS API with the ME-1400 boards.

  • Digital input/output sub-devices.
  • Counter sub-devices.
  • External IRQ sub-device.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-1400 Description
  • Using the ME-iDS API with the ME-1400 boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.

See the information for your particular board under ME-1400 Device Types for the details.

The available clock sources for a counter sub-device can also be queried at run-time using the function meQuerySubdeviceCapsArgs.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-1400 Description
  • Using the ME-iDS API with the ME-1400 boards.

Counter sub-devices

Counter sub-devices

The 8254 counter sub-devices on the ME-1400 boards come in groups of three.

In every case, the clock source for first counter in a group of three can be either an external source or a 1 MHz or 10 MHz internal clock source.

The clock source for the second or third counters in a group can be either an external source or the output of the previous counter in the group (software cascading).

On the ME-1400C and ME-1400D boards, the clock source for the first counter in a group can also be the output of the third counter in the previous group.

See the information for your particular board under ME-1400 Device Types for the details.

The available clock sources for a counter sub-device can also be queried at run-time using the function meQuerySubdeviceCapsArgs.

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0. It also configures the counter to use an external clock source.

meQuerySubdeviceCaps

This function returns a combination of the constants ME_CAPS_CTR_CLK_EXTERNAL, ME_CAPS_CTR_CLK_INTERNAL_1MHZ, ME_CAPS_CTR_CLK_INTERNAL_10MHZ and ME_CAPS_CTR_CLK_PREVIOUS, for 'piCaps'. The returned value indicates which values can be used for the parameter 'iRef' on calling meIOSingleConfig below.
The combination returned is dependent on the board and the sub-device index.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be one of ME_REF_CTR_PREVIOUS, ME_REF_CTR_INTERNAL_1MHZ, ME_REF_CTR_INTERNAL_10MHZ or ME_REF_CTR_EXTERNAL, but note that many counter sub-devices support only a sub-set of these values (see Counter sub-devices and meQuerySubdeviceCaps).
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured and the pulse source is set to external.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: External IRQ sub-device

  • ME-1400 Description
  • Using the ME-iDS API with the ME-1400 boards.

External IRQ sub-device

External IRQ sub-device

Some boards of the ME-1400 family have one or two external irq sub-device. See ME-1400 Device Types for the index of this sub-device on the various boards.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_EXT_IRQ_EDGE_RISING in 'piCaps'.
This indicates the interrupt can only be triggered on a rising edge and that, consequently, the value ME_IRQ_EDGE_RISING must be used for the parameter 'iIrqEdge' in meIOIrqStart.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback! each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: Must be ME_IRQ_SOURCE_DIO_LINE.
  • iIrqEdge: Must be ME_IRQ_EDGE_RISING.
  • iIrqArg: Ignored here, should be 0.
  • iFlags: Not required, use ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: 0 is always returned here.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1600 Description

ME-1600 Description

ME-1600 Description - Contents:

  • Device types.
    • ME-1600/4U
    • ME-1600/8U
    • ME-1600/12U
    • ME-1600/16U
    • ME-1600/16U8I
  • Special features.
    • Analog output subdevice
  • Using the ME-iDS API with an ME-1600 board.
    • Analog output sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-1600 Description

Device Types

Device Types

The ME-1600 board exists in the following varieties:

ME-1600/4U

4 Subdevice

  • 0: Analog output subdevice - 1 channel, single only
  • 1: Analog output subdevice - 1 channel, single only
  • 2: Analog output subdevice - 1 channel, single only
  • 3: Analog output subdevice - 1 channel, single only

ME-1600/8U

8 Subdevices

  • 0: Analog output subdevice - 1 channel, single only
  • 1: Analog output subdevice - 1 channel, single only
  • 2: Analog output subdevice - 1 channel, single only
  • 3: Analog output subdevice - 1 channel, single only
  • 4: Analog output subdevice - 1 channel, single only
  • 5: Analog output subdevice - 1 channel, single only
  • 6: Analog output subdevice - 1 channel, single only
  • 7: Analog output subdevice - 1 channel, single only

ME-1600/12U

12 Subdevices

  • 0: Analog output subdevice - 1 channel, single only
  • 1: Analog output subdevice - 1 channel, single only
  • 2: Analog output subdevice - 1 channel, single only
  • 3: Analog output subdevice - 1 channel, single only
  • 4: Analog output subdevice - 1 channel, single only
  • 5: Analog output subdevice - 1 channel, single only
  • 6: Analog output subdevice - 1 channel, single only
  • 7: Analog output subdevice - 1 channel, single only
  • 8: Analog output subdevice - 1 channel, single only
  • 9: Analog output subdevice - 1 channel, single only
  • 10: Analog output subdevice - 1 channel, single only
  • 11: Analog output subdevice - 1 channel, single only

ME-1600/16U

16 Subdevices

  • 0: Analog output subdevice - 1 channel, single only
  • 1: Analog output subdevice - 1 channel, single only
  • 2: Analog output subdevice - 1 channel, single only
  • 3: Analog output subdevice - 1 channel, single only
  • 4: Analog output subdevice - 1 channel, single only
  • 5: Analog output subdevice - 1 channel, single only
  • 6: Analog output subdevice - 1 channel, single only
  • 7: Analog output subdevice - 1 channel, single only
  • 8: Analog output subdevice - 1 channel, single only
  • 9: Analog output subdevice - 1 channel, single only
  • 10: Analog output subdevice - 1 channel, single only
  • 11: Analog output subdevice - 1 channel, single only
  • 12: Analog output subdevice - 1 channel, single only
  • 13: Analog output subdevice - 1 channel, single only
  • 14: Analog output subdevice - 1 channel, single only
  • 15: Analog output subdevice - 1 channel, single only

ME-1600/16U8I

16 Subdevices

  • 0: Analog output subdevice - 1 channel, single only, volt/ampere
  • 1: Analog output subdevice - 1 channel, single only, volt/ampere
  • 2: Analog output subdevice - 1 channel, single only, volt/ampere
  • 3: Analog output subdevice - 1 channel, single only, volt/ampere
  • 4: Analog output subdevice - 1 channel, single only, volt/ampere
  • 5: Analog output subdevice - 1 channel, single only, volt/ampere
  • 6: Analog output subdevice - 1 channel, single only, volt/ampere
  • 7: Analog output subdevice - 1 channel, single only, volt/ampere
  • 8: Analog output subdevice - 1 channel, single only
  • 9: Analog output subdevice - 1 channel, single only
  • 10: Analog output subdevice - 1 channel, single only
  • 11: Analog output subdevice - 1 channel, single only
  • 12: Analog output subdevice - 1 channel, single only
  • 13: Analog output subdevice - 1 channel, single only
  • 14: Analog output subdevice - 1 channel, single only
  • 15: Analog output subdevice - 1 channel, single only


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-1600 Special features

  • ME-1600 Description

ME-1600 Special features

ME-1600 Special features

The sub-devices on the me1600 boards (or on some of its variants) posess the following special features:

Analog output subdevice

  • All boards - Analog output can be carried out simultaneously on any combination of analog output sub-devices.

    Set the parameter 'iTriggerChannel' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig for each sub-device.
    Use the flag (parameter 'iFlags') ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pSingleList' passed to meIOSingle.
  • ME168F - The first eight sub-devices on this board can be used to output a current instead of a voltage if required.
    Set 'iSingleConfig' (Range) equal to 2 (0 - 20 milliampere) or 3 (4 - 20 milliampere) on calling meIOSingleConfig.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-1600 boards.

  • ME-1600 Description

Using the ME-iDS API with the ME-1600 boards.

Using the ME-iDS API with the ME-1600 boards.

  • Analog output sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog output sub-devices

  • ME-1600 Description
  • Using the ME-iDS API with the ME-1600 boards.

Analog output sub-devices

Analog output sub-devices

The analog output sub-devices on the ME-1600 boards can be used only in single mode.

The sub-devices are single-channeled

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for a range from 0 V to 10 V (this also applies to those sub-device which can output a current) and for immediate mode (as opposed to synchronous mode) and outputs 0V.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

Those sub-devices which can only output a voltage (all sub-devices except sub-device 0 to 7 on the ME-1600/16U8I board) have just two ranges:

  • 0: Unipolar 10.0 V

    Physical range: 0.0 V - +9.9997558 V
    Digital range: 0 - 4095 (Hex FFF) - 12 Bit resolution

  • 1: Bipolar 10.0 V

    Physical range: -10.0 V - +9.9995117 V
    Digital range: 0 - 4095 (Hex FFF) - 12 Bit resolution

Those sub-devices which can output a voltage or a current (sub-devices 0 to 7 on the ME-1600/16U8I board) have four ranges:

  • 0: Unipolar 10.0 V

    Physical range: 0.0 V - +9.9997558 V
    Digital range: 0 - 4095 (Hex FFF) - 12 Bit resolution

  • 1: Bipolar 10.0 V

    Physical range: -10.0 V - +9.9995117 V
    Digital range: 0 - 4095 (Hex FFF) - 12 Bit resolution

  • 2: 0.0 - 0.020 A

    Physical range: 0.0 mA - 19.995 mA
    Digital range: 0 - 40955 (Hex FFF) - 12 Bit resolution

  • 3: 0.004 - 0.020 A

    Physical range: 4.0 mA - 19.996 mA
    Digital range: 0 - 4095 (Hex FFF) - 12 Bit resolution

The meQueryNumberRanges and meQueryRange... functions behave accordingly.

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The range. Must be between 0 and 3 for a sub device which can output a current or a voltage and 0 or 1 for a sub-device which can only output a voltage. See the description for the particular sub-device in Device Types or use the meQueryNumberRanges function.
  • iRef: Must be ME_REF_AO_GROUND.
  • iTrigChan: ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Must be ME_TRIG_TYPE_SW.
  • iTrigEdge: Must be ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels are configured to range 0 (iSingleConfig = 0) 0.0 V - 10.0 V.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then the last digital value written to the sub-device is returned here. This is the current digital value of the channel.

    • If 'iDir' is 'ME_DIR_OUTPUT' then the digital value which is to be written to the sub-device should be supplied here. Use the utility function meUtilityPhysicalToDigital to convert the physical value in the appropriate units to the corresponding digital value.
  • iTimeOut: Not required, should be 0.
  • iFlags:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then no flags are defined here - Use 'ME_IO_SINGLE_TYPE_NO_FLAGS'.

    • If 'iDir' is 'ME_DIR_OUTPUT' then this parameter should either be 'ME_IO_SINGLE_TYPE_NO_FLAGS' or 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS'.

      Use the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' here to output immediately the value for this sub-device and all other sub-devices for which 'ME_TRIG_CHAN_SYNCHRONOUS' was used for the parameter 'iTrigChan' on configuring the sub-device (see meIOSingleConfig).
      In other words, to output values simultaneously to a number of different sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iTrigChan' and then call meIOSingle for each sub-device, employing the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-46xx Description

ME-46xx Description

ME-46xx Description - Contents:

  • Device types.
    • ME-4610
    • ME-4650
    • ME-4650F
    • ME-4660
    • ME-4660F
    • ME-4660i (opto-isolated)
    • ME-4660iF (opto-isolated)
    • ME-4660s
    • ME-4660sF
    • ME-4660is (opto-isolated)
    • ME-4660isF (opto-isolated)
    • ME-4670
    • ME-4670F
    • ME-4670i (opto-isolated)
    • ME-4670iF (opto-isolated)
    • ME-4670s
    • ME-4670sF
    • ME-4670is (opto-isolated)
    • ME-4670isF (opto-isolated)
    • ME-4680
    • ME-4680F
    • ME-4680i (opto-isolated)
    • ME-4680iF (opto-isolated)
    • ME-4680s
    • ME-4680sF
    • ME-4680is (optoisolated)
    • ME-4680isF (optoisolated)
  • Special features.
    • Digital output sub-device
    • Digital input/output sub-device
    • Analog input sub-device
    • Analog output sub-device
  • Using the ME-iDS API with an ME-46xx board.
    • Digital input sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
    • Digital output sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Analog input sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Analog output sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamWrite.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • External IRQ sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-46xx Description

Device Types

ME-46xx Device Types

The ME-46xx board exists in the following varieties:

ME-4610

9 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device
  • 8: External IRQ sub-device

ME-4650

6 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger
  • 5: External IRQ sub-device

ME-4650F

12 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger
  • 3: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 4: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 5: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 6: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 7: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 8: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 9: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 10: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 11: External IRQ sub-device

ME-4660

11 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: External IRQ sub-device

ME-4660F

17 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device
  • 8: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 9: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 13: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: External IRQ sub-device

ME-4660i (opto-isolated)

11 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: External IRQ sub-device

ME-4660iF (opto-isolated)

17 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device
  • 8: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 9: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 13: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: External IRQ sub-device

ME-4660s

11 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger, first 8 channels with sample and hold
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: External IRQ sub-device

ME-4660sF

17 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger, first 8 channels with sample and hold
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device
  • 8: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 9: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 13: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: External IRQ sub-device

ME-4660is (opto-isolated)

11 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 16 channels, streaming, digital trigger, first 8 channels with sample and hold
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: External IRQ sub-device

ME-4660isF (opto-isolated)

17 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger, first 8 channels with sample and hold
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device
  • 8: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 9: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 13: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: External IRQ sub-device

ME-4670

13 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4670F

19 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4670i (opto-isolated)

13 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4670iF (opto-isolated)

19 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4670s

13 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4670sF

19 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4670is (opto-isolated)

13 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4670isF (opto-isolated)

19 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4680

13 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: Analog output sub-device - 1 channel, streaming
  • 8: Analog output sub-device - 1 channel, streaming
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4680F

19 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4680i (opto-isolated)

13 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: Analog output sub-device - 1 channel, streaming
  • 8: Analog output sub-device - 1 channel, streaming
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4680iF (opto-isolated)

19 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4680s

13 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: Analog output sub-device - 1 channel, streaming
  • 8: Analog output sub-device - 1 channel, streaming
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4680sF

19 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device

ME-4680is (optoisolated)

13 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Digital Input/Output sub-device - 8 bits wide
  • 3: Digital Input/Output sub-device - 8 bits wide
  • 4: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: Analog output sub-device - 1 channel, streaming
  • 8: Analog output sub-device - 1 channel, streaming
  • 9: 8254 Counter sub-device
  • 10: 8254 Counter sub-device
  • 11: 8254 Counter sub-device
  • 12: External IRQ sub-device

ME-4680isF (optoisolated)

19 sub-devices

  • 0: Digital Input sub-device - 8 bits wide
  • 1: Digital Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger, first 8 channels with sample and hold.
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device
  • 10: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 11: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 12: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 13: Frequency Input (Frequency Measurement) sub-device - 1 channel
  • 14: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 15: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 16: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 17: Frequency Output (Pulse Generation) sub-device - 1 channel
  • 18: External IRQ sub-device


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features

  • ME-46xx Description

Special features

ME-46xx Special features

The sub-devices on the ME-46xx boards (or on some of its variants) posess the following special features:

Digital output sub-device

  • ME-4680xx - These sub-devices can be used in conjunction with the fourth AO-streaming sub-device to output a bit pattern stream.
    Set 'iSingleConfig' = ME_SINGLE_CONFIG_DIO_BIT_PATTERN and iRef = 'ME_REF_DIO_FIFO_LOW' or iRef = 'ME_REF_DIO_FIFO_HIGH' in meIOSingleConfig.
    See Analog output sub-device

Digital input/output sub-device

  • ME-4680xx - These sub-devices can be used in conjunction with the fourth AO-streaming sub-device to output a bit pattern stream.
    Set 'iSingleConfig' = ME_SINGLE_CONFIG_DIO_BIT_PATTERN and iRef = 'ME_REF_DIO_FIFO_LOW' or iRef = 'ME_REF_DIO_FIFO_HIGH' in meIOSingleConfig.
    See Analog output sub-device

Analog input sub-device

  • ME-4670S, ME-4670IS, ME-4680S, ME-4680IS - The first eight acquisition channels support sample and hold.
    Use the flag (parameter 'iFlags') ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD in meIOStreamConfig.
    Sample and hold can only be used with the parameter 'iRef' = ME_REF_AI_GROUND in all elements of the channel list.
  • ME-4670xx, ME-4680xx - The analog input devices on these boards support an analog trigger.
    Set 'iTriggerType' = ME_TRIG_TYPE_EXT_ANALOG in meIOSingleConfig or set 'iAcqStartTrigType', 'iScanStartTrigType' or 'iConvStartTrigType' = ME_TRIG_TYPE_EXT_ANALOG in the trigger structure passed to meIOStreamConfig.
  • All models - four different types of trigger are supported in streaming mode. The type of trigger used is determined by the entries made in the 'pTrigger' structure passed to meIOStreamConfig.
    Where an analog trigger is mentioned, this only applies to the ME-4670xx and ME-4680xx boards (see above):

    • Standard software trigger:

      After calling meIOStreamStart and a delay exactly determined by the value of the variables 'iAcqStartTicksLow' and 'iAcqStartTicksHigh' in the trigger structure passed to meIOStreamConfig, the acquisition starts without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_SW, 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' = ME_TRIG_TYPE_TIMER

    • Standard external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-4670 and ME-4680 boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', iScanStartTrigType' = ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' = ME_TRIG_TYPE_TIMER

    • Channel list per external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an entire channel list to be acquired at a conversion rate determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-4670 and ME-4680 boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', 'iScanStartTrigType' must be set to the same value as 'iAcqStartTrigType' and 'iConvStartTrigType' should be set to ME_TRIG_TYPE_TIMER

    • Single value per external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes a single channel to be acquired.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-4670 and ME-4680 boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', 'iScanStartTrigType' must be set to ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' must be set to the same value as 'iAcqStartTrigType'

Analog output sub-device

  • ME-4660xx, ME-4670xx, ME-4680xx - Data output (single or, where available, streaming) can be started simultaneously on several separate analog output sub-devices.

    • In single mode:
      Set the parameter 'iTriggerChannel' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pSingleList' passed to meIOSingle.

    • In streaming mode:
      Set the member 'iAcqStartTrigChan' of the parameter 'pTrigger' = ME_TRIG_CHAN_SYNCHRONOUS in meIOStreamConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pStartList' passed to meIOStreamStart.
  • ME-4680xx - The fourth such sub-device (sub-device 8) can be used in conjunction with one or more digital input or digital input/output sub-devices to output a bit pattern.
    Use the flag (parameter 'iFlags') ME_IO_STREAM_CONFIG_BIT_PATTERN in meIOStreamConfig.
    See Digital output sub-device and Digital input/output sub-device


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-46xx boards.

  • ME-46xx Description

Using the ME-iDS API with the ME-46xx boards.

Using the ME-iDS API with the ME-46xx boards.

  • Digital input sub-device.
  • Digital output sub-device.
  • Digital input/output sub-devices.
  • Analog input sub-device.
  • Analog output sub-devices.
  • Counter sub-devices.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • External IRQ sub-device.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Digital input sub-device

Digital input sub-device

The port is 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

meIOSingleConfig

  • iChannel: Must be 0.

  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.

  • iRef: Not required here, use ME_VALUE_NOT_USED.

  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.

  • iTrigType: Not required here, use ME_VALUE_NOT_USED.

  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.

  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

Since all settings are fixed here, it is not necessary to call meIOSingleConfig at all before reading from the sub-device.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Digital output sub-device

Digital output sub-device

The port is 8 bits wide. As well as for normal, standard digital output, the port may be used on the ME-4680xx boards in conjunction with the fourth AO-Streaming sub-device to output a bit-pattern stream.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for 'normal' output and initializes it with the value 0 (all bits 0).

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_OUTPUT or ME_SINGLE_CONFIG_DIO_BIT_PATTERN.
  • iRef:

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_OUTPUT then this is not required, use ME_VALUE_NOT_USED.

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_BIT_PATTERN then this must be ME_REF_DIO_FIFO_LOW or ME_REF_DIO_FIFO_HIGH.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for bit pattern operations (see meIOSingleConfig) then calling meIOSingle returns an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide. As well as for normal, standard digital input/output, the port may be used on the ME-4680xx boards in conjunction with the fourth AO-Streaming sub-device to output a bit-pattern stream.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT, ME_SINGLE_CONFIG_DIO_OUTPUT or ME_SINGLE_CONFIG_DIO_BIT_PATTERN.
  • iRef:

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT then this is not required, use ME_VALUE_NOT_USED.

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_BIT_PATTERN then this must be ME_REF_DIO_FIFO_LOW or ME_REF_DIO_FIFO_HIGH.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for bit pattern operations (see meIOSingleConfig), then calling meIOSingle returns an error.

If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog input sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Analog input sub-device

Analog input sub-device

The analog input sub-device, which can be used in single and streaming mode, has 32 single-ended channels ('iRef' = ME_REF_AI_GROUND). On the ME-4670xx and ME-46780xx boards these can also be configured as 16 differential channels ('iRef' = ME_REF_AI_DIFFERENTIAL).

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running and configures each channel to range: bipolar 10 V, reference: ground and trigger type: software.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

The ME-4610 board has only one range:

  • 0: Bipolar 10.0 V

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The other boards in the family have four ranges:

  • 0: Bipolar 10.0 V

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 1: Unipolar 10.0 V

    Physical range: 0.0 V - +9.999847 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 2: Bipolar 2.5 V

    Physical range: -2.5 V - +2.499924 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 3: Unipolar 2.5 V

    Physical range: 0.0 V - +2.499962 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The meQueryRange... functions behave accordingly.

meQuerySubdeviceCaps

This function returns ME_CAPS_AI_FIFO | ME_CAPS_AI_FIFO_THRESHOLD for 'piCaps'.

  • The value ME_CAPS_AI_FIFO indicates that the sub-device has a FIFO whose size can be queried (see meQuerySubdeviceCapsArgs).

  • The value ME_CAPS_AI_FIFO_THRESHOLD indicates that, for streaming operations, the user can influence the number of data values required in the FIFO to trigger an interrupt.
    This in turn influences the speed with which the software reacts to the prescence of new data.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_AI_FIFO_SIZE.
  • piArgs: A pointer to a single integer in which the FIFO size is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the FIFO size in data values. On older boards this is 2048, newer boards may be provided with a larger FIFO.

meIOSingleConfig

  • iChannel: The channel index:

    • 0 - 15 (ME-4610, ME-4650 and ME-4660 boards) or 0 - 31 (ME-4670 and ME-4680 boards) if 'iRef' below is ME_REF_AI_GROUND.

    • 0 - 15 if 'iRef' below is ME_REF_AI_DIFFERENTIAL (ME-4670 and ME-4680 boards only).
  • iSingleConfig: The range index (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

    • ME-4610 board: Must be 0.

    • Other ME-46xx boards:
      • If 'iRef' below is ME_REF_AI_GROUND: 0 - 3

      • If 'iRef' below is ME_REF_AI_DIFFERENTIAL: 0 or 2 (the bipolar ranges, see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo).
  • iRef:

    • ME-4610, ME-4650 and ME-4660 boards: Must be ME_REF_AI_GROUND.

    • Other ME-46xx boards: ME_REF_AI_GROUND or ME_REF_AI_DIFFERENTIAL.
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType:

    • ME-4610, ME-4650 and ME-4660 boards: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.

    • Other ME-46xx boards: ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels are configured to range: bipolar 10 V (index 0), reference: ground and trigger type: software.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: The channel index:

    • 0 - 15 (ME-4610, ME-4650 and ME-4660 boards) or 0 - 31 (ME-4670 and ME-4680 boards) if 'iRef' used in meIOSingleConfig above was ME_REF_AI_GROUND.

    • 0 - 15 if 'iRef' used in meIOSingleConfig above was ME_REF_AI_DIFFERENTIAL (ME-4670 and ME-4680 boards only).
  • iDir: Must be ME_DIR_INPUT.
  • iValue: The current digital value of the channel is returned here.
    Use the utility function meUtilityDigitalToPhysical to convert the digital value to a value in the appropriate physical units.
  • iTimeOut: If, on configuring the channel (see meIOSingleConfig), 'iTrigType' = ME_TRIG_TYPE_SW has been used here, then this should be 0.
    Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TYPE_NO_FLAGS

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog input sub-device on the ME-46xx boards has an internal timer with a basic frequency of 33 MHz

The minimum number of ticks which can be used here is 66 (TicksLow = 66, TicksHigh = 0) which corresponds to a frequency of 500 KHz or a sampling time of 2 microseconds

For the 'acquisition' and 'channel' timers the maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0077 Hz or a sampling time of approx 130 seconds.

For the 'scan' timer the maximum number of ticks which can be used is 1099511627775 (Hex 0xFFFFFFFFFF: TicksLow = 4294967295, TicksHigh = 255) which corresponds to a frequency of approx. 0.000003 Hz or a sampling time of approx 33318 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_ACQ_START, ME_TIMER_SCAN_START or ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a list of meIOStreamConfig structures containing the configuration for the individual channels.
    The elements of this list should be configured as follows:

    • iChannel: The channel index:

      • 0 - 15 (ME-4610, ME-4650 and ME-4660 boards) or 0 - 31 (ME-4670 and ME-4680 boards) if 'iRef' below is ME_REF_AI_GROUND.

      • 0 - 15 if 'iRef' below is ME_REF_AI_DIFFERENTIAL (ME-4670 and ME-4680 boards only).

    • iStreamConfig: The range index (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

      • ME-4610 board: Must be 0.

      • Other ME-46xx boards:

        • If 'iRef' below is ME_REF_AI_GROUND: 0 - 3

        • If 'iRef' below is ME_REF_AI_DIFFERENTIAL: 0 or 2 (the bipolar ranges, see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo).

    • iRef: All elements in the list must use the same value here.

      • ME-4610, ME-4650 and ME-4660 boards: Must be ME_REF_AI_GROUND.

      • Other ME-46xx boards: ME_REF_AI_GROUND or ME_REF_AI_DIFFERENTIAL.

    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: The number of elements in the list 'pConfigList' above.

    A maximum of 1024 elements is allowed.
  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are four alternative modes for governing the start of the acquisition and way in which sampling proceeds:

      • Standard software trigger:

        After calling meIOStreamStart and a delay exactly determined by the value of the variables 'iAcqStartTicksLow' and 'iAcqStartTicksHigh' in the trigger structure passed to meIOStreamConfig, the acquisition starts without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between starting the acquisition with meIOStreamStart and the first channel being sampled.

        • iScanStartTrigType: ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW

        • iScanStartTicksLow, iScanStartTicksHigh:

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_TIMER then these values determine the amount of time which elapses between sampling two channel lists.
            Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks
            The value in iScanStartTicks must be at least as great as the number of channels in the list multiplied by the value in iConvChanTicks

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_FOLLOW these are not used and should both be 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType:

          • ME-4610, ME-4650, ME-4660: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW

        • iScanStartTicksLow, iScanStartTicksHigh:

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_TIMER then these values determine the amount of time which elapses between sampling two channel lists.
            Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks
            The value in iScanStartTicks must be at least as great as the number of channels in the list multiplied by the value in iConvChanTicks

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_FOLLOW these are not used and should both be 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Channel list per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an entire channel list to be acquired at a conversion rate determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType:

          • ME-4610, ME-4650, ME-4660: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: Use the same value used for 'iAcqStartTrigType' above.

        • iScanStartTicksLow, iScanStartTicksHigh: Not required here, set to 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes a single channel to be acquired.

        Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG, 'iScanStartTrigType' must be set to ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' must be set to the same value as 'iAcqStartTrigType'

        • iAcqStartTrigType:

          • ME-4610, ME-4650, ME-4660: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iScanStartTicksLow, iScanStartTicksHigh: Not required here, set to 0.

        • iConvStartTrigType: Use the same value used for 'iAcqStartTrigType' above.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are two alternative ways of terminating the acquisition:

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been acquired and then stop automatically

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iScanStopTrigType: ME_TRIG_TYPE_NONE or ME_TRIG_TYPE_COUNT

        • iScanStopCount:

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_NONE:

            Not required, should be 0.

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_COUNT:

            This is the number of samples after which the acquisition is automatically terminated.

        • iAcqStopTrigType:

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_NONE: ME_TRIG_TYPE_COUNT.

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_COUNT: ME_TRIG_TYPE_FOLLOW.

        • iAcqStopCount:

          • if "iAcqStopTrigType" above is ME_TRIG_TYPE_FOLLOW:

            Not required, should be 0.

          • if "iAcqStopTrigType" above is ME_TRIG_TYPE_COUNT:

            This is the number of channel lists after which the acquisition is automatically terminated.

  • iFifoIrqThreshold: This is the number of data values required in the FIFO before an interrupt is triggered.

    The value used here must be between 1 and the FIFO size in data values.
    To determine the FIFO size see meQuerySubdeviceCapsArgs.

    From the point of view of the user, this determines the responsiveness of the software to incoming data.

    Choosing a lower value here means that incoming data is available more quickly, but increases the processor load as it results in more interrupts.

    See What is the meaning of the parameter 'iFifoIrqThreshold' in the routine meIOStreamConfig and what is a suitable value to use here? in the FAQ.

  • iFlags:

    • ME-4670s, ME-4670is, ME-4680s and ME-4680is boards: Use either ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD.

      Note:
      If ME_IO_STREAM_CONFIG_SAMPLE_AND_HOLD is used then all the elements in the list 'pConfigList' above must have 'iRef' = ME_REF_AI_GROUND.
      In addition, 'sample and hold' only applies to channels 0 to 7.

    • Other boards: No flags defined here - Use ME_IO_STREAM_CONFIG_NO_FLAGS

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: ME_IO_STREAM_READ_NO_FLAGS or ME_IO_STREAM_READ_FRAMES.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog output sub-devices

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Analog output sub-devices

Analog output sub-devices

The analog output sub-devices on the ME-4680xx boards can be used in single and streaming mode. On all other boards they can only be used in single mode.

The sub-devices are single-channeled

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running, configures the sub-device to immediate mode (as opposed to synchronous mode) and outputs 0V.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

These subdevices have only one range:

  • 0: Bipolar 10.0 V

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The meQueryRange... functions behave accordingly.

meQuerySubdeviceCaps

This function returns ME_CAPS_AO_TRIG_SIMULTANEOUS for 'piCaps' for non-streaming sub-devices and ME_CAPS_AO_TRIG_SIMULTANEOUS | ME_CAPS_AO_FIFO for streaming sub-devices.

  • The value ME_CAPS_AO_TRIG_SIMULTANEOUS indicates that it is possible to configure several sub-devices in such a way that single samples can be acquired simultaneously or streaming operations can be started simultaneously on all the sub-devices at once.
  • The value ME_CAPS_AI_FIFO indicates that the sub-device has a FIFO whose size can be queried (see meQuerySubdeviceCapsArgs).

meQuerySubdeviceCapsArgs

Note:
Applies only to analog input sub-devices which support streaming operations.
  • iCap: Must be ME_CAP_AI_FIFO_SIZE.
  • piArgs: A pointer to a single integer in which the FIFO size is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the FIFO size in data values. On older boards this is 4096, newer boards may be provided with a larger FIFO.

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The range. Must be 0 as the sub-device has only a single range.
  • iRef: Must be ME_REF_AO_GROUND.
  • iTrigChan: ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels are configured to trigger channel: default, trigger type: software.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then the last digital value written to the sub-device is returned here. This is the current digital value of the channel.

    • If 'iDir' is 'ME_DIR_OUTPUT' then the digital value which is to be written to the sub-device should be supplied here. Use the utility function meUtilityPhysicalToDigital to convert the physical value in the appropriate units to the corresponding digital value.
  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then no flags are defined here - Use 'ME_IO_SINGLE_TYPE_NO_FLAGS'.

    • If 'iDir' is 'ME_DIR_OUTPUT' then this parameter should either be 'ME_IO_SINGLE_TYPE_NO_FLAGS' or an OR'ed combination of one or both of the flags 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' and 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS'.

      Use the flag 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' here if you have used 'ME_TRIG_TYPE_EXT_DIGITAL' for the parameter 'iTrigType' on configuring the sub-device (see meIOSingleConfig) and you want the routine to return immediately without waiting for the external trigger.

      Use the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' here to output immediately the value for this sub-device and all other sub-devices for which 'ME_TRIG_CHAN_SYNCHRONOUS' was used for the parameter 'iTrigChan' on configuring the sub-device (see meIOSingleConfig).
      In other words, to output values simultaneously to a number of different sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iTrigChan' and then call meIOSingle for each sub-device, employing the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog output sub-devices on the ME-46xx boards have an internal timer with a basic frequency of 33 MHz

The minimum number of ticks which can be used here is 66 (TicksLow = 66, TicksHigh = 0) which corresponds to a frequency of 500 KHz or an output interval of 2 microseconds

For the 'acquisition' timer the number of ticks used must be 0. In other words in is not possible to configure a delay between the arrival of the trigger (hardware or software) and the start of the output operation.

For the 'channel' timer the maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0077 Hz or a sampling time of approx 130 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_ACQ_START or ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a single meIOStreamConfig structure containing the configuration for the one and only channel on the sub-device.

    This structure should be configured as follows:

    • iChannel: The channel index - Must be zero.

    • iStreamConfig: The range index Must be zero.

    • iRef: Must be ME_REF_AO_GROUND.

    • iFlags: Should be ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS
  • iCount: The number of elements in the list 'pConfigList' above - Must be 1.

  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the output is started and the way in which it proceeds once started.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are two alternative modes for governing the start of the operation and way in which data output proceeds:

      • Standard software trigger:

        After calling meIOStreamStart, the output begins without waiting for any external trigger. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW.

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in ME-46xx Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

        • iAcqStopCount:

          If the 'ME_IO_STREAM_CONFIG_WRAPAROUND' is used in 'iFlags' below than this is the number of times the preloaded data-buffer (see 'iWrite mode' in meIOStreamWrite below) should be output before the operation is automatically terminated.
          In this case the value '0' means that the data-buffer will be output repeatedly until meIOStreamStop below is called.

          If 'ME_IO_STREAM_CONFIG_WRAPAROUND' is not used in 'iFlags', then this parameter should be 0.

      • Standard external trigger:

        After calling meIOStreamStart the output is prepared, but does not start until the appropriate trigger is recognised. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in ME-46xx Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

        • iAcqStopCount:

          If the 'ME_IO_STREAM_CONFIG_WRAPAROUND' is used in 'iFlags' below than this is the number of times the preloaded data-buffer (see 'iWrite mode' in meIOStreamWrite below) should be output before the operation is automatically terminated.
          In this case the value '0' means that the data-buffer will be output repeatedly until meIOStreamStop below is called.

          If 'ME_IO_STREAM_CONFIG_WRAPAROUND' is not used in 'iFlags', then this parameter should be 0.
  • iFifoIrqThreshold: This is not used here and should be set to zero.

  • iFlags: Should be ME_IO_STREAM_CONFIG_NO_FLAGS or a combination of the flags ME_IO_STREAM_CONFIG_WRAPAROUND and ME_IO_STREAM_CONFIG_BIT_PATTERN.

    The flag 'ME_IO_STREAM_CONFIG_BIT_PATTERN' can only be employed on the fourth and last of the analog output sub-devices (sub-device index 8) on the ME-4680xx series of boards.
    See Digital output sub-device, Digital input/output sub-device and Analog output sub-device in ME-46xx Special features.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.

    The choice made here is only of importance if the sub-device has been configured to start on receiving an external trigger ('iAcqStartTrigType' set to ME_TRIG_TYPE_EXT_DIGITAL in the trigger structure passed to meIOStreamConfig - see (see meIOStreamConfig)).
    In this case, the routine returns immediately if 'ME_START_MODE_NONBLOCKING' is used, but only returns after the trigger has been recognised and the output operation is started if 'ME_START_MODE_BLOCKING' is used.
  • iTimeOut:

    • If 'iStartMode' above is 'ME_START_MODE_NONBLOCKING': Not required, should be 0.

    • If 'iStartMode' above is 'ME_START_MODE_BLOCKING': Enter a value for the time-out in milliseconds here.
  • iFlags: ME_IO_STREAM_START_TYPE_NO_FLAGS or ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS.

    Use 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' here to start a number of analog output sub-devices simultaneously after configuring them appropriately by setting 'iAcqStartTrigChan' to ME_TRIG_CHAN_SYNCHRONOUS in the trigger structure passed to meIOStreamConfig (see meIOStreamConfig).
    In other words, to start outputting values simultaneously on a number of different analog output streaming sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iAcqStartTrigChan' in the trigger structure and then call meIOStreamStart for each sub-device, employing the flag 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamWrite

  • iWriteMode: ME_WRITE_MODE_PRELOAD, ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING.

    'ME_WRITE_MODE_PRELOAD' must be used before calling meIOStreamStart to provide the sub-device with a first buffer full of data values for a later output operation.
    If ME_IO_STREAM_CONFIG_WRAPAROUND is used in 'iFlags' on calling meIOStreamConfig above then this data buffer is output repeatedly until the operation is terminated and meIOStreamWrite cannot be called again once the operation has started.

    ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING is used after calling meIOStreamStart to provide further data values to an output operation that is already running.
  • piValues: Pointer to an array of integers containing the digital data for the output operation.

    Use the utility functions meUtilityPhysicalToDigital or meUtilityPhysicalToDigitalV to convert the physical values in the appropriate units to the corresponding digital values.
  • piCount: Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values actually transferred to the internal software buffer and which wll be later join the output stream.
  • iFlags: No flags defined here - Use ME_IO_STREAM_WRITE_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus: Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the funtion.

  • piCount: Pointer to an integer which, on returning from the function, contains the amount of space left in the internal software buffer for the sub-device. This is the number of data values which could be written without delay using meIOStreamWrite.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE or ME_STOP_MODE_LAST_VALUE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Counter sub-devices

Counter sub-devices

Each board of the ME-46xx family, except the ME-4650, has three 8254 counter sub-devices. See ME-46xx Device Types for the indices of these sub-devices on the various boards.

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0.

meQuerySubdeviceCaps

This function returns ME_CAPS_CTR_CLK_EXTERNAL for 'piCaps'. This means that only an external pulse can be used to drive the counters on these boards.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be ME_REF_CTR_EXTERNAL.
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function the sub-device is unconfigured. Before using the sub-device to measure an incoming frequency, the routine meIOSingleConfig below must be called.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_NONBLOCKING then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function the sub-device is unconfigured. Before using the sub-device to generate a pulse, the routine meIOSingleConfig below must be called.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: External IRQ sub-device

  • ME-46xx Description
  • Using the ME-iDS API with the ME-46xx boards.

External IRQ sub-device

External IRQ sub-device

Each board of the ME-46xx family has exactly one external irq sub-device. See ME-46xx Device Types for the index of this sub-device on the various boards.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_EXT_IRQ_EDGE_RISING, ME_CAPS_EXT_IRQ_EDGE_FALLING and ME_CAPS_EXT_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameter 'iIrqEdge' in meIOIrqStart.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback! each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: Must be ME_IRQ_SOURCE_DIO_LINE.
  • iIrqEdge: ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg: Ignored here, should be 0.
  • iFlags: Not required, use ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: 0 is always returned here.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5xxx Description

ME-5xxx Description

ME-5xxx Description - Contents:

  • Device types.
    • ME-5100
    • ME-5261-8
    • ME-5261-8E
    • ME-5265-8
    • ME-5265-8E
    • ME-5284-8
    • ME-5284-8E
    • ME-5001
    • ME-5351
    • ME-5810A
    • ME-5820
    • ME-5821
    • ME-5810A/S
    • ME-5002
    • ME-5004
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.
    • Digital input sub-device.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Digital output sub-device.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamWrite.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Device properties.
      • Digital input sub-device properties.
      • Digital output sub-device properties.
      • Digital input / output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.
  • Using the ME-iDS API with an ME-5261-8, ME-5261-8E, ME-5265-8, ME-5265-8E ME-5284-8 or ME-5284-8E board.
    • Analog input sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Device properties.
      • Digital input sub-device properties.
      • Digital input / output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.
  • Using the ME-iDS API with an ME-5001 board.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Device properties.
      • Digital input / output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.
    • Digital input sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Digital output sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
    • Device properties.
      • Digital input sub-device properties.
      • Digital output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.
      • Counter sub-device properties.
  • Using the ME-iDS API with an ME-5810A/S board.
    • Digital input sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Digital output sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamWrite.
      • meIOStreamStatus.
      • meIOStreamStop.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
    • Device properties.
      • Digital input sub-device properties.
      • Digital output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.
      • Counter sub-device properties.
  • Using the ME-iDS API with an ME-5002 board.
    • Digital input sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Digital output sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
    • Frequency input sub-devices (frequency measurement).
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOSingleTicksToTime.
    • Frequency output sub-devices (pulse generation).
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingleTimeToTicks.
      • meIOSingle.
    • Device properties.
      • Digital input sub-device properties.
      • Digital output sub-device properties.
      • Frequency input sub-device properties.
      • Frequency output sub-device properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-5xxx Description

Device Types

Device Types

The ME-5000 board exists in the following varieties:

Note:
Some of the sub-devices on the ME-5xxx boards are configurable.
Using the configuration tool MEiDC.exe the sub-device type can be selected. In the list below the selections available for each sub-device are seperated by a '/'.

ME-5100

2 Subdevices

  • 0: Digital Input subdevice with streaming 16 bits wide / Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice with streaming 16 bits wide / Digital Input/Output subdevice - 16 bits wide / Frequency Output device (pulse generation) - 4 channels

ME-5351

2 Subdevices

  • 0: Digital Input subdevice with streaming 16 bits wide / Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice with streaming 16 bits wide / Digital Input/Output subdevice - 16 bits wide / Frequency Output device (pulse generation) - 4 channels

ME-5261-8

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 16-Bit resolution, maximum sampling rate 250 kHz, range -+10.4 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5261-8E

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 16-Bit resolution, maximum sampling rate 250 kHz, range -+104.0 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5265-8

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 16-Bit resolution, maximum sampling rate 2 MHz, range -+10.4 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5265-8E

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 16-Bit resolution, maximum sampling rate 2 MHz, range -+104.0 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5284-8

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 18-Bit resolution, maximum sampling rate 1.6 MHz, range -+10.4 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5284-8E

2 Subdevices

  • 0: Analog Input subdevice with streaming - 8 channels, 18-Bit resolution, maximum sampling rate 1.6 MHz, range -+104.0 V
  • 1: Digital Input/Output subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 4 channels / Frequency Output device (pulse generation) - 4 channels

ME-5001

6 Subdevices

  • 0: Digital Input/Output subdevice - 8 bits wide / Frequency Input device (frequency measurement) - 8 channels
  • 1: Digital Input/Output subdevice - 8 bits wide / Frequency Output device (pulse generation) - 8 channels
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide

ME-5810A

5 Subdevices

  • 0: Digital Input subdevice 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice 16 bits wide / Frequency Output device (pulse generation) - 4 channels
  • 2: 8254 Counter subdevice
  • 3: 8254 Counter subdevice
  • 4: 8254 Counter subdevice

ME-5820

5 Subdevices

  • 0: Digital Input subdevice 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice 16 bits wide / Frequency Output device (pulse generation) - 4 channels
  • 2: 8254 Counter subdevice
  • 3: 8254 Counter subdevice
  • 4: 8254 Counter subdevice

ME-5821

7 Subdevices

  • 0: Digital Input subdevice 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice 16 bits wide / Frequency Output device (pulse generation) - 4 channels
  • 2: 8254 Counter subdevice
  • 3: 8254 Counter subdevice
  • 4: 8254 Counter subdevice
  • 5: Digital Input subdevice 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 6: Digital Output subdevice 16 bits wide / Frequency Output device (pulse generation) - 4 channels

ME-5810A/S

5 Subdevices

  • 0: Digital Input subdevice with streaming 16 bits wide / Frequency Input device (frequency measurement) - 4 channels
  • 1: Digital Output subdevice with streaming 16 bits wide / Frequency Output device (pulse generation) - 4 channels
  • 2: 8254 Counter subdevice
  • 3: 8254 Counter subdevice
  • 4: 8254 Counter subdevice

ME-5002

2 Subdevices

  • 0: Digital Input subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 8 channels
  • 1: Digital Output subdevice - 16 bits wide / Frequency Output device (pulse generation) - 8 channels

ME-5004

2 Subdevices

  • 0: Digital Input subdevice - 16 bits wide / Frequency Input device (frequency measurement) - 8 channels
  • 1: Digital Output subdevice - 16 bits wide / Frequency Output device (pulse generation) - 8 channels

Extra D-sub connector


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5100 and ME-5351 boards.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Using the ME-iDS API with the ME-5100 and ME-5351 boards.

See also ME-5100 and ME-5351 - Device properties

  • Digital input sub-device.
  • Digital output sub-device.
  • Digital input/output sub-devices.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • ME-5100 Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Digital input sub-device

Digital input sub-device

The digital input sub-device, which can be used in single and streaming mode, is 16-bits wide.

The following API functions are supported for this sub-device (see also ME-5100 - Digital input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger and any streaming operation which may be running or waiting for a hardware trigger

. The sub-device is returned to its default configuration:

  • Single mode - Sofware start.
  • Streaming mode - Software start, software termination, sampling rate 100 Hz, data from port A

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • If 'iTrigType' is ME_TRIG_TYPE_DIGITAL, then this parameter contains the bit-coded trigger conditions for the operation.
      Bits 0 to 7 determine whether a falling edge on the bits 0 to 7 of port A will trigger a measurement.
      Bit 15 determines whether a falling edge on trigger line A will trigger a measurement.
      Bits 16 to 23 determine whether a rising edge on the bits 0 to 7 of port A will trigger a measurement.
      Bit 31 determines whether a rising edge on trigger line A will trigger a measurement.

      The trigger conditions are OR'd together. In other words the measurement will be triggered if any one of the conditions is met.
      At least one trigger condition must be defined. That's to say, at least one of the above bits in iTrigEdge must be set.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, the single mode of this sub-device is configured for a software trigger.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 (lower byte) or 1 (upper byte).

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the 16-bit port value between Hex 0 and Hex FFFF will be returned here.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper 8-bits of the port value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: If, on configuring the sub-device (see meIOSingleConfig), 'iTrigType' = ME_TRIG_TYPE_SW has been used here, then this should be 0.

    If 'iTrigType' = ME_TRIG_TYPE_EXT_DIGITAL was used then a value for the time-out in milliseconds should be entered here.
    A value of 0 in this case means that the routine will not return until the trigger condition has been met or the operation has been cancelled.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The digital input sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz

The minimum number of ticks which can be used here is 2 (TicksLow = 2, TicksHigh = 0) which corresponds to a frequency of 33 MHz or a sampling time of circa 30 nanoseconds

The maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0154 Hz or a sampling time of approx 65 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS / ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This should be a pointer to a single meIOStreamConfig structure containing the configuration for the sub-device.
    This structure should be configured as follows:

    • iChannel: Must be 0.
    • iStreamConfig: Not required - use ME_VALUE_NOT_USED (0).
    • iRef: Not required - use ME_VALUE_NOT_USED (0).
    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: Must be 1, the number of elements in the array pConfigList.
  • pTrigger: This is a pointer to an meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are three alternative modes for governing the start of the acquisition and way in which sampling proceeds (see however iFlags below):

      • Standard software trigger:

        After calling meIOStreamStart, the acquisition starts immediately without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_SW.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised.
        The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge:

          Together with iAcqStartArgs[0] (below) this parameter contains the bit-coded trigger conditions for starting the streaming operation.
          Bits 0 to 15 determine whether a falling edge on the bits 0 to 15 of port A will start the measurement.
          Bits 16 to 31 determine whether a rising edge on the bits 0 to 15 of port A will start the measurement.
          The trigger conditions are OR'd together. In other words the measurement will be started if any one of the trigger conditions is met (see also iAcqStartArgs below).

        • iAcqStartArgs:

          The first element of this array, iAcqStartArgs[0], together with iAcqStartTrigEdge (above) contains the bit-coded trigger conditions for starting the streaming operation.
          Bit 0 determines whether a falling edge on trigger line A will start the measurement.
          Bit 16 determines whether a rising edge on trigger line A will start the measurement.
          The trigger conditions are OR'd together. In other words the measurement will be started if any one of the trigger conditions is met (see also iAcqStartTrigEdge above).

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an additional value to be acquired.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge:

          Together with iAcqStartArgs[0] (below) this parameter contains the bit-coded trigger conditions for starting the streaming operation and for acquiring each subsequent value.

          Bits 0 to 15 determine whether a falling edge on the bits 0 to 15 of port A will trigger a measurement.
          Bits 16 to 31 determine whether a rising edge on the bits 0 to 15 of port A will trigger a measurement.

          The trigger conditions are OR'd together. In other words the measurement will be triggered if any one of the trigger conditions is met (see also iAcqStartArgs below).

        • iAcqStartArgs:

          The first element of this array, iAcqStartArgs[0], together with iAcqStartTrigEdge (above) contains the bit-coded trigger conditions for starting the streaming operation and for acquiring each subsequent value.

          Bit 0 determines whether a falling edge on trigger line A will trigger a measurement.
          Bit 16 determines whether a rising edge on trigger line A will trigger a measurement.

          The trigger conditions are OR'd together. In other words the measurement will be triggered if any one of the trigger conditions is met (see also iAcqStartTrigEdge above).

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are four alternative ways of terminating the acquisition (see however iFlags below):

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been acquired and then stop automatically.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_COUNT.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0

      • Run until a hardware trigger is recognised.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStopArgs:

          The first two element of this array, iAcqStopArgs[0] and iAcqStopArgs[1] contain the bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port A will stop the measurement.
          Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port A will stop the measurement.
          Bit 0 of iAcqStopArgs[1] determines whether a falling edge on trigger line A will stop the measurement.
          Bit 16 of iAcqStopArgs[1] determines whether a rising edge on trigger line A will stop the measurement.

          The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

      • Run until a predetermined amount of data has been acquired or until a hardware trigger is recognised.
        This is simply a combination of the last two modes.
        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT.

        • iAcqStopArgs:

          The first two elements of this array, iAcqStopArgs[0] and iAcqStopArgs[1] contain the bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port A will stop the measurement.
          Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port A will stop the measurement.
          Bit 0 of iAcqStopArgs[1] determines whether a falling edge on trigger line A will stop the measurement.
          Bit 16 of iAcqStopArgs[1] determines whether a rising edge on trigger line A will stop the measurement.

          The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0
  • iFifoIrqThreshold: This is the minimum size of the blocks in which the data is transferred to the user.

    From the point of view of the user, this determines the responsiveness of the software to incoming data.

    Choosing a lower value here means that incoming data is available more quickly, but increases the processor load as it results in more interrupts.

  • iFlags: Use either ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_INTERNAL_COUNTER

    Note:
    The flag ME_IO_STREAM_CONFIG_INTERNAL_COUNTER is intended for test purposes. If this flag is used the acquisition data comes not from port A but from an internal counter which counts up from 0 to 65535 (Hex 0xFFFF).
    In this case the acquisition can only be started and stopped per software, hardware triggers are not accepted.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: No flags defined here - ME_IO_STREAM_READ_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Digital output sub-devices

Digital output sub-devices

The digital output sub-device, which can be used in single or in streaming mode, is 16-bits wide.

The following API functions are supported for these sub-devices (see also ME-5100 - Digital output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger and any streaming operation which may be running or waiting for a hardware trigger

. The sub-device is returned to its default configuration:

  • Single mode - Sofware start.
  • Streaming mode - Software start, no wraparound, software termination, output rate 100 Hz.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, the single mode of this sub-device is configured for a software trigger.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The digital output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz

The minimum number of ticks which can be used here is 2 (TicksLow = 2, TicksHigh = 0) which corresponds to a frequency of 33 MHz or a sampling time of circa 30 nanoseconds

The maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0154 Hz or a sampling time of approx 65 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This should be a pointer to a single meIOStreamConfig structure containing the configuration for the sub-device.
    This structure should be configured as follows:

    • iChannel: Must be 0.
    • iStreamConfig: Not required - use ME_VALUE_NOT_USED (0).
    • iRef: Not required - use ME_VALUE_NOT_USED (0).
    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: Must be 1, the number of elements in the array pConfigList.
  • pTrigger: This is a pointer to an meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are three alternative modes for governing the start of the output and way in which the output proceeds:

      • Standard software trigger:

        After calling meIOStreamStart, the output begins immediately without waiting for any external trigger. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the output is prepared, but does not start until the appropriate trigger is recognised.
        The trigger source is a rising or falling edge on trigger line B. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an additional value to be acquired.
        The trigger source is a rising or falling edge on trigger line B.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are four alternative ways of terminating the output:

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been output and then stop automatically.

        This termination mode is used in conjunction with the flag ME_IO_STREAM_CONFIG_WRAPAROUND (see iFlags below. This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_COUNT.
          Note:
          The flag ME_IO_STREAM_CONFIG_WRAPAROUND must also be used.

        • iAcqStopCount: This is the number of times the data buffer loaded before calling meIOStreamStart is output before the operation is automatically terminated. (see iFlags below).
          This value must be greater than 0.

      • Run until a hardware trigger is recognised.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL.
          The output is terminated when a bit change is detected on one of a selected number of digital lines.

        • iAcqStopArgs: The first element of this array, iAcqStopArgs[0] contains bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port B will stop the output.
          Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port B will stop the output.

          The lowest two bits of the second elemnt of this array, iAcqStopArgs[1] contain additional bit-coded trigger conditions for stopping the streaming operation.

          Bit 0 of iAcqStopArgs[1] determines whether a falling edge on trigger line B will stop the output.
          Bit 16 of iAcqStopArgs[1] determines whether a rising edge on trigger line B will stop the output.

          The trigger conditions are OR'd together. In other words the output will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

      • Run until a predetermined amount of data has been output or until a hardware trigger is recognised.
        This is simply a combination of the last two modes.
        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT.
          The output is terminated when a bit change is detected on one of a selected number of digital lines or when the pre-determined number of values has been output.

        • iAcqStopArgs: The first element of this array, iAcqStopArgs[0] contains bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port B will stop the output.
          Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port B will stop the output.

          The lowest two bits of the second elemnt of this array, iAcqStopArgs[1] contain additional bit-coded trigger conditions for stopping the streaming operation.

          Bit 0 of iAcqStopArgs[1] determines whether a falling edge on trigger line B will stop the output.
          Bit 16 of iAcqStopArgs[1] determines whether a rising edge on trigger line B will stop the output.

          The trigger conditions are OR'd together. In other words the output will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

        • iAcqStopCount: This is the number of times the data buffer loaded before calling meIOStreamStart is output before the operation is automatically terminated. (see iFlags below).
          This value must be greater than 0.
  • iFifoIrqThreshold: This is not used here and should be set to zero.

  • iFlags: Should be ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_WRAPAROUND.

    If the flag ME_IO_STREAM_CONFIG_WRAPAROUND is used, then a single data buffer is output repeatedly.
    This data buffer is loaded using the function meIOStreamWrite with 'iWriteMode' = ME_WRITE_MODE_PRELOAD (see below).

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.

    The choice made here is only of importance if the sub-device has been configured to start on receiving an external trigger ('iAcqStartTrigType' set to ME_TRIG_TYPE_EXT_DIGITAL in the trigger structure passed to meIOStreamConfig - see (see meIOStreamConfig)).
    In this case, the routine returns immediately if 'ME_START_MODE_NONBLOCKING' is used, but only returns after the trigger has been recognised and the output operation is started if 'ME_START_MODE_BLOCKING' is used.
  • iTimeOut:

    • If 'iStartMode' above is 'ME_START_MODE_NONBLOCKING': Not required, should be 0.

    • If 'iStartMode' above is 'ME_START_MODE_BLOCKING': Enter a value for the time-out in milliseconds here.
  • iFlags: ME_IO_STREAM_START_TYPE_NO_FLAGS.

meIOStreamWrite

  • iWriteMode: ME_WRITE_MODE_PRELOAD, ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING.

    'ME_WRITE_MODE_PRELOAD' must be used before calling meIOStreamStart to provide the sub-device with a first buffer full of data values for a later output operation.
    If ME_IO_STREAM_CONFIG_WRAPAROUND is used in 'iFlags' on calling meIOStreamConfig above then this data buffer is output repeatedly until the operation is terminated and meIOStreamWrite cannot be called again once the operation has started.

    ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING is used after calling meIOStreamStart to provide further data values to an output operation that is already running.
  • piValues: Pointer to an array of integers containing the digital data for the output operation.
  • piCount: Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values actually transferred to the internal software buffer and which will later join the output stream.
  • iFlags: No flags defined here - Use ME_IO_STREAM_WRITE_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus: Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the funtion.

  • piCount: Pointer to an integer which, on returning from the function, contains the amount of space left in the internal software buffer for the sub-device. This is the number of data values which could be written without delay using meIOStreamWrite.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE or ME_STOP_MODE_LAST_VALUE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 16 bits wide.

The following API functions are supported for this sub-device (see also ME-5100 - Digital input/output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function causes a call to meIOIrqWait which may be waiting for an interrupt to return with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed to be called with the same error code.

The sub-device is then configured for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_WORD, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.

ME_CAPS_DIO_DIR_WORD means that the port direction can only be changed 16-bit-wise. In other words, the entire port must be set either for input or for output.
The remaining flags indicate that when used for input, the sub-device can generate an interrupt when a bit changes from low to high and/or from high to low takes place. See the parameters 'iIrqSource' and 'iIrqEdge' and 'iIrqArg' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_WORD.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 for the lower 8 bits or 1 for the upper 8 bits.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then the 8-bit value between Hex 0 and Hex FF of the corresponding port byte will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time a change in the port bit pattern causes an interrupt. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge: ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 16-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

    • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then the upper 16-bits here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags: Not required, ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternative to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: The value returned here indicates which port bits have changed since the last time this routine was called.

    The lower 16 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

    The upper 16 bits show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-5100 - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all four channels on the sub-device.

After calling this function, all four channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-5100 boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 12 'ticks' corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 6 ticks corresponding aprroximately to 0.09 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-5100 - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function, all four channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 12 corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 6 corresponding aprroximately to 0.09 microseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5100 and ME-5351 Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5100 and ME-5351 boards.

ME-5100 and ME-5351 Properties

ME-5100 and ME-5351 - Device properties

Apart from the standard device properties (see General device properties) the ME-5100 devices have the following additional properties:

ME-5100 - Device properties
Name | Type | Access | Possible values
IOPinVoltageLevel | Define | Read / Write | ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS, ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS

ME-5100 - Digital input sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5100 digital input sub-devices have the following additional properties:

ME-5100 - Digital input sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SingleConfiguration | Container | -
StreamingConfiguration | Container | -

ME-5100 - Digital input sub-device - 'SingleConfiguration' properties
Name | Type | Access | Possible values
TriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ExtDigitaltriggerCondition | Container | - | -

ME-5100 - Digital input sub-device - 'SingleConfiguration' - 'ExtDigitalTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15
RisingEdgeTriggerA | Boolean | Read / Write
FallingEdgeTriggerA | Boolean | Read / Write

ME-5100 - Digital input sub-device - 'StreamingConfiguration' properties
Name | Type | Access | Possible values
InternalBufferSize | Integer | Read only | -
SystemClockfrequency | Double | Read only | -
SampleFrequency | Double | Read / Write | -
SampleTime | Double | Read / Write | -
UseInternalTestCounter | Boolean | Read / Write | -
TransferSize | Integer | Read / Write | -
StartTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ConvTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StartAndConvTriggerCondition | Container | - | -
StopTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StopTriggerCondition | Container | - | -
StopOnCount | Boolean | Read / Write | -
StopCount | Integer | Read / Write | -

ME-5100 - Digital input sub-device - 'StreamingConfiguration' - 'StartAndConvTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15
RisingEdgeTriggerA | Boolean | Read / Write
FallingEdgeTriggerA | Boolean | Read / Write

ME-5100 - Digital input sub-device - 'StreamingConfiguration' - 'StopTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15
RisingEdgeTriggerA | Boolean | Read / Write
FallingEdgeTriggerA | Boolean | Read / Write

ME-5100 - Digital output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5100 digital output sub-devices have the following additional properties:

ME-5100 - Digital output sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SingleConfiguration | Container | -
StreamingConfiguration | Container | -

ME-5100 - Digital output sub-device - 'SingleConfiguration' properties
Name | Type | Access | Possible values
TriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ExtDigitaltriggerCondition | Container | - | -

ME-5100 - Digital output sub-device - 'SingleConfiguration' - 'ExtDigitalTriggerCondition' properties
Name | Type | Access
RisingEdgeTriggerB | Boolean | Read / Write
FallingEdgeTriggerB | Boolean | Read / Write

ME-5100 - Digital output sub-device - 'StreamingConfiguration' properties
Name | Type | Access | Possible values
InternalBufferSize | Integer | Read only | -
SystemClockfrequency | Double | Read only | -
SampleFrequency | Double | Read / Write | -
SampleTime | Double | Read / Write | -
Wraparound | Boolean | Read / Write | -
WraparoundLoops | Integer | Read / Write | -
StartTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ConvTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StartAndConvTriggerCondition | Container | - | -
StopTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StopTriggerCondition | Container | - | -
StopOnCount | Boolean | Read / Write | -
StopCount | Integer | Read / Write | -

ME-5100 - Digital output sub-device - 'StreamingConfiguration' - 'StartAndConvTriggerCondition' properties
Name | Type | Access
RisingEdgeTriggerB | Boolean | Read / Write
FallingEdgeTriggerB | Boolean | Read / Write

ME-5100 - Digital output sub-device - 'StreamingConfiguration' - 'StopTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15
RisingEdgeTriggerB | Boolean | Read / Write
FallingEdgeTriggerB | Boolean | Read / Write

ME-5100 - Digital input/output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5100 digital input/output sub-devices have the following additional properties:

ME-5100 - Digital input/output sub-device properties
Name | Type | Access | Possible values
Terminated | Boolean | Read / Write | -
Direction | Define | Read / Write | ME_SINGLE_CONFIG_DIO_INPUT, ME_SINGLE_CONFIG_DIO_OUTPUT
InterruptCondition | Container | -

ME-5100 - Digital input/output sub-device - 'InterruptCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5100 - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5100 frequency input sub-devices have the following additional properties:

ME-5100 - Frequency input sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-5100 - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5100 frequency output sub-devices have the following additional properties:

ME-5100 - Frequency output sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SystemClockfrequency | Double | Read only
MinTotalTicks | Integer | Read only
MaxTotalTicks | Integer | Read only
MinFirstPhaseTicks | Integer | Read only
MaxFirstPhaseTicks | Integer | Read only
MinTotalTime | Double | Read only
MaxTotalTime | Double | Read only
MinFirstPhaseTime | Double | Read only
MaxFirstPhaseTime | Double | Read only
Channels | Container | -

ME-5100 - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-5100 - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

See also ME-52xx - Device properties

  • Analog input sub-device.
  • Digital input/output sub-devices.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • ME-52xx Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog input sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

Analog input sub-device

Digital input sub-device

The analog input sub-device, which can be used in single and streaming mode, has 8 channels.

The following API functions are supported for this sub-device (see also ME-52xx - Analog input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger and any streaming operation which may be running or waiting for a hardware trigger

. The sub-device is returned to its default configuration:

  • Single mode - Sofware start for all channels.
  • Streaming mode - Software start, software termination, sampling rate 100 Hz, no channels selected for acquisition.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

The ME-52xx boards have only one range:

ME-5284-8 boards

  • 0: Bipolar 10.4 V

    Physical range: -10.4 V - +10,399683 V
    Digital range: 0 - 262143 (Hex FFFF) - 16 Bit resolution

ME-5284-8E boards

  • 0: Bipolar 104.0 V

    Physical range: -104 V - +103.99683 V
    Digital range: 0 - 262143 (Hex FFFF) - 16 Bit resolution

ME-5261-8 or ME-5265-8 boards

  • 0: Bipolar 10.4 V

    Physical range: -10.4 V - +10.399921 V
    Digital range: 0 - 262143 (Hex 3FFFF) - 18 Bit resolution

ME-5261-8E or ME-5265-8E boards

  • 0: Bipolar 104.0 V

    Physical range: -104.0 V - +103.99921 V
    Digital range: 0 - 262143 (Hex 3FFFF) - 18 Bit resolution

The meQueryRange... functions behave accordingly.

meIOSingleConfig

  • iChannel: The channel index, 0 - 7.
  • iSingleConfig: The range index, must be 0.
  • iRef: Use ME_REF_AI_DIFFERENTIAL or ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • If 'iTrigType' is ME_TRIG_TYPE_DIGITAL, then this parameter contains the bit-coded trigger conditions for the operation.
      Bits 0 determines whether a falling edge on trigger line A1 will trigger a measurement.
      Bits 1 determines whether a falling edge on trigger line A2 will trigger a measurement.
      Bits 16 determines whether a rising edge on trigger line A1 will trigger a measurement.
      Bits 17 determines whether a rising edge on trigger line A2 will trigger a measurement.

      The trigger conditions are OR'd together. In other words the measurement will be triggered if any one of the conditions is met.
      At least one trigger condition must be defined. That's to say, at least one of the above bits in iTrigEdge must be set.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels on this sub-device are configured to use a software trigger in single mode.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: The channel index, 0 - 7.
  • iDir: Must be ME_DIR_INPUT.
  • iValue: The current value measured on channel 'iChannel' will be returned here. This is the digital value which can be converted to a voltage with the help of the utility function 'meUtilityDigitalToPhysical'.
  • iTimeOut: If, on configuring the sub-device (see meIOSingleConfig), 'iTrigType' = ME_TRIG_TYPE_SW has been used here, then this should be 0.

    If 'iTrigType' = ME_TRIG_TYPE_EXT_DIGITAL was used then a value for the time-out in milliseconds should be entered here.
    A value of 0 in this case means that the routine will not return until the trigger condition has been met or the operation has been cancelled.
  • iFlags: No flags defined here, use ME_IO_SINGLE_TYPE_NO_FLAGS

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog input sub-device on the ME-52xx boards has an internal timer with a basic frequency of 66 MHz

On the ME-5261-8 and ME-5261-8E boards the minimum number of ticks which can be used is 264 (TicksLow = 264, TicksHigh = 0) which corresponds to a frequency of 250 kHz or a sampling time of 4 microseconds

On the ME-5265-8 and ME-5265-8E boards the minimum number of ticks which can be used is 33 (TicksLow = 33, TicksHigh = 0) which corresponds to a frequency of 2 MHz or a sampling time of 500 nanoseconds

On the ME-5284-8 and ME-5284-8E boards the minimum number of ticks which can be used is 41 (TicksLow = 41, TicksHigh = 0) which corresponds to a frequency of 1.61 MHz or a sampling time of circa 621 nanoseconds

The maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0154 Hz or a sampling time of approx 65 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_CONV_START or ME_TIMER_SCAN_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS / ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a list of meIOStreamConfig structures containing the configuration for the individual channels.
    The elements of this list should be configured as follows:

    • iChannel: The channel index, 0 - 7.
    • iStreamConfig: The range used - must be 0.
    • iRef: Use ME_REF_AI_DIFFERENTIAL or ME_VALUE_NOT_USED (0).
    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

Note:
The channels in the list must appear in ascending order and no channel should appear more than once.
  • iCount: The number of elements in the array pConfigList.
  • pTrigger: This is a pointer to an meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are three alternative modes for governing the start of the acquisition and way in which sampling proceeds (see however iFlags below):

      • Standard software trigger:

        After calling meIOStreamStart, the acquisition starts immediately without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_SW.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised.
        The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge:

          This parameter contains the bit-coded trigger conditions for starting the streaming operation.

          Bits 0 determines whether a falling edge on trigger line A1 will trigger a measurement.
          Bits 1 determines whether a falling edge on trigger line A2 will trigger a measurement.
          Bits 16 determines whether a rising edge on trigger line A1 will trigger a measurement.
          Bits 17 determines whether a rising edge on trigger line A2 will trigger a measurement.

          The trigger conditions are OR'd together. In other words the measurement will be started if any one of the trigger conditions is met.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an additional value to be acquired.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge:

          This parameter contains the bit-coded trigger conditions for starting the streaming operation.

          Bits 0 determines whether a falling edge on trigger line A1 will trigger a measurement.
          Bits 1 determines whether a falling edge on trigger line A2 will trigger a measurement.
          Bits 16 determines whether a rising edge on trigger line A1 will trigger a measurement.
          Bits 17 determines whether a rising edge on trigger line A2 will trigger a measurement.

          The trigger conditions are OR'd together. In other words the measurement will be started if any one of the trigger conditions is met.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are four alternative ways of terminating the acquisition (see however iFlags below):

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been acquired and then stop automatically.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_COUNT.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0

      • Run until a hardware trigger is recognised.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStopArgs:

          The first element of this array, iAcqStopArgs[0] contains the bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 of iAcqStopArgs[0] determines whether a falling edge on trigger line A1 will stop the measurement.
          Bits 1 determines whether a falling edge on trigger line A2 will stop the measurement.
          Bits 16 determines whether a rising edge on trigger line A1 will stop the measurement.
          Bits 17 determines whether a rising edge on trigger line A2 will stop the measurement.

          The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

      • Run until a predetermined amount of data has been acquired or until a hardware trigger is recognised.
        This is simply a combination of the last two modes.
        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT.

        • iAcqStopArgs:

          The first element of this array, iAcqStopArgs[0] contains the bit-coded trigger conditions for stopping the streaming operation.

          Bits 0 of iAcqStopArgs[0] determines whether a falling edge on trigger line A1 will stop the measurement.
          Bits 1 determines whether a falling edge on trigger line A2 will stop the measurement.
          Bits 16 determines whether a rising edge on trigger line A1 will stop the measurement.
          Bits 17 determines whether a rising edge on trigger line A2 will stop the measurement.

          The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0
  • iFifoIrqThreshold: This is the minimum size of the blocks in which the data is transferred to the user.

    From the point of view of the user, this determines the responsiveness of the software to incoming data.

    Choosing a lower value here means that incoming data is available more quickly, but increases the processor load as it results in more interrupts.

  • iFlags: Use either ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_INTERNAL_COUNTER

    Note:
    The flag ME_IO_STREAM_CONFIG_INTERNAL_COUNTER is intended for test purposes. If this flag is used the acquisition data comes not from port A but from an internal counter which counts up from 0 to 65535 (Hex 0xFFFF).
    In this case the acquisition can only be started and stopped per software, hardware triggers are not accepted.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: No flags defined here - ME_IO_STREAM_READ_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device (see also ME-52xx - Digital input/output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function causes a call to meIOIrqWait which may be waiting for an interrupt to return with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed to be called with the same error code.

The sub-device is then configured for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE, ME_CAPS_DIO_BIT_PATTERN_IRQ, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.

ME_CAPS_DIO_DIR_BYTE means that the port direction can only be changed 8-bit-wise. In other words, the entire port must be set either for input or for output.
The remaining flags indicate that when used for input, the sub-device can generate an interrupt when the port bits match a pre-assigned pattern or when a bit changes from low to high and/or from high to low takes place. See the parameters 'iIrqSource', 'iIrqEdge' and 'iIrqArg' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then the port value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE.
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time a change in the port bit pattern causes an interrupt. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this should be ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 8-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then:

      • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 8-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

      • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then bits 16 bto 23 here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x11 and the port value changes from 0x01 to 0x10 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x11 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_EXTENDED_STATUS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternative to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then the value returned here indicates which port bits have changed since the last time this routine was called.
      The lower 8 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

      Bits 16 to 23 show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-52xx - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all four channels on the sub-device.

After calling this function, all four channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-52xx boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 12 'ticks' corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 6 ticks corresponding aprroximately to 0.09 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-52xx - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function, all four channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 12 corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 6 corresponding aprroximately to 0.09 microseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-52xx Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5261-8,ME-5261-8E, ME-5265-8, ME-5265-8E, ME-5284-8 or ME-5284-8E board.

ME-52xx Properties

ME-52xx - Device properties

The ME-52xx devices have all the standard device properties (see General device properties)

ME-52xx - Analog input sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-52xx analog input sub-devices have the following additional properties:

ME-52xx - Analog input sub-device properties
Name | Type | Access | Possible values
Calibration | Define | Read / Write | ME_CALIBRATION_TYPE_FACTORY, ME_CALIBRATION_TYPE_USER_1
SingleConfiguration | Container | - | -
StreamingConfiguration | Container | - | -

ME-52xx - Analog input sub-device - 'SingleConfiguration' properties
Name | Type | Access
Channels | Container | -

ME-52xx - Analog input sub-device - 'SingleConfiguration' - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -
Channel4 | Container | -
Channel5 | Container | -
Channel6 | Container | -
Channel7 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-52xx - Analog sub-device - 'SingleConfiguration' - 'Channels' - Channel# properties
Name | Type | Access | Possible values
TriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ExtDigitaltriggerCondition | Container | - | -

ME-52xx - Analog input sub-device - 'SingleConfiguration' - 'Channels' - Channel# - 'ExtDigitalTriggerCondition' properties
Name | Type | Access
RisingEdgeTriggerA1 | Boolean | Read / Write
FallingEdgeTriggerA1 | Boolean | Read / Write
RisingEdgeTriggerA2 | Boolean | Read / Write
FallingEdgeTriggerA2 | Boolean | Read / Write

ME-52xx - Analog input sub-device - 'StreamingConfiguration' properties
Name | Type | Access | Possible values
InternalBufferSize | Integer | Read only | -
SystemClockfrequency | Double | Read only | -
SampleFrequency | Double | Read / Write | -
SampleTime | Double | Read / Write | -
UseInternalTestCounter | Boolean | Read / Write | -
TransferSize | Integer | Read / Write | -
StartTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ConvTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StartAndConvTriggerCondition | Container | - | -
StopTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StopTriggerCondition | Container | - | -
StopOnCount | Boolean | Read / Write | -
StopCount | Integer | Read / Write | -
Channels | Container | - | -

ME-52xx - Analog input sub-device - 'StreamingConfiguration' - 'StartAndConvTriggerCondition' properties
Name | Type | Access
TriggerA1RisingEdge | Boolean | Read / Write
TriggerA1FallingEdge | Boolean | Read / Write
TriggerA2RisingEdge | Boolean | Read / Write
TriggerA2FallingEdge | Boolean | Read / Write

ME-52xx - Analog input sub-device - 'StreamingConfiguration' - 'StopTriggerCondition' properties
Name | Type | Access
TriggerA1RisingEdge | Boolean | Read / Write
TriggerA1FallingEdge | Boolean | Read / Write
TriggerA2RisingEdge | Boolean | Read / Write
TriggerA2FallingEdge | Boolean | Read / Write

ME-52xx - Analog input sub-device - 'StreamingConfiguration' - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -
Channel4 | Container | -
Channel5 | Container | -
Channel6 | Container | -
Channel7 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-52xx - Analog sub-device - 'StreamingConfiguration' - 'Channels' - Channel# properties
Name | Type | Access
AcquireChannel | Boolean | Read / Write

ME-52xx - Digital input/output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-52xx digital input/output sub-devices have the following additional properties:

ME-52xx - Digital input/output sub-device properties
Name | Type | Access | Possible values
Terminated | Boolean | Read / Write | -
Direction | Define | Read / Write | ME_SINGLE_CONFIG_DIO_INPUT, ME_SINGLE_CONFIG_DIO_OUTPUT
InterruptCondition | Container | -

ME-52xx - Digital input/output sub-device - 'InterruptCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-52xx - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-52xx frequency input sub-devices have the following additional properties:

ME-52xx - Frequency input sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-52xx - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-52xx frequency output sub-devices have the following additional properties:

ME-52xx - Frequency output sub-device properties
Name | Type | Access
Terminated | Boolean | Read / Write
SystemClockfrequency | Double | Read only
MinTotalTicks | Integer | Read only
MaxTotalTicks | Integer | Read only
MinFirstPhaseTicks | Integer | Read only
MaxFirstPhaseTicks | Integer | Read only
MinTotalTime | Double | Read only
MaxTotalTime | Double | Read only
MinFirstPhaseTime | Double | Read only
MaxFirstPhaseTime | Double | Read only
Channels | Container | -

ME-52xx - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-52xx - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5001 board.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5001 board.

Using the ME-iDS API with the ME-5001 boards.

See also ME-5001 - Device properties

  • Digital input/output sub-devices.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • ME-5001 Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5001 board.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide.

The following API functions are supported for these sub-devices (see also ME-5001 - Digital input/output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function causes a call to meIOIrqWait which may be waiting for an interrupt to return with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed to be called with the same error code.

The sub-device is then configured for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.

ME_CAPS_DIO_DIR_BYTE means that the port direction can only be changed 8-bit-wise. In other words, the entire port must be set either for input or for output.
The remaining flags indicate that when used for input, the sub-device can generate an interrupt when a bit changes from low to high and/or from high to low takes place. See the parameters 'iIrqSource' and 'iIrqEdge' and 'iIrqArg' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then the port value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE.
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time a change in the port bit pattern causes an interrupt. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge: ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 8-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

    • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then bits 16 to 23 here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags: Not required, ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternative to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: The value returned here indicates which port bits have changed since the last time this routine was called.

    The lower 8 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

    Bits 16 to 23 show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5001 board.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-5001 - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all eight channels on the sub-device.

After calling this function, all eight channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 7.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 7.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-5001 boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 12 'ticks' corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 6 ticks corresponding aprroximately to 0.09 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5001 board.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-5001 - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function, all eight channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meIOSingleConfig

  • iChannel: Channel index, 0 to 7.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 12 corresponding aprroximately to 0.18 microseconds or to a signal frequency 0f 5.5 MHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 6 corresponding aprroximately to 0.09 microseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 7.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5001 Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5001 board.

ME-5001 Properties

ME-5001 - Device properties

Apart from the standard device properties (see General device properties) the ME-5001 devices have the following additional properties:

ME-5001 - Device properties
Name | Type | Access | Possible values
IOPinVoltageLevel | Define | Read / Write | ME_IO_PIN_VOLTAGE_LEVEL_5_VOLTS, ME_IO_PIN_VOLTAGE_LEVEL_3_3_VOLTS
Subdevice0And1Terminated | Boolean | Read / Write | -
Subdevice2And3Terminated | Boolean | Read / Write | -

ME-5001 - Digital input/output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5001 digital input sub-devices have the following additional properties:

ME-5001 - Digital input/output sub-device properties
Name | Type | Access | Possible values
Direction | Define | Read / Write | ME_SINGLE_CONFIG_DIO_INPUT, ME_SINGLE_CONFIG_DIO_OUTPUT
InterruptCondition | Container | -

ME-5001 - Digital input/output sub-device - 'InterruptCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 7

ME-5001 - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5001 frequency input sub-devices have the following additional properties:

ME-5001 - Frequency input sub-device properties
Name | Type | Access
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-5001 - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5001 frequency output sub-devices have the following additional properties:

ME-5001 - Frequency output sub-device properties
Name | Type | Access
SystemClockfrequency | Double | Read only
MinTotalTicks | Integer | Read only
MaxTotalTicks | Integer | Read only
MinFirstPhaseTicks | Integer | Read only
MaxFirstPhaseTicks | Integer | Read only
MinTotalTime | Double | Read only
MaxTotalTime | Double | Read only
MinFirstPhaseTime | Double | Read only
MaxFirstPhaseTime | Double | Read only
Channels | Container | -

ME-5001 - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -
Channel4 | Container | -
Channel5 | Container | -
Channel6 | Container | -
Channel7 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-5001 - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

  • Digital input sub-device.
  • Digital output sub-device.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • Counter sub-devices.
  • ME-5810A, ME-5820 and ME-5821 Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Digital input sub-device

Digital input sub-device

The digital input sub-device is 16-bits wide.

The following API functions are supported for this sub-device (see also ME-5810A - Digital input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger.

In addition, any call to meIOIrqWait. which may be waiting for an interrupt returns with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed is called with the same error code.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_BIT_PATTERN_IRQ and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameters 'iIrqSource' and 'iIrqEdge' in meIOIrqStart..

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_VALUE_NOT_USED or ME_TRIG_TYPE_SW.
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, the single mode of this sub-device is configured for a software trigger.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 (lower byte) or 1 (upper byte).

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the 16-bit port value between Hex 0 and Hex FFFF will be returned here.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper 8-bits of the port value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD

meIOIrqSetCallback.

This function should be called before calling meIOIrqStart. to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait..

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart.

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this should be ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 16-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then:

      • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 16-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

      • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then the upper 16-bits here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x1111 and the port value changes from 0x0011 to 0x1100 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x1111 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop.

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait.

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback. to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then the value returned here indicates which port bits have changed since the last time this routine was called.

      The lower 16 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

      The upper 16 bits show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop. or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Digital output sub-devices

Digital output sub-devices

The digital output sub-device, which can be used in single or in streaming mode, is 16-bits wide.

The following API functions are supported for these sub-devices (see also ME-5810A - Digital output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger.

. In addition, any call to meIOIrqWait which may be waiting for an interrupt returns with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed is called with the same error code.

The sub-device is returned to its default configuration:

  • High impedance

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_SINK_SOURCE, ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_NORMAL_TEMP_IRQ OR'ed together in 'piCaps'.

ME_CAPS_DIO_SINK_SOURCE indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_UNDER_TEMP_IRQ indicate that the sub-device can generate an interrupt when the temperature exceeds the normal working range and/or when the temperature returns to the normal working range.
See the the parameter 'iIrqSource' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK or ME_SINGLE_CONFIG_DIO_SOURCE.
    Note:
    The configuration used here applies not only to single output, but also to stream output operations.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_TRIG_TYPE_SW
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_OVER_TEMP or ME_IRQ_SOURCE_DIO_NORMAL_TEMP or ME_IRQ_SOURCE_DIO_CHANGE_TEMP.

    • ME_IRQ_SOURCE_DIO_OVER_TEMP - An interrupt will be generated when the temperature exceeds the normal working range.

    • ME_IRQ_SOURCE_DIO_NORMAL_TEMP - An interrupt will be generated when the temperature returns to the normal working range.

    • ME_IRQ_SOURCE_DIO_CHANGE_TEMP - An interrupt will be generated in both the above cases.

  • iIrqEdge: Not required, use ME_VALUE_NOT_USED.
  • iIrqArg: Not required, use ME_VALUE_NOT_USED.
  • iFlags: Not required, useME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: The value returned here is a bit coded record of the interrupts which have occurred since the routine was last called.

    If bit 0 is set, then an interrupt was caused by a falling temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 8 is set, then an interrupt was caused by a falling temperature on one of the upper 8 bits (8 - 15) of the port.

    If bit 16 is set, then an interrupt was caused by a rising temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 24 is set, then an interrupt was caused by a rising temperature on one of the upper 8 bits (8 - 15) of the port.

  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-5810A - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all four channels on the sub-device.

After calling this function, all four channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-5810A boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 220 'ticks' corresponding aprroximately to 3.3 microseconds or to a signal frequency 0f 300 kHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 110 ticks corresponding aprroximately to 1.65 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-5810A - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function, all four channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_FIO_SINK_SOURCE in 'piCaps'.

This indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_FIO_SINK or ME_SINGLE_CONFIG_FIO_SOURCE.

    Note:
    The constant used here applies to all channels.

  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 22000 corresponding aprroximately to 0.33 milliseconds or to a signal frequency 0f 3 kHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 11000 corresponding aprroximately to 0.165 milliseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

Counter sub-devices

Counter sub-devices

The ME-5810A boards have three 8254 counter sub-devices.

The following API functions are supported for these sub-devices (see also ME-5810A - Counter sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0.

meQuerySubdeviceCaps

This function returns ME_CAPS_CTR_CLK_EXTERNAL for 'piCaps'. This means that only an external pulse can be used to drive the counters on these boards.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be ME_REF_CTR_EXTERNAL.
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5810A, ME-5820, ME-5821 Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A, ME-5820 and ME-5821 boards.

ME-5810A, ME-5820, ME-5821 Properties

ME-5810A, ME-5820, ME-5821 - Device properties

The ME-5810A, ME-5820, ME-5821 devices have all the standard device properties (see General device properties)

ME-5810A - Digital input sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A digital input sub-devices have the following additional properties:

ME-5810A - Digital input sub-device properties
Name | Type | Access
SingleConfiguration | Container | -

ME-5810A - Digital input sub-device - 'SingleConfiguration' properties
Name | Type | Access | Possible values
TriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ExtDigitaltriggerCondition | Container | - | -

ME-5810A - Digital input sub-device - 'SingleConfiguration' - 'ExtDigitalTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5810A - Digital output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A digital output sub-devices have the following additional properties:

ME-5810A - Digital output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
IRQConfiguration | Container | - | -

ME-5810A - Digital output sub-device - 'IRQConfiguration' properties
Name | Type | Access
IRQOnExcessTemperature | Boolean | Read / Write
IRQOnNormalTemperature | Boolean | Read / Write

ME-5810A - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A frequency input sub-devices have the following additional properties:

ME-5810A - Frequency input sub-device properties
Name | Type | Access
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-5810A - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A frequency output sub-devices have the following additional properties:

ME-5810A - Frequency output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
SystemClockfrequency | Double | Read only | -
MinTotalTicks | Integer | Read only | -
MaxTotalTicks | Integer | Read only | -
MinFirstPhaseTicks | Integer | Read only | -
MaxFirstPhaseTicks | Integer | Read only | -
MinTotalTime | Double | Read only | -
MaxTotalTime | Double | Read only | -
MinFirstPhaseTime | Double | Read only | -
MaxFirstPhaseTime | Double | Read only | -
Channels | Container | - | -

ME-5810A - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-5810A - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write

ME-5810A - Counter sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A frequency output sub-devices have the following additional properties:

ME-5810A - Counter sub-device properties
Name | Type | Access | Possible values
WidthInBits | Integer | Read only | 16
ClockSource | Define | Read only | ME_CAPS_CTR_CLK_EXTERNAL
CounterMode | Define | Read / Write | ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5810A/S board.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5810A/S board.

Using the ME-iDS API with an ME-5810A/S boards.

  • Digital input sub-device.
  • Digital output sub-device.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • Counter sub-devices.
  • ME-5810A/S Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

Digital input sub-device

Digital input sub-device

The digital input sub-device, which can be used in single and streaming mode, is 16-bits wide.

The following API functions are supported for this sub-device (see also ME-5810A/S - Digital input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger and any streaming operation which may be running or waiting for a hardware trigger.

In addition, any call to meIOIrqWait. which may be waiting for an interrupt returns with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed is called with the same error code.

The sub-device is then configured for input.

The sub-device is returned to its default configuration:

  • Single mode - Sofware start.
  • Streaming mode - Software start, software termination, sampling rate 100 Hz, data from port A

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_BIT_PATTERN_IRQ and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameters 'iIrqSource' and 'iIrqEdge' in meIOIrqStart..

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_VALUE_NOT_USED or ME_TRIG_TYPE_SW.
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, the single mode of this sub-device is configured for a software trigger.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 (lower byte) or 1 (upper byte).

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the 16-bit port value between Hex 0 and Hex FFFF will be returned here.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper 8-bits of the port value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The digital input sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz

The minimum number of ticks which can be used here is 2 (TicksLow = 2, TicksHigh = 0) which corresponds to a frequency of 33 MHz or a sampling time of circa 30 nanoseconds

The maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0154 Hz or a sampling time of approx 65 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS / ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This should be a pointer to a single meIOStreamConfig structure containing the configuration for the sub-device.
    This structure should be configured as follows:

  • iChannel: Must be 0.

  • iStreamConfig: Not required - use ME_VALUE_NOT_USED (0).

  • iRef: Not required - use ME_VALUE_NOT_USED (0).

  • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: Must be 1, the number of elements in the array pConfigList.

  • pTrigger: This is a pointer to an meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are three alternative modes for governing the start of the acquisition and way in which sampling proceeds (see however iFlags below):

      • Standard software trigger:

        After calling meIOStreamStart, the acquisition starts immediately without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_SW.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised.
        The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_PATTERN_MATCH or ME_TRIG_TYPE_PATTERN_NO_MATCH

        • iAcqStartTrigEdge:

          • If iAcqStartTrigType above is ME_TRIG_TYPE_EXT_DIGITAL, then this parameter contains the bit-coded trigger conditions for starting the streaming operation.
            Bits 0 to 15 determine whether a falling edge on the bits 0 to 15 of port A will start the measurement.
            Bits 16 to 31 determine whether a rising edge on the bits 0 to 15 of port A will start the measurement.
            The trigger conditions are OR'd together. In other words the measurement will be started if any one of the trigger conditions is met (see also iAcqStartArgs below).

          • If iAcqStartTrigType above is ME_TRIG_TYPE_PATTERN_MATCH or ME_TRIG_TYPE_PATTERN_NO_MATCH then this parameter contains the pattern which will be compared to the bit values on Port A to decide when the acquisition should start.
            If iAcqStartTrigType is ME_TRIG_TYPE_PATTERN_MATCH then the acquisition will start as soon as the bit-pattern on port A matches this value.
            If iAcqStartTrigType is ME_TRIG_TYPE_PATTERN_NO_MATCH then the acquisition will start as sonn as the bit-pattern on port A differs from this value.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between two consecutive measurements.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an additional value to be acquired.

        • iAcqStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: This parameter contains the bit-coded trigger conditions for starting the streaming operation and for acquiring each subsequent value.

          Bits 0 to 15 determine whether a falling edge on the bits 0 to 15 of port A will trigger a measurement.
          Bits 16 to 31 determine whether a rising edge on the bits 0 to 15 of port A will trigger a measurement.

          The trigger conditions are OR'd together. In other words the measurement will be triggered if any one of the trigger conditions is met.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iConvStartTrigType: ME_TRIG_TYPE_EXT_DIGITAL.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are four alternative ways of terminating the acquisition (see however iFlags below):

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been acquired and then stop automatically.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_COUNT.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0

      • Run until a hardware trigger is recognised.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_PATTERN_MATCH or ME_TRIG_TYPE_PATTERN_NO_MATCH.

        • iAcqStopArgs:

          • If iAcqStopTrigType above is ME_TRIG_TYPE_EXT_DIGITAL then the first element of this array, iAcqStopArgs[0], contain the bit-coded trigger conditions for stopping the streaming operation.

            Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port A will stop the measurement.
            Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port A will stop the measurement.
            The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

          • if iAcqStopTrigType above is ME_TRIG_TYPE_PATTERN_MATCH or ME_TRIG_TYPE_PATTERN_NO_MATCH then this parameter contains the pattern which will be compared to the bit values on Port A to decide when the acquisition should stopped.
            If iAcqStopTrigType is ME_TRIG_TYPE_PATTERN_MATCH then the acquisition will be stopped as sonn as the bit-pattern on port A matches this value.
            If iAcqStopTrigType is ME_TRIG_TYPE_PATTERN_NO_MATCH then the acquisition will be stopped as sonn as the bit-pattern on port A differs from this value.

      • Run until a predetermined amount of data has been acquired or until a hardware trigger is recognised.
        This is simply a combination of the last two modes.
        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT, ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT or ME_TRIG_TYPE_PATTERN_NO_MATCH_OR_COUNT.

        • iAcqStopArgs:
          • If iAcqStopTrigType above is ME_TRIG_TYPE_EXT_DIGITAL then the first element of this array, iAcqStopArgs[0], contain the bit-coded trigger conditions for stopping the streaming operation.

            Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port A will stop the measurement.
            Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port A will stop the measurement.
            The trigger conditions are OR'd together. In other words the measurement will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

          • if iAcqStopTrigType above is ME_TRIG_TYPE_PATTERN_MATCH or ME_TRIG_TYPE_PATTERN_NO_MATCH then this parameter contains the pattern which will be compared to the bit values on Port A to decide when the acquisition should stopped.
            If iAcqStopTrigType is ME_TRIG_TYPE_PATTERN_MATCH then the acquisition will be stopped as sonn as the bit-pattern on port A matches this value.
            If iAcqStopTrigType is ME_TRIG_TYPE_PATTERN_NO_MATCH then the acquisition will be stopped as sonn as the bit-pattern on port A differs from this value.

        • iAcqStopCount: This is the number of values after which the acquisition is automatically terminated. This value must be greater than 0
  • iFifoIrqThreshold: This is the minimum size of the blocks in which the data is transferred to the user.

    From the point of view of the user, this determines the responsiveness of the software to incoming data.

    Choosing a lower value here means that incoming data is available more quickly, but increases the processor load as it results in more interrupts.

  • iFlags: Use either ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_INTERNAL_COUNTER

    Note:
    The flag ME_IO_STREAM_CONFIG_INTERNAL_COUNTER is intended for test purposes. If this flag is used the acquisition data comes not from port A but from an internal counter which counts up from 0 to 65535 (Hex 0xFFFF).
    In this case the acquisition can only be started and stopped per software, hardware triggers are not accepted.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: No flags defined here - ME_IO_STREAM_READ_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.

meIOIrqSetCallback.

This function should be called before calling meIOIrqStart. to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait..

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart.

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this should be ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 16-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then:

      • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 16-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

      • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then the upper 16-bits here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x1111 and the port value changes from 0x0011 to 0x1100 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x1111 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop.

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait.

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback. to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then the value returned here indicates which port bits have changed since the last time this routine was called.

      The lower 16 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

      The upper 16 bits show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop. or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

Digital output sub-devices

Digital output sub-devices

The digital output sub-device, which can be used in single or in streaming mode, is 16-bits wide.

The following API functions are supported for these sub-devices (see also ME-5810A/S - Digital output sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any single operation which may be waiting for a hardware trigger and any streaming operation which may be running or waiting for a hardware trigger

. In addition, any call to meIOIrqWait which may be waiting for an interrupt returns with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed is called with the same error code.

The sub-device is returned to its default configuration:

  • High impedance
  • Single mode - Sofware start.
  • Streaming mode - Software start, no wraparound, software termination, output rate 100 Hz.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_SINK_SOURCE, ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_NORMAL_TEMP_IRQ OR'ed together in 'piCaps'.

ME_CAPS_DIO_SINK_SOURCE indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_UNDER_TEMP_IRQ indicate that the sub-device can generate an interrupt when the temperature exceeds the normal working range and/or when the temperature returns to the normal working range.
See the the parameter 'iIrqSource' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK or ME_SINGLE_CONFIG_DIO_SOURCE.
    Note:
    The configuration used here applies not only to single output, but also to stream output operations.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_TRIG_TYPE_SW
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The digital output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz

The minimum number of ticks which can be used here is 2 (TicksLow = 2, TicksHigh = 0) which corresponds to a frequency of 33 MHz or a sampling time of circa 30 nanoseconds

The maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0154 Hz or a sampling time of approx 65 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This should be a pointer to a single meIOStreamConfig structure containing the configuration for the sub-device.
    This structure should be configured as follows:

    • iChannel: Must be 0.
    • iStreamConfig: Not required - use ME_VALUE_NOT_USED (0).
    • iRef: Not required - use ME_VALUE_NOT_USED (0).
    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: Must be 1, the number of elements in the array pConfigList.
  • pTrigger: This is a pointer to an meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW.

    • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

    • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

    • iConvStartTicksLow, iConvStartTicksHigh:

      Determine the amount of time which elapses between outputting two consecutive values.
      Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      There are four alternative ways of terminating the output:

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been output and then stop automatically.

        This termination mode is used in conjunction with the flag ME_IO_STREAM_CONFIG_WRAPAROUND (see iFlags below. This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType: ME_TRIG_TYPE_COUNT.
          Note:
          The flag ME_IO_STREAM_CONFIG_WRAPAROUND must also be used.

        • iAcqStopCount: This is the number of times the data buffer loaded before calling meIOStreamStart is output before the operation is automatically terminated. (see iFlags below).
          This value must be greater than 0.

      • Run until a hardware trigger is recognised.

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType:

          • ME_TRIG_TYPE_EXT_DIGITAL.
            The output is terminated when a bit change is detected on one of a selected number of digital lines.

          • ME_TRIG_TYPE_PATTERN_MATCH.
            The ouput is terminated when the bit values on Port B exactly match a pre-determined pattern.

        • iAcqStopArgs:

          • If iAcqStopTrigType above is ME_TRIG_TYPE_EXT_DIGITAL then the first element of this array, iAcqStopArgs[0] contains bit-coded trigger conditions for stopping the streaming operation.

            Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port B will stop the output.
            Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port B will stop the output.

            The trigger conditions are OR'd together. In other words the output will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

          • If iAcqStopTrigType above is ME_TRIG_TYPE_PATTERN_MATCH, then the lower 16 bits of the first element of this array, iAcqStopArgs[0], contain the bit pattern which will cause the operation to terminate if it is encountered in the data stream.

      • Run until a predetermined amount of data has been output or until a hardware trigger is recognised.
        This is simply a combination of the last two modes.
        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iAcqStopTrigType:

          • ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT.
            The output is terminated when a bit change is detected on one of a selected number of digital lines or when the pre-determined number of values has been output.

          • ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT.
            The ouput is terminated when the bit values on Port B exactly match the given pattern or when the pre-determined number of values has been output.

        • iAcqStopArgs:

          • If iAcqStopTrigType above is ME_TRIG_TYPE_EXT_DIGITAL_OR_COUNT then the first element of this array, iAcqStopArgs[0] contains bit-coded trigger conditions for stopping the streaming operation.

            Bits 0 to 15 of iAcqStopArgs[0] determine whether a falling edge on the bits 0 to 15 of port B will stop the output.
            Bits 16 to 31 of iAcqStopArgs[0] determine whether a rising edge on the bits 0 to 15 of port B will stop the output.

            The trigger conditions are OR'd together. In other words the output will be stopped if any one of the trigger conditions is met. At least one of the above bits must be set.

          • If iAcqStopTrigType above is ME_TRIG_TYPE_PATTERN_MATCH_OR_COUNT, then the lower 16 bits of the first element of this array, iAcqStopArgs[0], contain the bit pattern which will cause the operation to terminate if it is encountered in the data stream.

        • iAcqStopCount: This is the number of times the data buffer loaded before calling meIOStreamStart is output before the operation is automatically terminated. (see iFlags below).
          This value must be greater than 0.
  • iFifoIrqThreshold: This is not used here and should be set to zero.

  • iFlags: Should be ME_IO_STREAM_CONFIG_NO_FLAGS or ME_IO_STREAM_CONFIG_WRAPAROUND.

    If the flag ME_IO_STREAM_CONFIG_WRAPAROUND is used, then a single data buffer is output repeatedly.
    This data buffer is loaded using the function meIOStreamWrite with 'iWriteMode' = ME_WRITE_MODE_PRELOAD (see below).

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.

    The choice made here is only of importance if the sub-device has been configured to start on receiving an external trigger ('iAcqStartTrigType' set to ME_TRIG_TYPE_EXT_DIGITAL in the trigger structure passed to meIOStreamConfig - see (see meIOStreamConfig)).
    In this case, the routine returns immediately if 'ME_START_MODE_NONBLOCKING' is used, but only returns after the trigger has been recognised and the output operation is started if 'ME_START_MODE_BLOCKING' is used.
  • iTimeOut:

    • If 'iStartMode' above is 'ME_START_MODE_NONBLOCKING': Not required, should be 0.

    • If 'iStartMode' above is 'ME_START_MODE_BLOCKING': Enter a value for the time-out in milliseconds here.
  • iFlags: ME_IO_STREAM_START_TYPE_NO_FLAGS.

meIOStreamWrite

  • iWriteMode: ME_WRITE_MODE_PRELOAD, ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING.

    'ME_WRITE_MODE_PRELOAD' must be used before calling meIOStreamStart to provide the sub-device with a first buffer full of data values for a later output operation.
    If ME_IO_STREAM_CONFIG_WRAPAROUND is used in 'iFlags' on calling meIOStreamConfig above then this data buffer is output repeatedly until the operation is terminated and meIOStreamWrite cannot be called again once the operation has started.

    ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING is used after calling meIOStreamStart to provide further data values to an output operation that is already running.
  • piValues: Pointer to an array of integers containing the digital data for the output operation.
  • piCount: Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values actually transferred to the internal software buffer and which will later join the output stream.
  • iFlags: No flags defined here - Use ME_IO_STREAM_WRITE_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus: Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the funtion.

  • piCount: Pointer to an integer which, on returning from the function, contains the amount of space left in the internal software buffer for the sub-device. This is the number of data values which could be written without delay using meIOStreamWrite.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE or ME_STOP_MODE_LAST_VALUE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_OVER_TEMP or ME_IRQ_SOURCE_DIO_NORMAL_TEMP or ME_IRQ_SOURCE_DIO_CHANGE_TEMP.

    • ME_IRQ_SOURCE_DIO_OVER_TEMP - An interrupt will be generated when the temperature exceeds the normal working range.

    • ME_IRQ_SOURCE_DIO_NORMAL_TEMP - An interrupt will be generated when the temperature returns to the normal working range.

    • ME_IRQ_SOURCE_DIO_CHANGE_TEMP - An interrupt will be generated in both the above cases.

  • iIrqEdge: Not required, use ME_VALUE_NOT_USED.
  • iIrqArg: Not required, use ME_VALUE_NOT_USED.
  • iFlags: Not required, useME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: The value returned here is a bit coded record of the interrupts which have occurred since the routine was last called.

    If bit 0 is set, then an interrupt was caused by a falling temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 8 is set, then an interrupt was caused by a falling temperature on one of the upper 8 bits (8 - 15) of the port.

    If bit 16 is set, then an interrupt was caused by a rising temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 24 is set, then an interrupt was caused by a rising temperature on one of the upper 8 bits (8 - 15) of the port.

  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-5810A/S - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all four channels on the sub-device.

After calling this function, all four channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-5810A/S boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 220 'ticks' corresponding aprroximately to 3.3 microseconds or to a signal frequency 0f 300 kHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 110 ticks corresponding aprroximately to 1.65 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-5810A/S - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

After calling this function, all four channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_FIO_SINK_SOURCE in 'piCaps'.

This indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

meIOSingleConfig

  • iChannel: Channel index, 0 to 3.
  • iSingleConfig: ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_FIO_SINK or ME_SINGLE_CONFIG_FIO_SOURCE.

    Note:
    The constant used here applies to all channels.

  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 22000 corresponding aprroximately to 0.33 milliseconds or to a signal frequency 0f 3 kHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 11000 corresponding aprroximately to 0.165 milliseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 3.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

Counter sub-devices

Counter sub-devices

The ME-5810A/SA boards have three 8254 counter sub-devices.

The following API functions are supported for these sub-devices (see also ME-5810A/S - Counter sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0.

meQuerySubdeviceCaps

This function returns ME_CAPS_CTR_CLK_EXTERNAL for 'piCaps'. This means that only an external pulse can be used to drive the counters on these boards.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be ME_REF_CTR_EXTERNAL.
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5810A/S Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5810A/S board.

ME-5810A/S Properties

ME-5810A/S - Device properties

The ME-5810A/S devices have all the standard device properties (see General device properties)

ME-5810A/S - Digital input sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A/S digital input sub-devices have the following additional properties:

ME-5810A/S - Digital input sub-device properties
Name | Type | Access
SingleConfiguration | Container | -
StreamingConfiguration | Container | -

ME-5810A/S - Digital input sub-device - 'SingleConfiguration' properties
Name | Type | Access | Possible values
TriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
ExtDigitaltriggerCondition | Container | - | -

ME-5810A/S - Digital input sub-device - 'SingleConfiguration' - 'ExtDigitalTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5810A/S - Digital input sub-device - 'StreamingConfiguration' properties
Name | Type | Access | Possible values
InternalBufferSize | Integer | Read only | -
SystemClockfrequency | Double | Read only | -
SampleFrequency | Double | Read / Write | -
SampleTime | Double | Read / Write | -
UseInternalTestCounter | Boolean | Read / Write | -
TransferSize | Integer | Read / Write | -
StartTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_PATTERN_MATCH, ME_TRIG_TYPE_PATTERN_NO_MATCH
ConvTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL
StartAndConvTriggerCondition | Container | - | -
StopTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_PATTERN_MATCH, ME_TRIG_TYPE_PATTERN_NO_MATCH
StopTriggerCondition | Container | - | -
StartStopPattern | Integer | Read / Write | -
StopOnCount | Boolean | Read / Write | -
StopCount | Integer | Read / Write | -

ME-5810A/S - Digital input sub-device - 'StreamingConfiguration' - 'StartAndConvTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5810A/S - Digital input sub-device - 'StreamingConfiguration' - 'StopTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5810A/S - Digital output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A/S digital output sub-devices have the following additional properties:

ME-5810A/S - Digital output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
StreamingConfiguration | Container | - | -
IRQConfiguration | Container | - | -

ME-5810A/S - Digital output sub-device - 'StreamingConfiguration' properties
Name | Type | Access | Possible values
InternalBufferSize | Integer | Read only | -
SystemClockfrequency | Double | Read only | -
SampleFrequency | Double | Read / Write | -
SampleTime | Double | Read / Write | -
Wraparound | Boolean | Read / Write | -
WraparoundLoops | Integer | Read / Write | -
StopTriggerType | Define | Read / Write | ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL, ME_TRIG_TYPE_PATTERN_MATCH
StopTriggerCondition | Container | - | -
StopPattern | Integer | Read / Write | -

ME-5810A/S - Digital output sub-device - 'StreamingConfiguration' - 'StopTriggerCondition' properties
Name | Type | Access
RisingEdgeBit0 | Boolean | Read / Write
FallingEdgeBit0 | Boolean | Read / Write
The same for bits 1 to 15

ME-5810A/S - Digital output sub-device - 'IRQConfiguration' properties
Name | Type | Access
IRQOnExcessTemperature | Boolean | Read / Write
IRQOnNormalTemperature | Boolean | Read / Write

ME-5810A/S - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A/S frequency input sub-devices have the following additional properties:

ME-5810A/S - Frequency input sub-device properties
Name | Type | Access
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-5810A/S - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A/S frequency output sub-devices have the following additional properties:

ME-5810A/S - Frequency output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
SystemClockfrequency | Double | Read only | -
MinTotalTicks | Integer | Read only | -
MaxTotalTicks | Integer | Read only | -
MinFirstPhaseTicks | Integer | Read only | -
MaxFirstPhaseTicks | Integer | Read only | -
MinTotalTime | Double | Read only | -
MaxTotalTime | Double | Read only | -
MinFirstPhaseTime | Double | Read only | -
MaxFirstPhaseTime | Double | Read only | -
Channels | Container | - | -

ME-5810A/S - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-5810A/S - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write

ME-5810A/S - Counter sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5810A/S frequency output sub-devices have the following additional properties:

ME-5810A/S - Counter sub-device properties
Name | Type | Access | Possible values
WidthInBits | Integer | Read only | 16
ClockSource | Define | Read only | ME_CAPS_CTR_CLK_EXTERNAL
CounterMode | Define | Read / Write | ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with an ME-5002 or ME-5004 board.

  • ME-5xxx Description

Using the ME-iDS API with an ME-5002 or ME-5004 board.

Using the ME-iDS API with the ME-5002 and ME-5004 boards.

  • Digital input sub-device.
  • Digital output sub-device.
  • Frequency input (frequency measurement) sub-device.
  • Frequency output (pulse generation) sub-device.
  • Properties.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5002 or ME-5004 board.

Digital input sub-device

Digital input sub-device

The digital input sub-device, which can be used in single and streaming mode, is 16-bits wide.

The following API functions are supported for this sub-device (see also ME-5002/ME-5004 - Digital input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function causes a call to meIOIrqWait. which may be waiting for an interrupt to return with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed to be called with the same error code.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_BIT_PATTERN_IRQ and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameters 'iIrqSource' and 'iIrqEdge' in meIOIrqStart..

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_TRIG_TYPE_SW.
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 (lower byte) or 1 (upper byte).

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the 16-bit port value between Hex 0 and Hex FFFF will be returned here.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper 8-bits of the port value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: If, on configuring the sub-device (see meIOSingleConfig), 'iTrigType' = ME_TRIG_TYPE_SW has been used here, then this should be 0.

    If 'iTrigType' = ME_TRIG_TYPE_EXT_DIGITAL was used then a value for the time-out in milliseconds should be entered here.
    A value of 0 in this case means that the routine will not return until the trigger condition has been met or the operation has been cancelled.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD

meIOIrqSetCallback.

This function should be called before calling meIOIrqStart. to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait..

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart.

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this should be ME_IRQ_EDGE_RISING, ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 16-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then:

      • If 'iIrqEdge' is ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY then the lower 16-bits here determine which port bits should cause an interrupt to be generated when they change from '1' to '0'.

      • If 'iIrqEdge' is ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_ANY then the upper 16-bits here determine which port bits should cause an interrupt to be generated when they change from '0' to '1'.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x1111 and the port value changes from 0x0011 to 0x1100 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x1111 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop.

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait.

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback. to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart. 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then the value returned here indicates which port bits have changed since the last time this routine was called.

      The lower 16 bits show which port bits have changed from '1' to '0' (falling edge) at least once since the last time the routine was called.

      The upper 16 bits show which port bits have changed from '0' to '1' (rising edge) at least once since the last time the routine was called.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop. or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-devices

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5002 or ME-5004 board.

Digital output sub-devices

Digital output sub-devices

The digital output sub-device, which can be used in single or in streaming mode, is 16-bits wide.

The following API functions are supported for these sub-devices (see also ME-5002/ME-5004 - Digital input sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function causes a call to meIOIrqWait which may be waiting for an interrupt to return with an error 'ME_ERRNO_CANCELLED' or a callback routine which may have been installed to be called with the same error code.

The output mode is reset to 'high impedance'.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_SINK_SOURCE, ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_NORMAL_TEMP_IRQ OR'ed together in 'piCaps'.

ME_CAPS_DIO_SINK_SOURCE indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

ME_CAPS_DIO_OVER_TEMP_IRQ and ME_CAPS_DIO_UNDER_TEMP_IRQ indicate that the sub-device can generate an interrupt when the temperature exceeds the normal working range and/or when the temperature returns to the normal working range.
See the the parameter 'iIrqSource' in meIOIrqStart below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK or ME_SINGLE_CONFIG_DIO_SOURCE.
    Note:
    The configuration used here applies not only to single output, but also to stream output operations.
  • iRef: Not required - use ME_VALUE_NOT_USED (0).
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_TRIG_TYPE_SW
  • iTrigEdge: This parameter is not required here, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_OVER_TEMP or ME_IRQ_SOURCE_DIO_NORMAL_TEMP or ME_IRQ_SOURCE_DIO_NORMAL_TEMP.

    • ME_IRQ_SOURCE_DIO_OVER_TEMP - An interrupt will be generated when the temperature exceeds the normal working range.

    • ME_IRQ_SOURCE_DIO_NORMAL_TEMP - An interrupt will be generated when the temperature returns to the normal working range.

    • ME_IRQ_SOURCE_DIO_NORMAL_TEMP - An interrupt will be generated in both the above cases.

  • iIrqEdge: Not required, use ME_VALUE_NOT_USED.
  • iIrqArg: Not required, use ME_VALUE_NOT_USED.
  • iFlags: Not required, useME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: The value returned here is a bit coded record of the interrupts which have occurred since the routine was last called.

    If bit 0 is set, then an interrupt was caused by a falling temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 8 is set, then an interrupt was caused by a falling temperature on one of the upper 8 bits (8 - 15) of the port.

    If bit 16 is set, then an interrupt was caused by a rising temperature on one of the lower 8 bits (0 - 7) of the port.

    If bit 24 is set, then an interrupt was caused by a rising temperature on one of the upper 8 bits (8 - 15) of the port.

  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency input (frequency measurement) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5002 or ME-5004 board.

Frequency input (frequency measurement) sub-device

Frequency input sub-device

The following API functions are supported for this sub-device (see also ME-5002/ME-5004 - Frequency input (frequency measurement) sub-device properties):

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all eight channels on the sub-device.

After calling this function, all eight channels on the sub-device are unconfigured. Before using a channel to measure an incoming frequency, the routine meIOSingleConfig below must be called for this channel.

meIOSingleConfig

  • iChannel: Channel index, 0 to 7.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_FIO_INPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 7.
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the length in 'ticks' of an entire period of the incoming signal is returned here.

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length in 'ticks' of the first phase of the incoming signal (when the signal is high) is returned here.

      In both cases, the routine meIOSingleTicksToTime below can be used to convert the value in ticks returned here to a time in seconds.
  • iTimeOut:

    • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FI_LAST_VALUE then this parameter is not required and should be zero.

    • Otherwise, a time-out in milliseconds should be entered her.
      If the routine cannot measure a complete period of the signal in this time then it will return with an error.
  • iFlags: Must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE and ME_IO_SINGLE_TYPE_FI_LAST_VALUE

    Note:
    Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

meIOSingleTicksToTime

The frequency input sub-device on the ME-5100 boards uses an internal timer with a basic frequency of 66 MHz.

The minimum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 220 'ticks' corresponding aprroximately to 3.3 microseconds or to a signal frequency 0f 300 kHz.

The minimum first phase signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 110 ticks corresponding aprroximately to 1.65 microseconds.

The maximum total signal time (see meIOSingle, parameter 'iFlags' below) which can be measured is 1073741823 (hex 0x3FFFFFFFF) ticks corresponding aprroximately to 16,27 seconds or to a signal frequency 0f aprroximately 0.06 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle above.
  • iTicksLow: The number of ticks returned in 'iValue' on calling meIOSingle above should be entered here.
  • iTicksHigh: Not required. Should be 0.
  • pdTime: On returning from the function, this variable contains the number of seconds corresponding to the number of ticks in 'iTicksLow' above.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TICKS_TO_TIME_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Frequency output (pulse generation) sub-device

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5002 or ME-5004 board.

Frequency output (pulse generation) sub-device

Frequency output sub-device

The following API functions are supported for this sub-device (see also ME-5002/ME-5004 - Frequency output (pulse generation) sub-device properties):

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

Note:
This function resets all eight channels on the sub-device.

After calling this function, all eight channels on the sub-device are unconfigured. Before using the channels to generate a pulse, the routine meIOSingleConfig below must be called.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_FIO_SINK_SOURCE in 'piCaps'.

This indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

meIOSingleConfig

  • iChannel: Channel index, 0 to 7.
  • iSingleConfig: ME_SINGLE_CONFIG_FIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_FIO_SINK or ME_SINGLE_CONFIG_FIO_SOURCE.

    Note:
    The constant used here applies to all channels.

  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Should be ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_NO_FLAGS.

meIOSingleTimeToTicks

This routine is used to convert a time in seconds for the total length (period) of the signal or for the first phase of the signal into a number of ticks which can be passed to the routine meIOSingle below.

The frequency output sub-device on the ME-5xxx boards has an internal timer with a basic frequency of 66 MHz.

The minimum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 22000 corresponding aprroximately to 0.33 milliseconds or to a signal frequency 0f 3 kHz.

The minimum number of ticks which can be used for the first phase signal time (see meIOSingle, parameter 'iFlags' below) is 11000 corresponding aprroximately to 0.165 milliseconds.

The maximum number of ticks which can be used for the total signal time (see meIOSingle, parameter 'iFlags' below) is 1073741823 (hex 0x3FFFFFFFF) corresponding aprroximately to 16,27 seconds or to a signal frequency 0f approximately 0.6 Hz.

  • iTimer: Should be either ME_TIMER_FIO_TOTAL or ME_TIMER_FIO_FIRST_PHASE corresponding to the flag ME_IO_SINGLE_TYPE_FIO_TICKS_... used in meIOSingle below.
  • pdTime: The required duration in seconds of the period or first phase (see 'iTimer' above) of the signal should be entered here.

    On returning from the function the time duration actually achieved (which may differ slightly from the required value) is returned here.
  • piTicksLow: The number of ticks corresponding to the time in 'pdTime' is returned here. This value should be passed to meIOSingle below on using this latter function to generate a pulse.
  • piTicksHigh: The value 0 is always returned here and can be ignored.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TIME_TO_TICKS_NO_FLAGS.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Channel index, 0 to 7.
  • iDir: Must be ME_DIR_OUTPUT or ME_DIR_INPUT.
    ME_DIR_OUTPUT is used to actually generate a pulse.
    ME_DIR_INPUT serves only to read back the tick values which have previously been used in a call with ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the period of the signal or the length of its first phase in 'ticks' should be entered here.

      • If 'iFlags' (see below) includes ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' should be entered.

      • If 'iFlags' includes ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' should be entered.

    • If 'iDir' (see above) is ME_DIR_INPUT then the period of the signal (previously emitted with 'iDir' = ME_DIR_OUTPUT) or the length of its first phase in 'ticks' is returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL then the period of the signal in 'ticks' is returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE then the length of the first phase of the signal in 'ticks' is returned here.

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags:

    • If 'iDir' (see above) is ME_DIR_OUTPUT then this must be a combination of ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL, ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE, ME_IO_SINGLE_TYPE_FO_START_LOW, ME_IO_SINGLE_TYPE_FO_START_SOFT, ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY and ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS.

      Note:
      Exactly one of the flags ME_IO_SINGLE_TYPE_FIO_TICKS_TOTAL or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE must be used.

      If the flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY is used, then neither the flag ME_IO_SINGLE_TYPE_FO_START_LOW nor the flag ME_IO_SINGLE_TYPE_FO_START_SOFT can be used.

      • Flag ME_IO_SINGLE_TYPE_FO_START_LOW - The first phase of the emitted signal wil be low instead of high.
        Default - The first phase of the emitted signal will be high.

      • Flag ME_IO_SINGLE_TYPE_FO_START_SOFT - The new signal will not be emitted until the current signal (if any) has arrived at the end of a period.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_FO_UPDATE_ONLY - The parameters of the new (future) signal (period or length of the first phase) will be changed, but the new signal will not be emitted yet.
        Default - The new signal will be emitted immediately.

      • Flag ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS - All those sub-devices which have been configured with the 'iTrigChan' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig above will be started simultaneously together with this sub-device.
        Default - This sub-device will be started alone.

    • If 'iDir' (see above) is ME_DIR_INPUT then this must be ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE or ME_IO_SINGLE_TYPE_FIO_TICKS_FIRST_PHASE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-5002/ME-5004 Properties

  • ME-5xxx Description
  • Using the ME-iDS API with an ME-5002 or ME-5004 board.

ME-5002/ME-5004 Properties

ME-5002/ME-5004 - Device properties

The ME-5002 and ME-5004 devices have all the standard device properties (see General device properties)

ME-5002/ME-5004 - Digital input sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5002 and ME-5004 digital input sub-device has the following additional properties:

ME-5002/ME-5004 - Digital input sub-device properties
Name | Type | Access
IRQConfiguration | Container | -

ME-5002/ME-5004 - Digital input sub-device - 'IRQConfiguration' properties
Name | Type | Access | Possible values
IRQSource | Define | Read / Write | ME_IRQ_SOURCE_DIO_PATTERN, ME_IRQ_SOURCE_DIO_MASK
BitMask | Container | - | -
BitPattern | Integer | Read / Write | -
BitPatternFiltering | Boolean | Read / Write | -

ME-5002/ME-5004 - Digital output sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5002 and ME-5004 digital output sub-device has the following additional properties:

ME-5002/ME-5004 - Digital output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
IRQConfiguration | Container | - | -

ME-5002/ME-5004 - Digital output sub-device - 'IRQConfiguration' properties
Name | Type | Access
IRQOnExcessTemperature | Boolean | Read / Write
IRQOnNormalTemperature | Boolean | Read / Write

ME-5002/ME-5004 - Frequency input (frequency measurement) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5002 and ME-5004 frequency input sub-devices have the following additional properties:

ME-5002/ME-5004 - Frequency input sub-device properties
Name | Type | Access
SystemClockfrequency | Double | Read only
MinMeasurableTotalTicks | Integer | Read only
MaxMeasurableTotalTicks | Integer | Read only
MinMeasurableFirstPhaseTicks | Integer | Read only
MaxMeasurableFirstPhaseTicks | Integer | Read only
MinMeasurableTotalTime | Double | Read only
MaxMeasurableTotalTime | Double | Read only
MinMeasurableFirstPhaseTime | Double | Read only
MaxMeasurableFirstPhaseTime | Double | Read only

ME-5002/ME-5004 - Frequency output (pulse generation) sub-device properties

Apart from the standard sub-device properties (see General sub-device properties) the ME-5002 and ME-5004 frequency output sub-devices have the following additional properties:

ME-5002/ME-5004 - Frequency output sub-device properties
Name | Type | Access | Possible values
OutputMode | Define | Read / Write | ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK, ME_SINGLE_CONFIG_DIO_SOURCE
SystemClockfrequency | Double | Read only | -
MinTotalTicks | Integer | Read only | -
MaxTotalTicks | Integer | Read only | -
MinFirstPhaseTicks | Integer | Read only | -
MaxFirstPhaseTicks | Integer | Read only | -
MinTotalTime | Double | Read only | -
MaxTotalTime | Double | Read only | -
MinFirstPhaseTime | Double | Read only | -
MaxFirstPhaseTime | Double | Read only | -
Channels | Container | - | -

ME-5002/ME-5004 - Frequency output sub-device - 'Channels' properties
Name | Type | Access
Channel0 | Container | -
Channel1 | Container | -
Channel2 | Container | -
Channel3 | Container | -
Channel4 | Container | -
Channel5 | Container | -
Channel6 | Container | -
Channel7 | Container | -

Each of the containers 'Channel#' contains the properties for the channel with index #.

ME-5002/ME-5004 - Frequency output sub-device - 'Channels' - Channel# properties
Name | Type | Access
Inverted | Boolean | Read / Write
SynchronousStart | Boolean | Read / Write
SoftStart | Boolean | Read / Write


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-Axon (ME-7) Description

ME-Axon (ME-7) Description

ME-Axon (ME-7) Description - Contents:

  • Device types.
    • ME-0712
    • ME-0714
    • ME-0752
    • ME-0754
    • ME-0762
    • ME-0764
    • ME-0772
    • ME-0774
    • ME-0782
    • ME-0784
  • Special features.
    • Digital input/output sub-device
    • Analog input sub-device
    • Analog output sub-device
  • Using the ME-iDS API with an ME-Axon (ME-7) board.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Analog input sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Analog output sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamWrite.
      • meIOStreamStatus.
      • meIOStreamStop.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-Axon (ME-7) Description

Device Types

ME-Axon (ME-7) Device Types

The ME-Axon (ME-7) board exists in the following varieties:

ME-0712

6 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first two channels are current channels.
  • 3: 8254 Counter sub-device
  • 4: 8254 Counter sub-device
  • 5: 8254 Counter sub-device

ME-0714

6 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first four channels are current channels.
  • 3: 8254 Counter sub-device
  • 4: 8254 Counter sub-device
  • 5: 8254 Counter sub-device

ME-0752

3 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first two channels are current channels.

ME-0754

3 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first four channels are current channels.

ME-0762

8 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first two channels are current channels.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device

ME-0764

8 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 16 channels, streaming, digital trigger. The first four channels are current channels.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: 8254 Counter sub-device
  • 6: 8254 Counter sub-device
  • 7: 8254 Counter sub-device

ME-0772

10 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger. The first two channels are current channels.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device

ME-0774

10 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger. The first four channels are current channels.
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device

ME-0782

10 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger. The first two channels are current channels.
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device

ME-0784

10 sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog input sub-device - 32 channels, streaming, digital and analog trigger. The first four channels are current channels.
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, streaming
  • 7: 8254 Counter sub-device
  • 8: 8254 Counter sub-device
  • 9: 8254 Counter sub-device


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features

  • ME-Axon (ME-7) Description

Special features

ME-Axon (ME-7) Special features

The sub-devices on the ME-Axon (ME-7) boards (or on some of its variants) posess the following special features:

Digital input/output sub-device

  • ME-078x - These sub-devices can be used in conjunction with the fourth AO-streaming sub-device to output a bit pattern stream.
    Set 'iSingleConfig' = ME_SINGLE_CONFIG_DIO_BIT_PATTERN and iRef = 'ME_REF_DIO_FIFO_LOW' or iRef = 'ME_REF_DIO_FIFO_HIGH' in meIOSingleConfig.
    See Analog output sub-device

Analog input sub-device

Note:
ME-07x2 boards - On these boards with two current channels, the third and fourth channels (channel index 2 and 3) have no external connection electrically.
  • All models - On the ME-07x2 boards the first two input channels and on the ME-07x4 boards the first four channels are used to measure current, and not voltage.
    Each of the current channels supports a number of different ranges from 250 microampere to 50 amperes.

    Note:
    The 500 ampere range is no longer supported.

    If an overload occurs, then the channel automatically switches to the 50 ampere range. In this case, an interrupt can optionally be generated which can be handled with a user defined callback routine meIOIrqSetCallback or by waiting for the event with meIOIrqWait.
  • ME-077x, ME-078x - The analog input devices on these boards support an analog trigger.
    Set 'iTriggerType' = ME_TRIG_TYPE_EXT_ANALOG in meIOSingleConfig or set 'iAcqStartTrigType', 'iScanStartTrigType' or 'iConvStartTrigType' = ME_TRIG_TYPE_EXT_ANALOG in the trigger structure passed to meIOStreamConfig.
  • All models - Four different types of trigger are supported in streaming mode. The type of trigger used is determined by the entries made in the 'pTrigger' structure passed to meIOStreamConfig.
    Where an analog trigger is mentioned, this only applies to the ME-077x and ME-078x boards (see above):

    • Standard software trigger:

      After calling meIOStreamStart and a delay exactly determined by the value of the variables 'iAcqStartTicksLow' and 'iAcqStartTicksHigh' in the trigger structure passed to meIOStreamConfig, the acquisition starts without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_SW, 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' = ME_TRIG_TYPE_TIMER

    • Standard external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-076x and ME-078x boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', iScanStartTrigType' = ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' = ME_TRIG_TYPE_TIMER

    • Channel list per external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an entire channel list to be acquired at a conversion rate determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-076x and ME-078x boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', 'iScanStartTrigType' must be set to the same value as 'iAcqStartTrigType' and 'iConvStartTrigType' should be set to ME_TRIG_TYPE_TIMER

    • Single value per external trigger:

      After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes a single channel to be acquired.

      Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL (all boards) or ME_TRIG_TYPE_EXT_ANALOG (ME-076x and ME-078x boards), 'iAcqStartTrigEdge' = ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY', 'iScanStartTrigType' must be set to ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' must be set to the same value as 'iAcqStartTrigType'

Analog output sub-device

  • ME-076x, ME-077x, ME-078x - Data output (single or, where available, streaming) can be started simultaneously on several separate analog output sub-devices.

    • In single mode:
      Set the parameter 'iTriggerChannel' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pSingleList' passed to meIOSingle.

    • In streaming mode:
      Set the member 'iAcqStartTrigChan' of the parameter 'pTrigger' = ME_TRIG_CHAN_SYNCHRONOUS in meIOStreamConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pStartList' passed to meIOStreamStart.
  • ME-078x - The fourth such sub-device (sub-device 8) can be used in conjunction with one or more digital input or digital input/output sub-devices to output a bit pattern.
    Use the flag (parameter 'iFlags') ME_IO_STREAM_CONFIG_BIT_PATTERN in meIOStreamConfig.
    See Digital input/output sub-device


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-Axon (ME-7) boards.

  • ME-Axon (ME-7) Description

Using the ME-iDS API with the ME-Axon (ME-7) boards.

Using the ME-iDS API with the ME-Axon (ME-7) boards.

  • Digital input/output sub-devices.
  • Analog input sub-device.
  • Analog output sub-devices.
  • Counter sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-Axon (ME-7) Description
  • Using the ME-iDS API with the ME-Axon (ME-7) boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide. As well as for normal, standard digital input/output, the port may be used on the ME-078x boards in conjunction with the fourth AO-Streaming sub-device to output a bit-pattern stream.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT, ME_SINGLE_CONFIG_DIO_OUTPUT or ME_SINGLE_CONFIG_DIO_BIT_PATTERN.
  • iRef:

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT then this is not required, use ME_VALUE_NOT_USED.

    • If 'iSingleConfig' is ME_SINGLE_CONFIG_DIO_BIT_PATTERN then this must be ME_REF_DIO_FIFO_LOW or ME_REF_DIO_FIFO_HIGH.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for bit pattern operations (see meIOSingleConfig), then calling meIOSingle returns an error.

If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog input sub-device

  • ME-Axon (ME-7) Description
  • Using the ME-iDS API with the ME-Axon (ME-7) boards.

Analog input sub-device

Analog input sub-device

The analog input sub-device, which can be used in single and streaming mode, has 16 or 32 single-ended differential channels ('iRef' = ME_REF_AI_DIFFERENTIAL).
ME-07x2 boards: the first two are for measuring current and 12 or 28 for measuring voltage.
ME-07x4 boards: the first four are for measuring current and the remaining 12 or 28 for measuring voltage.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running and configures each voltage channel to range bipolar 10 V (index 0), trigger type software and each current channel to range 50 ampere (index 2), trigger type software.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

The voltage channels on the ME-0712 and ME-0714 boards support one range:

  • 0: Bipolar 10.0 Volt

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The voltage channels on all other boards support four ranges:

  • 0: Bipolar 10.0 Volt

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 10: Unipolar 10.0 Volt

    Physical range: 0 V - +9.999847 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 11: Bipolar 2.5 Volt

    Physical range: -2.5 V - +2.499924 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 12: Unipolar 2.5 Volt

    Physical range: 0 V - +2.499962 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The current channels support eight ranges, but report the following nine ranges:

  • 1: Bipolar 500 Ampere

    Physical range: -500.0 A - +500.0 A
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

    Note:
    This range is reported by the routines meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo, but is no longer supported by the API.
    An attempt to use this range in the routines meIOSingleConfig or meIOStreamConfig will cause an error ME_ERRNO_INVALID_SINGLE_CONFIG (4) "Invalid single configuration specified." respectively ME_ERRNO_INVALID_STREAM_CONFIG (37) "Invalid stream configuration specified." to be returned.

  • 2: Bipolar 50 Ampere

    Physical range: -50.0 A - +50.0 A
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 3: Bipolar 25 Ampere

    Physical range: -25.0 A - +25.0 A
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 4: Bipolar 2500 Milliampere

    Physical range: -2500.0 mA - +2500.0 mA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 5: Bipolar 250 Milliampere 5 Milliohm resistance

    Physical range: -250.0 mA - +250.0 mA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 6: Bipolar 250 Milliampere 10 Ohm resistance

    Physical range: -250.0 mA - +250.0 mA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 7: Bipolar 25 Milliampere

    Physical range: -25.0 mA - +25.0 mA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 8: Bipolar 2500 Microampere

    Physical range: -2500.0 uA - +2500.0 uA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 9: Bipolar 250 Microampere

    Physical range: -250.0 uA - +250.0 uA
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The meQueryRange... functions behave accordingly.

meQuerySubdeviceCaps

This function returns ME_CAPS_AI_FIFO | ME_CAPS_AI_FIFO_THRESHOLD for 'piCaps'.

  • The value ME_CAPS_AI_FIFO indicates that the sub-device has a FIFO whose size can be queried (see meQuerySubdeviceCapsArgs).

  • The value ME_CAPS_AI_FIFO_THRESHOLD indicates that, for streaming operations, the user can influence the number of data values required in the FIFO to trigger an interrupt.
    This in turn influences the speed with which the software reacts to the prescence of new data.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_AI_FIFO_SIZE.
  • piArgs: A pointer to a single integer in which the FIFO size is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the FIFO size in data values. On older boards this is 2048, newer boards may be provided with a larger FIFO.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time one of the current channels is overloaded. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback! each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: Not required, use ME_VALUE_NOT_USED.
  • iIrqEdge: Not required, use ME_VALUE_NOT_USED.
  • iIrqArg: Not required, use ME_VALUE_NOT_USED.
  • iFlags: Not required, use ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: On returning from the function, this contains a bit mask showing which of the current channels has generated an interrupt. Bits 0 and 1 correspond to channel 0, bits 2 and 3 correspond to channel 1, bits 4 and 5 correspond to channel 2 and bits 6 and 7 correspond to channel 4. If either or both of the bits corresponding to a particular channel is non-zero, then this channel has generated an interrupt because the current range which had been set had been exceeded.

Note:
When the range is exceeded the channel switches automatically to the 50 Ampere range. This will already have happened before you are notified of the interrupt.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.

meIOSingleConfig

  • iChannel: The channel index: 0 to one less than the number of channels see ME-Axon (ME-7) Device Types .
  • iSingleConfig: The range index (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

    • For a voltage channel: Must be 0, 10, 11 or 12.

    • For a current channel: Between 2 and 9.
      Range index 1, the 500 ampere range, is no longer supported here.
  • iRef: Must be ME_REF_AI_GROUND.
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType:

    • ME-071x, ME-075x and ME-076x boards: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.

    • Other ME-Axon (ME-7) boards: ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all voltage channels are configured to range: bipolar 10 V (index 0), trigger type: software and all current channels are configured to range bipolar 50 Ampere (index 2), trigger type: software

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: 0 to one less than the number of channels see ME-Axon (ME-7) Device Types.
  • iDir:

    • If 'iChannel' (see above) is is one of the voltage channels, then this must be ME_DIR_INPUT.

    • If 'iChannel' (see above) is is one of the current channels, then this should be ME_DIR_INPUT or ME_DIR_SET_OFFSET.

      ME_DIR_INPUT is used to read a value from the channel in the standard way.

      ME_DIR_SET_OFFSET is used to recalibrate the channel offset. Please see the ME-Axon hardware manual.
  • iValue:

    • If 'iDir' above is 'ME_DIR_SET_OFFSET' then the value returned here is the digital zero offset and is of no further interest.

    • If 'iDir' above is 'ME_DIR_INPUT' then the current digital value of the channel is returned here.
      Use the utility function meUtilityDigitalToPhysical to convert the digital value to a value in the appropriate physical units.
  • iTimeOut: If, on configuring the channel (see meIOSingleConfig), 'iTrigType' = ME_TRIG_TYPE_SW has been used here or if 'iDir' above is 'ME_DIR_SET_OFFSET' then this should be 0.
    Otherwise enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TYPE_NO_FLAGS

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog input sub-device on the ME-Axon (ME-7) boards has an internal timer with a basic frequency of 33 MHz

The minimum number of ticks which can be used here is 66 (TicksLow = 66, TicksHigh = 0) which corresponds to a frequency of 500 KHz or a sampling time of 2 microseconds

For the 'acquisition' and 'channel' timers the maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0077 Hz or a sampling time of approx 130 seconds.

For the 'scan' timer the maximum number of ticks which can be used is 1099511627775 (Hex 0xFFFFFFFFFF: TicksLow = 4294967295, TicksHigh = 255) which corresponds to a frequency of approx. 0.000003 Hz or a sampling time of approx 33318 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_ACQ_START, ME_TIMER_SCAN_START or ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a list of meIOStreamConfig structures containing the configuration for the individual channels.
    The elements of this list should be configured as follows:

    • iChannel: 0 to one less than the number of channels see ME-Axon (ME-7) Device Types .

    • iSingleConfig: The range index (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

      • For a voltage channel: Must be 0, 10, 11 or 12.

      • For a current channel: Between 2 and 9.
        Range index 1, the 500 ampere range, is no longer supported here.
  • iRef: Must be ME_REF_AI_GROUND.

  • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: The number of elements in the list 'pConfigList' above.

    A maximum of 1024 elements is allowed.
  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are four alternative modes for governing the start of the acquisition and way in which sampling proceeds:

      • Standard software trigger:

        After calling meIOStreamStart and a delay exactly determined by the value of the variables 'iAcqStartTicksLow' and 'iAcqStartTicksHigh' in the trigger structure passed to meIOStreamConfig, the acquisition starts without waiting for any external trigger. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between starting the acquisition with meIOStreamStart and the first channel being sampled.

        • iScanStartTrigType: ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW

        • iScanStartTicksLow, iScanStartTicksHigh:

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_TIMER then these values determine the amount of time which elapses between sampling two channel lists.
            Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks
            The value in iScanStartTicks must be at least as great as the number of channels in the list multiplied by the value in iConvChanTicks

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_FOLLOW these are not used and should both be 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. The rest of the acquisition is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' and (if 'iScanStartTrigType' = ME_TRIG_TYPE_TIMER) by the variables 'iScanStartTicksLow' and 'iScanStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType:

          • ME-071x, ME-075x, ME-076x: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: ME_TRIG_TYPE_TIMER or ME_TRIG_TYPE_FOLLOW

        • iScanStartTicksLow, iScanStartTicksHigh:

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_TIMER then these values determine the amount of time which elapses between sampling two channel lists.
            Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks
            The value in iScanStartTicks must be at least as great as the number of channels in the list multiplied by the value in iConvChanTicks

          • If 'iScanStartTrigType' above is ME_TRIG_TYPE_FOLLOW these are not used and should both be 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Channel list per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes an entire channel list to be acquired at a conversion rate determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType:

          • ME-071x, ME-075x, ME-076x: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: Use the same value used for 'iAcqStartTrigType' above.

        • iScanStartTicksLow, iScanStartTicksHigh: Not required here, set to 0.

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between sampling two adjacent channels in the channel list.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Single value per external trigger:

        After calling meIOStreamStart the acquisition is prepared, but does not start until the appropriate trigger is recognised. Every subsequent trigger causes a single channel to be acquired.

        Set the variable 'iAcqStartTrigType' in the trigger structure to ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG, 'iScanStartTrigType' must be set to ME_TRIG_TYPE_FOLLOW and 'iConvStartTrigType' must be set to the same value as 'iAcqStartTrigType'

        • iAcqStartTrigType:

          • ME-071x, ME-075x, ME-076x: Must be ME_TRIG_TYPE_EXT_DIGITAL.

          • Other boards: ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_EXT_ANALOG.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTicksLow, iAcqStartTicksHigh:

          Set to the tick values previously obtained by calling meIOStreamTimeToTicks with 'iTimer' = ME_TIMER_ACQ_START.

          A delay corresponding to these values will occur between the arrival of the trigger which starts the acquisition and the first channel being sampled.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

        • iScanStartTicksLow, iScanStartTicksHigh: Not required here, set to 0.

        • iConvStartTrigType: Use the same value used for 'iAcqStartTrigType' above.

        • iConvStartTicksLow, iConvStartTicksHigh: Not required here, set to 0.

    • There are two alternative ways of terminating the acquisition:

      • Run until terminated with meIOStreamStop

        This is the default if all other elements of the pTrigger structure are set to zero.

      • Run until a predetermined amount of data has been acquired and then stop automatically

        This type of acquisition can also be terminated prematurely by calling meIOStreamStop

        • iScanStopTrigType: ME_TRIG_TYPE_NONE or ME_TRIG_TYPE_COUNT

        • iScanStopCount:

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_NONE:

            Not required, should be 0.

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_COUNT:

            This is the number of samples after which the acquisition is automatically terminated.

        • iAcqStopTrigType:

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_NONE: ME_TRIG_TYPE_COUNT.

          • if "iScanStopTrigType" above is ME_TRIG_TYPE_COUNT: ME_TRIG_TYPE_FOLLOW.

        • iAcqStopCount:

          • if "iAcqStopTrigType" above is ME_TRIG_TYPE_FOLLOW:

            Not required, should be 0.

          • if "iAcqStopTrigType" above is ME_TRIG_TYPE_COUNT:

            This is the number of channel lists after which the acquisition is automatically terminated.

  • iFifoIrqThreshold: This is the number of data values required in the FIFO before an interrupt is triggered.

    The value used here must be between 1 and the FIFO size in data values.
    To determine the FIFO size see meQuerySubdeviceCapsArgs.

    From the point of view of the user, this determines the responsiveness of the software to incoming data.

    Choosing a lower value here means that incoming data is available more quickly, but increases the processor load as it results in more interrupts.

    See What is the meaning of the parameter 'iFifoIrqThreshold' in the routine meIOStreamConfig and what is a suitable value to use here? in the FAQ.

  • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_NO_FLAGS

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.
  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: ME_IO_STREAM_READ_NO_FLAGS or ME_IO_STREAM_READ_FRAMES.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog output sub-devices

  • ME-Axon (ME-7) Description
  • Using the ME-iDS API with the ME-Axon (ME-7) boards.

Analog output sub-devices

Analog output sub-devices

The analog output sub-devices on the ME-078x boards can be used in single and streaming mode. On all other boards they can only be used in single mode.

The sub-devices are single-channeled

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running, configures the sub-device to immediate mode (as opposed to synchronous mode) and outputs 0V.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

These subdevices have only one range:

  • 0: Bipolar 10.0 V

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The meQueryRange... functions behave accordingly.

meQuerySubdeviceCaps

This function returns ME_CAPS_AO_TRIG_SIMULTANEOUS for 'piCaps' for non-streaming sub-devices and ME_CAPS_AO_TRIG_SIMULTANEOUS | ME_CAPS_AO_FIFO for streaming sub-devices.

  • The value ME_CAPS_AO_TRIG_SIMULTANEOUS indicates that it is possible to configure several sub-devices in such a way that single samples can be acquired simultaneously or streaming operations can be started simultaneously on all the sub-devices at once.
  • The value ME_CAPS_AI_FIFO indicates that the sub-device has a FIFO whose size can be queried (see meQuerySubdeviceCapsArgs).

meQuerySubdeviceCapsArgs

Note:
Applies only to analog input sub-devices which support streaming operations.
  • iCap: Must be ME_CAP_AI_FIFO_SIZE.
  • piArgs: A pointer to a single integer in which the FIFO size is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the FIFO size in data values. On older boards this is 4096, newer boards may be provided with a larger FIFO.

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The range. Must be 0 as the sub-device has only a single range.
  • iRef: Must be ME_REF_AO_GROUND.
  • iTrigChan: ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels are configured to trigger channel: default, trigger type: software.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT, ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then the last digital value written to the sub-device is returned here. This is the current digital value of the channel.

    • If 'iDir' is 'ME_DIR_OUTPUT' then the digital value which is to be written to the sub-device should be supplied here. Use the utility function meUtilityPhysicalToDigital to convert the physical value in the appropriate units to the corresponding digital value.
  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then no flags are defined here - Use 'ME_IO_SINGLE_TYPE_NO_FLAGS'.

    • If 'iDir' is 'ME_DIR_OUTPUT' then this parameter should either be 'ME_IO_SINGLE_TYPE_NO_FLAGS' or an OR'ed combination of one or both of the flags 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' and 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS'.

      Use the flag 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' here if you have used 'ME_TRIG_TYPE_EXT_DIGITAL' for the parameter 'iTrigType' on configuring the sub-device (see meIOSingleConfig) and you want the routine to return immediately without waiting for the external trigger.

      Use the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' here to output immediately the value for this sub-device and all other sub-devices for which 'ME_TRIG_CHAN_SYNCHRONOUS' was used for the parameter 'iTrigChan' on configuring the sub-device (see meIOSingleConfig).
      In other words, to output values simultaneously to a number of different sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iTrigChan' and then call meIOSingle for each sub-device, employing the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog output sub-devices on the ME-Axon (ME-7) boards have an internal timer with a basic frequency of 33 MHz

The minimum number of ticks which can be used here is 66 (TicksLow = 66, TicksHigh = 0) which corresponds to a frequency of 500 KHz or an output interval of 2 microseconds

For the 'acquisition' timer the number of ticks used must be 0. In other words in is not possible to configure a delay between the arrival of the trigger (hardware or software) and the start of the output operation.

For the 'channel' timer the maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0077 Hz or a sampling time of approx 130 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_ACQ_START or ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a single meIOStreamConfig structure containing the configuration for the one and only channel on the sub-device.

    This structure should be configured as follows:

    • iChannel: The channel index - Must be zero.

    • iStreamConfig: The range index Must be zero.

    • iRef: Must be ME_REF_AO_GROUND.

    • iFlags: Should be ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS or ME_IO_STREAM_CONFIG_BIT_PATTERN

      The flag 'ME_IO_STREAM_CONFIG_BIT_PATTERN' can only be employed on the fourth and last of the analog output sub-devices (sub-device index 8) on the ME-078x series of boards.
      See Digital input/output sub-device and Analog output sub-device in ME-Axon (ME-7) Special features.

  • iCount: The number of elements in the list 'pConfigList' above - Must be 1.

  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the output is started and the way in which it proceeds once started.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are two alternative modes for governing the start of the acquisition and way in which sampling proceeds:

      • Standard software trigger:

        After calling meIOStreamStart, the output begins without waiting for any external trigger. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW.

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in ME-Axon (ME-7) Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the output is prepared, but does not start until the appropriate trigger is recognised. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in ME-Axon (ME-7) Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

  • iFifoIrqThreshold: This is not used here and should be set to zero.

  • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_NO_FLAGS.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.

    The choice made here is only of importance if the sub-device has been configured to start on receiving an external trigger ('iAcqStartTrigType' set to ME_TRIG_TYPE_EXT_DIGITAL in the trigger structure passed to meIOStreamConfig - see (see meIOStreamConfig)).
    In this case, the routine returns immediately if 'ME_START_MODE_NONBLOCKING' is used, but only returns after the trigger has been recognised and the output operation is started if 'ME_START_MODE_BLOCKING' is used.
  • iTimeOut:

    • If 'iStartMode' above is 'ME_START_MODE_NONBLOCKING': Not required, should be 0.

    • If 'iStartMode' above is 'ME_START_MODE_BLOCKING': Enter a value for the time-out in milliseconds here.
  • iFlags: ME_IO_STREAM_START_TYPE_NO_FLAGS or ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS.

    Use 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' here to start a number of analog output sub-devices simultaneously after configuring them appropriately by setting 'iAcqStartTrigChan' to ME_TRIG_CHAN_SYNCHRONOUS in the trigger structure passed to meIOStreamConfig (see meIOStreamConfig).
    In other words, to start outputting values simultaneously on a number of different analog output streaming sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iAcqStartTrigChan' in the trigger structure and then call meIOStreamStart for each sub-device, employing the flag 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamWrite

  • iWriteMode: ME_WRITE_MODE_PRELOAD, ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING.

    'ME_WRITE_MODE_PRELOAD' must be used before calling meIOStreamStart to provide the sub-device with a first buffer full of data values for a later output operation.

    ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING is used after calling meIOStreamStart to provide further data values to an output operation that is already running.
  • piValues: Pointer to an array of integers containing the digital data for the output operation.

    Use the utility functions meUtilityPhysicalToDigital or meUtilityPhysicalToDigitalV to convert the physical values in the appropriate units to the corresponding digital values.
  • piCount: Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values actually transferred to the internal software buffer and which wll be later join the output stream.
  • iFlags: No flags defined here - Use ME_IO_STREAM_WRITE_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus: Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the funtion.

  • piCount: Pointer to an integer which, on returning from the function, contains the amount of space left in the internal software buffer for the sub-device. This is the number of data values which could be written without delay using meIOStreamWrite.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE or ME_STOP_MODE_LAST_VALUE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-Axon (ME-7) Description
  • Using the ME-iDS API with the ME-Axon (ME-7) boards.

Counter sub-devices

Counter sub-devices

Each board of the ME-Axon (ME-7) family, except the ME-075x, has three 8254 counter sub-devices. See ME-Axon (ME-7) Device Types for the indices of these sub-devices on the various boards.

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0.

meQuerySubdeviceCaps

This function returns ME_CAPS_CTR_CLK_EXTERNAL for 'piCaps'. This means that only an external pulse can be used to drive the counters on these boards.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be ME_REF_CTR_EXTERNAL.
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-6xxx Description

ME-6xxx Description

ME-6xxx Description - Contents:

  • Device types.
    • ME-6000/4, ME-6000i/4, ME-6000p/4
    • ME-6000/8, ME-6000i/8, ME-6000p/8
    • ME-6000/16, ME-6000i/16, ME-6000p/16
    • ME-6000/4/DIO, ME-6000i/4/DIO, ME-6000p/4/DIO
    • ME-6000/8/DIO, ME-6000i/8/DIO, ME-6000p/8/DIO
    • ME-6000/16/DIO, ME-6000i/16/DIO, ME-6000p/16/DIO
    • ME-6100/4, ME-6100i/4, ME-6100p/4
    • ME-6100/8, ME-6100i/8, ME-6100p/8
    • ME-6100/16, ME-6100i/16, ME-6100p/16
    • ME-6100/4/DIO, ME-6100i/4/DIO, ME-6100p/4/DIO
    • ME-6100/8/DIO, ME-6100i/8/DIO, ME-6100p/8/DIO
    • ME-6100/16/DIO, ME-6100i/16/DIO, ME-6100p/1/DIO6
    • ME-6200i/9/DIO
    • ME-6300i/9/DIO
  • Special features.
    • Analog output sub-device
  • Using the ME-iDS API with an ME-6xxx board.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Analog output sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamWrite.
      • meIOStreamStatus.
      • meIOStreamStop.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-6xxx Device Types

  • ME-6xxx Description

ME-6xxx Device Types

ME-6xxx Device Types

The ME-6xxx board exists in the following varieties:

ME-6000/4, ME-6000i/4, ME-6000p/4

4 Sub-devices

  • 0: Analog output sub-device - 1 channel, single only
  • 1: Analog output sub-device - 1 channel, single only
  • 2: Analog o-utput sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only

ME-6000/8, ME-6000i/8, ME-6000p/8

8 Sub-devices

  • 0: Analog output sub-device - 1 channel, single only
  • 1: Analog output sub-device - 1 channel, single only
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only

ME-6000/16, ME-6000i/16, ME-6000p/16

16 Sub-devices

  • 0: Analog output sub-device - 1 channel, single only
  • 1: Analog output sub-device - 1 channel, single only
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only
  • 11: Analog output sub-device - 1 channel, single only
  • 12: Analog output sub-device - 1 channel, single only
  • 13: Analog output sub-device - 1 channel, single only
  • 14: Analog output sub-device - 1 channel, single only
  • 15: Analog output sub-device - 1 channel, single only

ME-6000/4/DIO, ME-6000i/4/DIO, ME-6000p/4/DIO

6 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only

ME-6000/8/DIO, ME-6000i/8/DIO, ME-6000p/8/DIO

10 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only

ME-6000/16/DIO, ME-6000i/16/DIO, ME-6000p/16/DIO

18 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only
  • 11: Analog output sub-device - 1 channel, single only
  • 12: Analog output sub-device - 1 channel, single only
  • 13: Analog output sub-device - 1 channel, single only
  • 14: Analog output sub-device - 1 channel, single only
  • 15: Analog output sub-device - 1 channel, single only
  • 16: Analog output sub-device - 1 channel, single only
  • 17: Analog output sub-device - 1 channel, single only

ME-6100/4, ME-6100i/4, ME-6100p/4

4 Sub-devices

  • 0: Analog output sub-device - 1 channel, streaming
  • 1: Analog output sub-device - 1 channel, streaming
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming

ME-6100/8, ME-6100i/8, ME-6100p/8

8 Sub-devices

  • 0: Analog output sub-device - 1 channel, streaming
  • 1: Analog output sub-device - 1 channel, streaming
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only

ME-6100/16, ME-6100i/16, ME-6100p/16

16 Sub-devices

  • 0: Analog output sub-device - 1 channel, streaming
  • 1: Analog output sub-device - 1 channel, streaming
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only
  • 11: Analog output sub-device - 1 channel, single only
  • 12: Analog output sub-device - 1 channel, single only
  • 13: Analog output sub-device - 1 channel, single only
  • 14: Analog output sub-device - 1 channel, single only
  • 15: Analog output sub-device - 1 channel, single only

ME-6100/4/DIO, ME-6100i/4/DIO, ME-6100p/4/DIO

6 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming

ME-6100/8/DIO, ME-6100i/8/DIO, ME-6100p/8/DIO

10 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only

ME-6100/16/DIO, ME-6100i/16/DIO, ME-6100p/1/DIO6

16 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only
  • 11: Analog output sub-device - 1 channel, single only
  • 12: Analog output sub-device - 1 channel, single only
  • 13: Analog output sub-device - 1 channel, single only
  • 14: Analog output sub-device - 1 channel, single only
  • 15: Analog output sub-device - 1 channel, single only
  • 16: Analog output sub-device - 1 channel, single only
  • 17: Analog output sub-device - 1 channel, single only

ME-6200i/9/DIO

11 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, single only
  • 3: Analog output sub-device - 1 channel, single only
  • 4: Analog output sub-device - 1 channel, single only
  • 5: Analog output sub-device - 1 channel, single only
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only, range 0.0 V - 50.0 V

ME-6300i/9/DIO

11 Sub-devices

  • 0: Digital Input/Output sub-device - 8 bits wide
  • 1: Digital Input/Output sub-device - 8 bits wide
  • 2: Analog output sub-device - 1 channel, streaming
  • 3: Analog output sub-device - 1 channel, streaming
  • 4: Analog output sub-device - 1 channel, streaming
  • 5: Analog output sub-device - 1 channel, streaming
  • 6: Analog output sub-device - 1 channel, single only
  • 7: Analog output sub-device - 1 channel, single only
  • 8: Analog output sub-device - 1 channel, single only
  • 9: Analog output sub-device - 1 channel, single only
  • 10: Analog output sub-device - 1 channel, single only, range 0.0 V - 50.0 V


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features

  • ME-6xxx Description

Special features

Special features

The sub-devices on the me6000 boards (or on some of its variants) posess the following special features:

Analog output sub-device

  • All boards - Data output (single or, where available, streaming) can be started simultaneously on several separate analog output devices.

    • In single mode:
      Set the parameter 'iTriggerChannel' = ME_TRIG_CHAN_SYNCHRONOUS in meIOSingleConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pSingleList' passed to meIOSingle.

    • In streaming mode:
      Set the member 'iAcqStartTrigChan' of the parameter 'pTrigger' = ME_TRIG_CHAN_SYNCHRONOUS in meIOStreamConfig for each sub-device.
      Use the flag (parameter 'iFlags') ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS for the last of the sub-devices which are to be started simultaneously in the list 'pStartList' passed to meIOStreamStart.
  • ME-6259, ME-6359 - Sub-device 10 on these boards has a range of 0V - +50V. All other analog output sub-devices on these boards and all the analog output sub-devices on all the other boards have a range of -10V - +10V.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-6xxx boards.

  • ME-6xxx Description

Using the ME-iDS API with the ME-6xxx boards.

Using the ME-iDS API with the ME-6xxx boards.

  • Digital input/output sub-devices.
  • Analog output sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-6xxx Description
  • Using the ME-iDS API with the ME-6xxx boards.

Digital input/output sub-devices

Digital input/output sub-devices

The port is 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef:

    Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog output sub-devices

  • ME-6xxx Description
  • Using the ME-iDS API with the ME-6xxx boards.

Analog output sub-devices

Analog output sub-devices

The first four analog output sub-devices on the ME-61xx boards can be used in single and streaming mode. All other analog output sub-devices on all boards can only be used in single mode.

The sub-devices are single-channeled

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running, configures the sub-device to immediate mode (as opposed to synchronous mode) and outputs 0V.

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

These sub-devices have only one range:

On all analog output sub-devices except the last such sub-device on the ME-6259 and ME-6359 boards, this range is as follows:

  • 0: Bipolar 10.0 V

    Physical range: -10.0 V - +9.999695 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

On the last analog sub-device on the ME-6259 and ME-6359 boards, this range is as follows:

  • 0: Unipolar 50.0 V

    Physical range: 0.0 V - +49.999237 V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

See ME-6xxx Device Types

The meQueryRange... functions behave accordingly.

meQuerySubdeviceCaps

This function returns ME_CAPS_AO_TRIG_SIMULTANEOUS for 'piCaps' for non-streaming sub-devices and ME_CAPS_AO_TRIG_SIMULTANEOUS | ME_CAPS_AO_FIFO for streaming sub-devices.

  • The value ME_CAPS_AO_TRIG_SIMULTANEOUS indicates that it is possible to configure several sub-devices in such a way that single samples can be acquired simultaneously or streaming operations can be started simultaneously on all the sub-devices at once.
  • The value ME_CAPS_AO_FIFO indicates that the sub-device has a FIFO whose size can be queried (see meQuerySubdeviceCapsArgs).

meQuerySubdeviceCapsArgs

Note:
Applies only to analog input sub-devices which support streaming operations.
  • iCap: Must be ME_CAP_AO_FIFO_SIZE.
  • piArgs: A pointer to a single integer in which the FIFO size is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the FIFO size in data values. On older boards this is 4096, newer boards may be provided with a larger FIFO.

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The range. Must be 0 as the sub-device has only a single range.
  • iRef: Must be ME_REF_AO_GROUND.
  • iTrigChan: ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.
  • iTrigType: ME_TRIG_TYPE_SW or ME_TRIG_TYPE_EXT_DIGITAL.
  • iTrigEdge:

    • If 'iTrigType' (see above) is ME_TRIG_TYPE_SW then this parameter is not required here, use ME_VALUE_NOT_USED.

    • Otherwise, ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS

Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, all channels are configured to trigger channel: default, trigger type: software.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then the last digital value written to the sub-device is returned here. This is the current digital value of the channel.

    • If 'iDir' is 'ME_DIR_OUTPUT' then the digital value which is to be written to the sub-device should be supplied here. Use the utility function meUtilityPhysicalToDigital to convert the physical value in the appropriate units to the corresponding digital value.
  • iTimeOut:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then this parameter is not used and should be zero.

    • If 'iDir' is 'ME_DIR_OUTPUT', and, on configuring the channel (see meIOSingleConfig), 'iTrigType' = 'ME_TRIG_TYPE_SW' has been used here, then this should be 0.
      Otherwise enter a value for the time-out in milliseconds here.
  • iFlags:

    • If 'iDir' (see above) is 'ME_DIR_INPUT' then no flags are defined here - Use 'ME_IO_SINGLE_TYPE_NO_FLAGS'.

    • If 'iDir' is 'ME_DIR_OUTPUT' then this parameter should either be 'ME_IO_SINGLE_TYPE_NO_FLAGS' or an OR'ed combination of one or both of the flags 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' and 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS'.

      Use the flag 'ME_IO_SINGLE_TYPE_WRITE_NONBLOCKING' here if you have used 'ME_TRIG_TYPE_EXT_DIGITAL' for the parameter 'iTrigType' on configuring the sub-device (see meIOSingleConfig) and you want the routine to return immediately without waiting for the external trigger.

      Use the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' here to output immediately the value for this sub-device and all other sub-devices for which 'ME_TRIG_CHAN_SYNCHRONOUS' was used for the parameter 'iTrigChan' on configuring the sub-device (see meIOSingleConfig).
      In other words, to output values simultaneously to a number of different sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iTrigChan' and then call meIOSingle for each sub-device, employing the flag 'ME_IO_SINGLE_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog output sub-devices on the ME-6xxx boards have an internal timer with a basic frequency of 33 MHz

The minimum number of ticks which can be used here is 66 (TicksLow = 66, TicksHigh = 0) which corresponds to a frequency of 500 KHz or an output interval of 2 microseconds

For the 'acquisition' timer the number of ticks used must be 0. In other words in is not possible to configure a delay between the arrival of the trigger (hardware or software) and the start of the output operation.

For the 'channel' timer the maximum number of ticks which can be used is 4294967295 (Hex 0xFFFFFFFF: TicksLow = 4294967295, TicksHigh = 0) which corresponds to a frequency of approx. 0.0077 Hz or a sampling time of approx 130 seconds.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: ME_TIMER_ACQ_START or ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: No flags defined here - Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS

meIOStreamConfig

  • pConfigList: This is a pointer to a single meIOStreamConfig structure containing the configuration for the one and only channel on the sub-device.

    This structure should be configured as follows:

    • iChannel: The channel index - Must be zero.

    • iStreamConfig: The range index. Must be zero.

    • iRef: Must be ME_REF_AO_GROUND.

    • iFlags: Must be ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: The number of elements in the list 'pConfigList' above - Must be 1.

  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the output is started and the way in which it proceeds once started.

    Any elements in this structure which are not specifically used should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • There are two alternative modes for governing the start of the operation and way in which data output proceeds:

      • Standard software trigger:

        After calling meIOStreamStart, the output begins without waiting for any external trigger. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_SW.

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

      • Standard external trigger:

        After calling meIOStreamStart the output is prepared, but does not start until the appropriate trigger is recognised. The rest of the output is determined by the variables 'iConvStartTicksLow' and 'iConvStartTicksHigh' in the trigger structure.

        • iAcqStartTrigType: Must be ME_TRIG_TYPE_EXT_DIGITAL.

        • iAcqStartTrigEdge: ME_TRIG_EDGE_RISING, ME_TRIG_EDGE_FALLING or ME_TRIG_EDGE_ANY

        • iAcqStartTrigChan: Must be either ME_TRIG_CHAN_DEFAULT or ME_TRIG_CHAN_SYNCHRONOUS.

          Use 'ME_TRIG_CHAN_SYNCHRONOUS' to configure each of a number of separate analog output sub-devices which you want to start synchronously. See Analog output sub-device in Special features.

        • iAcqStartTicksLow, iAcqStartTicksHigh: Must both be set to 0.

        • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW

        • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER

        • iConvStartTicksLow, iConvStartTicksHigh:

          Determine the amount of time which elapses between outputting two consecutive channel values.
          Suitable values should be obtained using the routines meIOStreamTimeToTicks or meIOStreamFrequencyToTicks

  • iFifoIrqThreshold: This is not used here and should be set to zero.

  • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_NO_FLAGS.

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.

    The choice made here is only of importance if the sub-device has been configured to start on receiving an external trigger ('iAcqStartTrigType' set to ME_TRIG_TYPE_EXT_DIGITAL in the trigger structure passed to meIOStreamConfig - see (see meIOStreamConfig)).
    In this case, the routine returns immediately if 'ME_START_MODE_NONBLOCKING' is used, but only returns after the trigger has been recognised and the output operation is started if 'ME_START_MODE_BLOCKING' is used.
  • iTimeOut:

    • If 'iStartMode' above is 'ME_START_MODE_NONBLOCKING': Not required, should be 0.

    • If 'iStartMode' above is 'ME_START_MODE_BLOCKING': Enter a value for the time-out in milliseconds here.
  • iFlags: ME_IO_STREAM_START_TYPE_NO_FLAGS or ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS.

    Use 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' here to start a number of analog output sub-devices simultaneously after configuring them appropriately by setting 'iAcqStartTrigChan' to ME_TRIG_CHAN_SYNCHRONOUS in the trigger structure passed to meIOStreamConfig (see meIOStreamConfig).
    In other words, to start outputting values simultaneously on a number of different analog output streaming sub-devices, configure each one first using 'ME_TRIG_CHAN_SYNCHRONOUS' for 'iAcqStartTrigChan' in the trigger structure and then call meIOStreamStart for each sub-device, employing the flag 'ME_IO_STREAM_START_TYPE_TRIG_SYNCHRONOUS' only for the last of the sub-devices.

meIOStreamWrite

  • iWriteMode: ME_WRITE_MODE_PRELOAD, ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING.

    'ME_WRITE_MODE_PRELOAD' must be used before calling meIOStreamStart to provide the sub-device with a first buffer full of data values for a later output operation.

    ME_WRITE_MODE_BLOCKING or ME_WRITE_MODE_NONBLOCKING is used after calling meIOStreamStart to provide further data values to an output operation that is already running.
  • piValues: Pointer to an array of integers containing the digital data for the output operation.

    Use the utility functions meUtilityPhysicalToDigital or meUtilityPhysicalToDigitalV to convert the physical values in the appropriate units to the corresponding digital values.
  • piCount: Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values actually transferred to the internal software buffer and which wll be later join the output stream.
  • iFlags: No flags defined here - Use ME_IO_STREAM_WRITE_NO_FLAGS.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus: Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the funtion.

  • piCount: Pointer to an integer which, on returning from the function, contains the amount of space left in the internal software buffer for the sub-device. This is the number of data values which could be written without delay using meIOStreamWrite.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE or ME_STOP_MODE_LAST_VALUE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-630 Description

ME-630 Description

ME-630 Description - Contents:

  • Device types.
    • ME-630
    • ME-630 - USB (Mephisto Switch)
  • Using the ME-iDS API with an ME-630 board.
    • Digital input sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
    • Digital output sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • External IRQ sub-device.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOIrqSetCallback.
      • meIOIrqStart.
      • meIOIrqStop.
      • meIOIrqWait.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-630 Description

Device Types

ME-630 Device Types

The ME-630 board exists in the following varieties:

ME-630

7 Subdevices

  • 0: Digital Input subdevice - 8 bits wide - TTL
  • 1: Digital Input subdevice - 8 bits wide - Opto-isolated
  • 2: Digital Output subdevice - 16 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: External IRQ subdevice
  • 6: External IRQ subdevice

ME-630 - USB (Mephisto Switch)

5 Subdevices

  • 0: Digital Input subdevice - 8 bits wide - TTL
  • 1: Digital Input subdevice - 8 bits wide - Opto-isolated
  • 2: Digital Output subdevice - 16 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide
  • 4: Digital Input/Output subdevice - 8 bits wide


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-630 boards.

  • ME-630 Description

Using the ME-iDS API with the ME-630 boards.

Using the ME-iDS API with the ME-630x boards.

  • Digital input sub-devices.
  • Digital output sub-device.
  • Digital input/output sub-devices.
  • External IRQ sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-devices

  • ME-630 Description
  • Using the ME-iDS API with the ME-630 boards.

Digital input sub-devices

Digital input sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

meIOSingleConfig

  • iChannel: Must be 0.

  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.

  • iRef: Not required here, use ME_VALUE_NOT_USED.

  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.

  • iTrigType: Not required here, use ME_VALUE_NOT_USED.

  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.

  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

Since all settings are fixed here, it is not necessary to call meIOSingleConfig at all before reading from the sub-device.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-device

  • ME-630 Description
  • Using the ME-iDS API with the ME-630 boards.

Digital output sub-device

Digital output sub-device

The port is 16 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function initializes the port with the value 0 (all bits 0).

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_WORD.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-630 Description
  • Using the ME-iDS API with the ME-630 boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: External IRQ sub-devices

  • ME-630 Description
  • Using the ME-iDS API with the ME-630 boards.

External IRQ sub-devices

External IRQ sub-devices

Each board of the ME-630 family has exactly one external irq sub-device. See ME-630 Device Types for the index of this sub-device on the various boards.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_EXT_IRQ_EDGE_RISING in 'piCaps'.
This indicates the argument that can be used for the parameter 'iIrqEdge' in meIOIrqStart.

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback! each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: Must be ME_IRQ_SOURCE_DIO_LINE.
  • iIrqEdge: Must be ME_IRQ_EDGE_RISING.
  • iIrqArg: Ignored here, should be 0.
  • iFlags: Not required, use ME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: 0 is always returned here.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_WAIT_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-8100 Description

ME-8100 Description

ME-8100 Description - Contents:

  • Device types.
    • ME-8200A, ME-8200A - USB (Mephisto Opto)
    • ME-8200B, ME-8200B - USB (Mephisto Opto)
  • Special features.
    • Digital input sub-devices
    • Digital output sub-devices
  • Using the ME-iDS API with an ME-8100 board.
    • Digital input sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback (not implemented for the Mephisto Opto).
      • meIOIrqStart (not implemented for the Mephisto Opto).
      • meIOIrqStop (not implemented for the Mephisto Opto).
      • meIOIrqWait (not implemented for the Mephisto Opto).
    • Digital output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Counter sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meQuerySubdeviceCapsArgs.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-8100 Device Types

  • ME-8100 Description

ME-8100 Device Types

ME-8100 Device Types

The ME-8100 board exists in the following varieties:

ME-8100A

5 Subdevices

  • 0: Digital Input subdevice - 16 bits wide
  • 1: Digital Output subdevice - 16 bits wide
  • 2: 8254 Counter subdevice
  • 3: 8254 Counter subdevice
  • 4: 8254 Counter subdevice

ME-8100B

7 Subdevices

  • 0: Digital Input subdevice - 16 bits wide
  • 1: Digital Input subdevice - 16 bits wide
  • 2: Digital Output subdevice - 16 bits wide
  • 3: Digital Output subdevice - 16 bits wide
  • 4: 8254 Counter subdevice
  • 5: 8254 Counter subdevice
  • 6: 8254 Counter subdevice


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features

  • ME-8100 Description

Special features

ME-8100 Special features

The subdevices on the me8100 boards (or on some of its variants) posess the following special features:

Digital output sub-devices

  • All boards - The sub-devices can be configured as sink, source or high impedance.
    Use the appropriate value for the parameter 'iSingleConfig' on calling meIOSingleConfig.

Digital input sub-devices

  • All boards - An interrupt can be generated in one of two alternative ways.

    • Bit pattern compare:
      An interrupt is generated when the bit pattern seen on the digital input sub-device exactly matches a user-defined bit pattern.

      Call meIOIrqStart with the parameter 'iIrqSource' set to ME_IRQ_SOURCE_DIO_PATTERN and the lower 16-bits of 'iIrqArg' set to the bit-pattern which should cause the interrupt.

    • Bit change:
      An interrupt is generated when the value of one of a user-defined selection of bits is changed.

      Call meIOIrqStart with the parameter 'iIrqSource' set to ME_IRQ_SOURCE_DIO_MASK and with those bits which should cause an interrupt when changed set to 1 in the lower 16-bits of 'iIrqArg'.
      Bits which should not generate an interrupt when changed should be set to 0 in 'iIrqArg'.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-8100 boards.

  • ME-8100 Description

Using the ME-iDS API with the ME-8100 boards.

Using the ME-iDS API with the ME-8100 boards.

  • Digital input sub-devices.
  • Digital output sub-devices.
  • Counter sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-8100 Description
  • Using the ME-iDS API with the ME-8100 boards.

Digital input sub-device

Digital input sub-devices

The ports are 16 bits wide and opto-isolated.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_BIT_PATTERN_IRQ and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameters 'iIrqSource' and 'iIrqEdge' in meIOIrqStart.

meIOSingleConfig

  • iChannel: Must be 0.

  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.

  • iRef: Not required here, use ME_VALUE_NOT_USED.

  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.

  • iTrigType: Not required here, use ME_VALUE_NOT_USED.

  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.

  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_WORD.

Since all settings are fixed here, it is not necessary to call meIOSingleConfig at all before reading from the sub-device.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 (lower byte) or 1 (upper byte).

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the 16-bit port value between Hex 0 and Hex FFFF will be returned here.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper 8-bits of the port value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD

meIOIrqSetCallback

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this must be ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 16-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then the lower 16-bits here are the interrupt mask.
      The bits which should cause an interrupt when changed are set to 1 and the bits which should not generate an interrupt when changed are set to 0.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x1111 and the port value changes from 0x0011 to 0x1100 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x1111 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_EXTENDED_STATUS.
      If you use 'ME_IO_IRQ_START_NO_FLAGS' then the the parameter 'piValue' returned to the routine meIOIrqWait or the parameter 'iValue' returned to an installed callback routine (see meIOIrqSetCallback) simply contains in the lower 16 bits a mask of the port value bits which have changed since the last interrupt event.

      If you use ME_IO_IRQ_START_EXTENDED_STATUS, then the parameter 'piValue' or 'iValue' mentioned above contains in the lowest 16 bits a mask of the port value bits which have changed from '1' to '0' (falling edge) since the last interrupt event and in bits 16 to 31 a mask of the port value bits which have changed from '0' to '1' (rising edge) since the last interrupt event.

meIOIrqStop

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then. depending on the parameter 'iFlags' passed to meIOIrqStart and on the parameter 'iFlags' passed to this function, either the IRQ status or the extended IRQ status is returned here. See the description of the parameter 'iFlags' in meIOIrqStart.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags:

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_WAIT_NO_FLAGS.

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then this parameter may be ME_IO_IRQ_WAIT_NO_FLAGS, ME_IO_IRQ_WAIT_NORMAL_STATUS or ME_IO_IRQ_WAIT_EXTENDED_STATUS.
      By using the flag 'ME_IO_IRQ_WAIT_NORMAL_STATUS' or 'ME_IO_IRQ_WAIT_EXTENDED_STATUS' here, the general behaviour defined by the parameter 'iFlags' in meIOIrqStart can be overriden for single calls to meIOIrqWait.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-devices

  • ME-8100 Description
  • Using the ME-iDS API with the ME-8100 boards.

Digital output sub-devices

Digital output sub-devices

The ports are 16 bits wide and opto-isolated.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function initializes the sub-device with the value 0 (all bits 0).

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_DIO_SINK_SOURCE in 'piCaps'.
This indicates that the sub-device can be used in high impedance, sink or source mode, see the parameter 'iSingleConfig' in meIOSingleConfig below.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_HIGH_IMPEDANCE, ME_SINGLE_CONFIG_DIO_SINK or ME_SINGLE_CONFIG_DIO_SOURCE.
  • iRef: Not required here, use ME_VALUE_NOT_USED
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_WORD.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0 or 1.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 15 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the port value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the lower or upper byte value of the port between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_WORD.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Counter sub-devices

  • ME-8100 Description
  • Using the ME-iDS API with the ME-8100 boards.

Counter sub-devices

Counter sub-devices

Each of the ME-8100 boards has three 8254 counter sub-devices.

The following API functions are supported for these sub-devices:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function sets the counter mode to 0 and writes a count of 0.

meQuerySubdeviceCaps

This function returns ME_CAPS_CTR_CLK_EXTERNAL for 'piCaps'. This means that only an external pulse can be used to drive the counters on these boards.

meQuerySubdeviceCapsArgs

  • iCap: Must be ME_CAP_CTR_WIDTH.
  • piArgs: A pointer to a single integer in which the counter width is returned.
  • iCount: Must be 1.

On returning from the function, the integer to which the variable 'piArgs' points contains the value 16, as the 8254 counters on these boards are always 16 bits wide..

meIOSingleConfig

  • iChannel: Must be 0 as the sub-device has only a single channel.
  • iSingleConfig: The counter mode required. Use one of the constants ME_SINGLE_CONFIG_CTR_8254_MODE_0, ME_SINGLE_CONFIG_CTR_8254_MODE_1, ME_SINGLE_CONFIG_CTR_8254_MODE_2, ME_SINGLE_CONFIG_CTR_8254_MODE_3, ME_SINGLE_CONFIG_CTR_8254_MODE_4 or ME_SINGLE_CONFIG_CTR_8254_MODE_5.

    For an explanation of the counter modes, please see ths ME-iDS manual or the standard documenation for the 8254 chip.
  • iRef: The pulse source for the counter. Must be ME_REF_CTR_EXTERNAL.
  • iTrigChan: Not required, use ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Not required, use ME_TRIG_TYPE_NONE.
  • iTrigEdge: Not required, use ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, counter mode 0 is configured.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: Must be 0.
  • iDir: ME_DIR_OUTPUT or ME_DIR_INPUT.
  • iValue:

    • If 'iDir' (see above) is 'ME_DIR_OUTPUT' then the lower 16 bits of 'iValue' are written to the counter register.

    • If 'iDir' is 'ME_DIR_INPUT' then the current count is returned here. If the last value written to the counter register (iDir = ME_DIR_OUTPUT) has not yet been loaded into the counting element then 0 is returned here and the routine itself returns the error ME_ERRNO_SUBDEVICE_NOT_RUNNING (52).
  • iTimeOut: Not used, should be zero.
  • iFlags: Not required, use ME_IO_SINGLE_TYPE_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-8200 Description

ME-8200 Description

ME-8200 Description - Contents:

  • Device types.
    • ME-8200A, ME-8200A - USB (Mephisto Opto)
    • ME-8200B, ME-8200B - USB (Mephisto Opto)
  • Special features.
    • Digital input sub-devices
    • Digital output sub-devices
  • Using the ME-iDS API with an ME-8200 board.
    • Digital input sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback (not implemented for the Mephisto Opto).
      • meIOIrqStart (not implemented for the Mephisto Opto).
      • meIOIrqStop (not implemented for the Mephisto Opto).
      • meIOIrqWait (not implemented for the Mephisto Opto).
    • Digital output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOIrqSetCallback (not implemented for the Mephisto Opto).
      • meIOIrqStart (not implemented for the Mephisto Opto).
      • meIOIrqStop (not implemented for the Mephisto Opto).
      • meIOIrqWait (not implemented for the Mephisto Opto).
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-8200 Device Types

  • ME-8200 Description

ME-8200 Device Types

ME-8200 Device Types

The ME-8200 board exists in the following varieties:

ME-8200A, ME-8200A - USB (Mephisto Opto)

4 Subdevices

  • 0: Digital Input subdevice - 8 bits wide - opto-isolated
  • 1: Digital Output subdevice - 8 bits wide - opto-isolated
  • 2: Digital Input/Output subdevice - 8 bits wide
  • 3: Digital Input/Output subdevice - 8 bits wide

ME-8200B, ME-8200B - USB (Mephisto Opto)

6 Subdevices

  • 0: Digital Input subdevice - 8 bits wide - opto-isolated
  • 1: Digital Input subdevice - 8 bits wide - opto-isolated
  • 2: Digital Output subdevice - 8 bits wide - opto-isolated
  • 3: Digital Output subdevice - 8 bits wide - opto-isolated
  • 4: Digital Input/Output subdevice - 8 bits wide
  • 5: Digital Input/Output subdevice - 8 bits wide


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features

  • ME-8200 Description

Special features

ME-8200 Special features

The sub-devices on the me8200 boards (or on some of its variants) posess the following special features:

Digital input sub-devices

  • All PCI boards but not Mephisto Opto - An interrupt can be generated in one of two alternative ways.

    • Bit pattern compare:
      An interrupt is generated when the bit pattern seen on the digital input sub-device exactly matches a user-defined bit pattern.

      Call meIOIrqStart with the parameter 'iIrqSource' set to ME_IRQ_SOURCE_DIO_PATTERN and the lower 8-bits of 'iIrqArg' set to the bit-pattern which should cause the interrupt.

    • Bit change:
      An interrupt is generated when the value of one of a user-defined selection of bits is changed.

      Call meIOIrqStart with the parameter 'iIrqSource' set to ME_IRQ_SOURCE_DIO_MASK and with those bits which should cause an interrupt when changed set to 1 in the lower 8-bits of 'iIrqArg'.
      Bits which should not generate an interrupt when changed should be set to 0 in 'iIrqArg'.

Digital output sub-devices

  • All PCI boards but Not Mephisto Opto - An interrupt can be generated if the output current exceeds a certain maximum value.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-8200 boards.

  • ME-8200 Description

Using the ME-iDS API with the ME-8200 boards.

Using the ME-iDS API with the ME-8200 boards.

  • Digital input sub-devices.
  • Digital output sub-devices.
  • Digital input/output sub-devices.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-device

  • ME-8200 Description
  • Using the ME-iDS API with the ME-8200 boards.

Digital input sub-device

Digital input sub-device

The ports are 8 bits wide and opto-isolated.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constants ME_CAPS_DIO_BIT_PATTERN_IRQ, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_RISING, ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_FALLING and ME_CAPS_DIO_BIT_MASK_IRQ_EDGE_ANY OR'ed together in 'piCaps'.
This indicates the arguments that can be used for the parameters 'iIrqSource' and 'iIrqEdge' in meIOIrqStart.

meIOSingleConfig

  • iChannel: Must be 0.

  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.

  • iRef: Not required here, use ME_VALUE_NOT_USED.

  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.

  • iTrigType: Not required here, use ME_VALUE_NOT_USED.

  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.

  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

Since all settings are fixed here, it is not necessary to call meIOSingleConfig at all before reading from the sub-device.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE

meIOIrqSetCallback

Does not apply to the Mephisto Opto.

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

Does not apply to the Mephisto Opto.

  • iChannel: Must be 0.
  • iIrqSource: ME_IRQ_SOURCE_DIO_PATTERN or ME_IRQ_SOURCE_DIO_MASK.
  • iIrqEdge:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter is not required, use ME_VALUE_NOT_USED.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this should be ME_IRQ_EDGE_RISING or ME_IRQ_EDGE_FALLING or ME_IRQ_EDGE_ANY.
  • iIrqArg:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then the lower 8-bits here are the bit-pattern which will trigger an interrupt.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then the lower 8-bits here are the interrupt mask.
      The bits which should cause an interrupt when changed are set to 1 and the bits which should not generate an interrupt when changed are set to 0.
  • iFlags:

    • If 'iIrqSource' (see above) is ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_PATTERN_FILTERING.

      If you use 'ME_IO_IRQ_START_NO_FLAGS' then an interrupt event may be registered even if the digital port value only 'passes through' the pattern value you are monitoring. For example, if you are monitoring the pattern 0x11 and the port value changes from 0x01 to 0x10 then an interrupt may be generated and an interrupt event registered because, due to tiny delays in the hardware, the pattern 0x11 was actually matched for an instant.

      If you use 'ME_IO_IRQ_START_PATTERN_FILTERING' then an interrupt event will only be registered when the monitored pattern is actually observed at the time the interrupt is processed. This may however cause genuine pattern matches to be lost if the port value is changing very rapidly.

    • If 'iIrqSource' is ME_IRQ_SOURCE_DIO_MASK then this parameter should be ME_IO_IRQ_START_NO_FLAGS or ME_IO_IRQ_START_EXTENDED_STATUS.
      If you use 'ME_IO_IRQ_START_NO_FLAGS' then the the parameter 'piValue' returned to the routine meIOIrqWait or the parameter 'iValue' returned to an installed callback routine (see meIOIrqSetCallback) simply contains in the lower 8 bits a mask of the port value bits which have changed since the last interrupt event.

      If you use ME_IO_IRQ_START_EXTENDED_STATUS, then the parameter 'piValue' or 'iValue' mentioned above contains in the lowest 8 bits a mask of the port value bits which have changed from '1' to '0' (falling edge) since the last interrupt event and in bits 16 to 23 a mask of the port value bits which have changed from '0' to '1' (rising edge) since the last interrupt event.

meIOIrqStop

Does not apply to the Mephisto Opto.

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

Does not apply to the Mephisto Opto.

This function can be used to wait explicitly for an interrupt to arrive as an alternative to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue:

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then the port value at the moment the interrupt is processed is returned here.

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then. depending on the parameter 'iFlags' passed to meIOIrqStart and on the parameter 'iFlags' passed to this function, either the IRQ status or the extended IRQ status is returned here. See the description of the parameter 'iFlags' in meIOIrqStart.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags:

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_PATTERN then this parameter should be ME_IO_IRQ_WAIT_NO_FLAGS.

    • If on calling meIOIrqStart 'iIrqSource' was ME_IRQ_SOURCE_DIO_MASK then this parameter may be ME_IO_IRQ_WAIT_NO_FLAGS, ME_IO_IRQ_WAIT_NORMAL_STATUS or ME_IO_IRQ_WAIT_EXTENDED_STATUS.
      By using the flag 'ME_IO_IRQ_WAIT_NORMAL_STATUS' or 'ME_IO_IRQ_WAIT_EXTENDED_STATUS' here, the general behaviour defined by the parameter 'iFlags' in meIOIrqStart can be overriden for single calls to meIOIrqWait.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-device

  • ME-8200 Description
  • Using the ME-iDS API with the ME-8200 boards.

Digital output sub-device

Digital output sub-device

The ports are 8 bits wide and opto-isolated.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function initializes the sub-device with the value 0 (all bits 0), stops an interrupt operation that may be running and resets the IRQ count to 0.

Note:
An IRQ callback routine that has been installed for this sub-device with meIOIrqSetCallback remains installed.

meQuerySubdeviceCaps

This function returns the constant ME_CAPS_DIO_OVER_TEMP_IRQ in 'piCaps'.
This indicates that the sub-device can generate an interrupt when the output is overloaded, see meIOIrqStart.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE

meIOIrqSetCallback

Does not apply to the Mephisto Opto.

This function should be called before calling meIOIrqStart to install a callback routine which will be executed each time an external interrupt is triggered. This is an alternative to using meIOIrqWait.

  • pCallback: Callback function which will be executed each time an interrupt occurs.
  • pCallbackContext: User-defined pointer passed to the calback function 'pCallback' each time it is executed.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.

meIOIrqStart

Does not apply to the Mephisto Opto.

  • iChannel: Must be 0.
  • iIrqSource: Must be ME_IRQ_SOURCE_DIO_OVER_TEMP.
  • iIrqEdge: Not required, use ME_VALUE_NOT_USED.
  • iIrqArg: Not required, use ME_VALUE_NOT_USED.
  • iFlags: Not required, useME_IO_IRQ_START_NO_FLAGS.

meIOIrqStop

Does not apply to the Mephisto Opto.

  • iChannel: Must be 0.
  • iFlags: Not required, use ME_IO_IRQ_STOP_NO_FLAGS.

meIOIrqWait

Does not apply to the Mephisto Opto.

This function can be used to wait explicitly for an interrupt to arrive as an alternatave to using meIOIrqSetCallback to install an interrupt function.

  • iChannel: Must be 0.
  • piIrqCount: The current IRQ count is returned here. This is the number of interrupts which have occurred since the last time meIOResetSubdevice was called or since the device was started.
  • piValue: 0 is always returned here.
  • iTimeOut: Time-out in milliseconds. Entering '0' here causes the function to wait indefinitely until an interrupt arrives or until the interrupt control is terminated with meIOIrqStop or meIOResetSubdevice.
  • iFlags: Not required, use ME_IO_IRQ_SET_CALLBACK_NO_FLAGS.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • ME-8200 Description
  • Using the ME-iDS API with the ME-8200 boards.

Digital input/output sub-devices

Digital input/output sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures the sub-device for input.

meQuerySubdeviceCaps

This function returns ME_CAPS_DIO_DIR_BYTE for 'piCaps'.
This means that the port direction can only be changed byte-wise.

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE
Note:
If the port has been configured for input (see meIOSingleConfig), then calling meIOSingle with 'iDir' = ME_DIR_OUTPUT causes an error.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: ME-9x Description

ME-9x Description

ME-9x Description - Contents:

  • Device types.
    • ME-94
    • ME-95
    • ME-96
  • Using the ME-iDS API with an ME-9x board.
    • Digital input sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.
    • Digital output sub-devices.
      • meIOResetSubdevice.
      • meIOSingleConfig.
      • meIOSingle.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • ME-9x Description

Device Types

Device Types

The ME-9x board exists in the following varieties:

ME-94

2 Subdevices

  • 0: Digital Input subdevice - 8 bits wide
  • 1: Digital Input subdevice - 8 bits wide

ME-95

2 Subdevices

  • 0: Digital Output subdevice - 8 bits wide
  • 1: Digital Output subdevice - 8 bits wide

ME-96

2 Subdevices

  • 0: Digital Input subdevice - 8 bits wide
  • 1: Digital Output subdevice - 8 bits wide


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the ME-9x boards.

  • ME-9x Description

Using the ME-iDS API with the ME-9x boards.

Using the ME-iDS API with the ME-9x boards.

  • Digital input sub-devices.
  • Digital output sub-device.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input sub-devices

  • ME-9x Description
  • Using the ME-iDS API with the ME-9x boards.

Digital input sub-devices

Digital input sub-devices

The ports are 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags No flags defined here, use ME_IO_RESET_SUBDEVICE_NO_FLAGS

meIOSingleConfig

  • iChannel: Must be 0.

  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT.

  • iRef: Not required here, use ME_VALUE_NOT_USED.

  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.

  • iTrigType: Not required here, use ME_VALUE_NOT_USED.

  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.

  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

Since all settings are fixed here, it is not necessary to call meIOSingleConfig at all before reading from the sub-device.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT.
  • iValue:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.
  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital output sub-device

  • ME-9x Description
  • Using the ME-iDS API with the ME-9x boards.

Digital output sub-device

Digital output sub-device

The port is 8 bits wide.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function initializes the port with the value FF (all bits 1).

meIOSingleConfig

  • iChannel: Must be 0.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_CONFIG_DIO_BYTE.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 7 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the port value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_BIT or ME_IO_SINGLE_TYPE_DIO_BYTE.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: MEphistoScope Description

MEphistoScope Description

MEphistoScope Description - Contents:

  • Device types.
    • MEphisto Scope 1
  • Special features.
    • Digital input/output sub-device
    • Analog input sub-device
  • Using the ME-iDS API with a MEphistoScope device.
    • Digital input/output sub-devices.
      • meIOResetSubdevice.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
    • Analog input sub-device.
      • meIOResetSubdevice.
      • meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo.
      • meQuerySubdeviceCaps.
      • meIOSingleConfig.
      • meIOSingle.
      • meIOStreamFrequencyToTicks and meIOStreamTimeToTicks.
      • meIOSetChannelOffset.
      • meIOStreamConfig.
      • meIOStreamStart.
      • meIOStreamRead.
      • meIOStreamStatus.
      • meIOStreamStop.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Device Types

  • MEphistoScope Description

Device Types

MEphistoScope Device Types

The MephistoScope device exists in the following varieties:

MEphisto Scope 1

2 sub-devices

  • 0: Digital Input/Output sub-device - 24 bits wide
  • 1: Analog input sub-device - 2 channels, streaming.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Special features and restrictions.

  • MEphistoScope Description

Special features and restrictions.

MEphistoScope Special features and restrictions.

For a demonstration of how to use the special features of the MEphistoScope in streaming mode, please see the sorce code of the sample program 'Con_meIOMEphistoScopeStreamRead' (Con_meIOMEphistoScopeStreamRead C++ Testprogram) included in the SDK.

  • Using the function meIOSetChannelOffset the anlog input ranges can be adjusted, this makes it possible to measure an incoming potential very accurately if you know roughly in advance the minimum and maximum values which are likely to occur.

    This only applies to streaming mode, in single mode the ranges have a fixed offset of 0.0 V.

    If you do use 'meIOSetChannelOffset' to change an offset range for a streaming operation then you must adjust the final result accordingly by adding this same offset.

  • In contrast to all other ME-iDS devices, the MEphistoScope can only be used by one application at a time.

    If one or more MEphistoScopes are present in a system, then the first application using the ME-iDS which is started will 'see' these in a listing of all devices. As long as this first application is running, the MEphistoScope devices will be invisible to subsequent applications and cannot be addressed by them.

    Only when the first application is terminated will the MEphistoScope devices be visible to the next ME-iDS application which starts.

  • The digital input/output sub-device (sub-device 0) and the analog input sub-device (sub-device 1) are not completely independent of one another. If a streaming operation is running on the analog sub-device, then an attempt to use the digital input/output sub-device will cause an error (sub-device busy, error 33).

    During any other operation on one of the sub-devices, any other thread trying to use either of the sub-devices will be queued and will only gain accesss to the sub-device after the first operation has terminated.

  • In single mode the result returned on calling 'meIoSingle' is the average of a large number of measurements taken over a period of approximately 0.9 seconds. During this period, any other thread trying to use either sub-device will be queued as explained above.

The sub-devices on the MEphistoScope devices posess the following special features:

Digital input/output sub-device

  • This sub-device is 24 bits wide, but the direction (input/output) of each single bit can be selected individually.

    By calling meIOSingleConfig with 'iFlags' = ME_IO_SINGLE_CONFIG_DIO_BIT, the direction of a single bit (in this case 'iChannel' 0 - 23, is the bit number) can be changed ('iSingleConfig' = ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT).

    If 'iFlags' is ME_IO_SINGLE_CONFIG_DIO_BYTE then the direction of bits 0 to 7 ('iChannel' = 0), of bits 8 to 15 ('iChannel' = 1) or of bits 16 to 23 ('iChannel' = 2) is changed.

    If 'iFlags' is ME_IO_SINGLE_CONFIG_DIO_WORD then the direction of bits 0 to 15 ('iChannel' = 0) or of bits 16 to 23 ('iChannel' = 1) is changed.

    If 'iFlags' is ME_IO_SINGLE_CONFIG_DIO_DWORD then the direction of all 24 bits is changed at once.

Analog input sub-device

  • In streaming mode the MEphistoScope can either acquire analog values from one or both of the two analog input channels or digital values from the 16-bit digital port which is otherwise used for sub-device 0.

    To aquire digital values, use 'iFlags' = ME_IO_STREAM_CONFIG_BIT_PATTERN on calling meIOStreamConfig, to acquire analog values use 'iFlags' = ME_IO_STREAM_CONFIG_NO_FLAGS.
  • In streaming mode the MEphistoScope can either acquire aquire data continuously until the acquisition is terminated by the user (data-logging mode) or a pre-determined number of data can be sampled (oscilloscope mode). In this latter case, a pre-trigger can be defined as a percentage of the total number of data samples to acquire.

    • To use the oscilloscope mode, set 'pTrigger->iScanStopTrigType' = ME_TRIG_TYPE_COUNT on calling meIOStreamConfig.

      In this case, 'pTrigger->iScanStopCount' is the number of samples to acquire per channel. The maximum value here is 131000 when acquiring analog values, or 262000 when acquiring digital values.

    • To use 'normal', continuous mode (data-logging) set 'pTrigger->iScanStopTrigType' = ME_TRIG_TYPE_NONE.
  • Every combination of the above two options is allowed, analog data-logging, analog oscilloscope, digital data-logging or digital oscilloscope.

For further details see meIOStreamConfig.

  • When used to acquire analog values, the MEphistoScope supports the following trigger types in streaming mode:

    • Trigger immediately on calling meIOStreamStart.

    • Trigger when above or below a user-defined analog threshold.

    • Trigger on entering or leaving a user-defined analog window.

    • Trigger on crossing a user-defined analog threshold.

    • Trigger when the slope of the analog signal exceeds a user-defined absolute value.

    • Trigger on the rising or falling edge of an external digital signal.
  • When used to acquire digital values, the MEphistoScope supports the following trigger types in streaming:

    • Trigger immediately on calling meIOStreamStart..

    • Trigger on the rising or falling edge of an external digital signal..

    • Trigger when the lower 8 bits of the incoming digital signal match a user defined pattern..

For further details see meIOStreamConfig and the MEhistoScope manual.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Using the ME-iDS API with the MEphistoScope.

  • MEphistoScope Description

Using the ME-iDS API with the MEphistoScope.

Using the ME-iDS API with the MEphistoScope.

  • Digital input/output sub-devices.
  • Analog input sub-device.


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Digital input/output sub-devices

  • MEphistoScope Description
  • Using the ME-iDS API with the MEphistoScope.

Digital input/output sub-devices

Digital input/output sub-devices

The port is 24 bits wide. The direction of each bit (input or output) can be chosen individually.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function configures all 24 bits of the sub-device for input.

meQuerySubdeviceCaps

This function returns a combination of the constants ME_CAPS_DIO_DIR_BIT, ME_CAPS_DIO_DIR_BYTE, ME_CAPS_DIO_DIR_WORD and ME_CAPS_DIO_DIR_DWORD ORed together for 'piCaps'.

This means that the port direction can be changed bit-wise, byte-wise, word-wise or double word wise (all 24 bits at once). See meIOSingleConfig, parameter 'iFlags' below.

meIOSingleConfig

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_CONFIG_DIO_DWORD then iChannel must be 0.

      All 24 bits are set to input or output depending on the value used for iSingleConfig below.

    • If 'iFlags' (see below) is ME_IO_SINGLE_CONFIG_DIO_WORD then iChannel must be 0 or 1.

      If iChannel is 0 then the lower 16 bits (0 to 15) are set to input or output depending on the value used for iSingleConfig below.

      If iChannel is 1 then the upper 8 bits (16 to 23) are set to input or output depending on the value used for iSingleConfig below.

    • If 'iFlags' (see below) is ME_IO_SINGLE_CONFIG_DIO_BYTE then iChannel must be 0, 1 or 2.

      If iChannel is 0 then the lower 8 bits (0 to 7) are set to input or output depending on the value used for iSingleConfig below.

      If iChannel is 1 then the middle 8 bits (8 to 15) are set to input or output depending on the value used for iSingleConfig below.

      If iChannel is 2 then the upper 8 bits (16 to 23) are set to input or output depending on the value used for iSingleConfig below.

    • If 'iFlags' is ME_IO_SINGLE_CONFIG_DIO_BIT then iChannel must be between 0 and 23 (bit number). The corresponding bit is set to input or output depending on the value used for iSingleConfig below.
  • iSingleConfig: Must be ME_SINGLE_CONFIG_DIO_INPUT or ME_SINGLE_CONFIG_DIO_OUTPUT.
  • iRef: Not required here, use ME_VALUE_NOT_USED.
  • iTrigChan: Not required here, use ME_VALUE_NOT_USED.
  • iTrigType: Not required here, use ME_VALUE_NOT_USED.
  • iTrigEdge: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: ME_IO_SINGLE_CONFIG_DIO_DWORD, ME_IO_SINGLE_CONFIG_DIO_WORD, ME_IO_SINGLE_CONFIG_DIO_BYTE or ME_IO_SINGLE_CONFIG_DIO_BIT.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel:

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD then iChannel must be 0.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD then iChannel must be 0 or 1.

    • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE then iChannel must be 0, 1 or 2.

    • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then iChannel must be between 0 and 23 (bit number).
  • iDir: Must be ME_DIR_INPUT or ME_DIR_OUTPUT.
  • iValue:

    • If 'iDir' (see above) is ME_DIR_INPUT then the value read from the port will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD the port value between Hex 0 and Hex FFFFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD the word value between Hex 0 and Hex FFFF will be returned here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE the byte value between Hex 0 and Hex FF will be returned here.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then the bit value 0 or 1 will be returned here.

    • If 'iDir' (see above) is ME_DIR_OUTPUT then the value to be written to the port should be placed here.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_DWORD this should be a value between Hex 0 and Hex FFFFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_WORD this should be a value between Hex 0 and Hex FFFF.

      • If 'iFlags' (see below) is ME_IO_SINGLE_TYPE_DIO_BYTE this should be a value between Hex 0 and Hex FF.

      • If 'iFlags' is ME_IO_SINGLE_TYPE_DIO_BIT then this should be 0 or 1 (bit value).

  • iTimeOut: Not required here, use ME_VALUE_NOT_USED.
  • iFlags: Must be ME_IO_SINGLE_TYPE_DIO_DWORD, ME_IO_SINGLE_TYPE_DIO_WORD, ME_IO_SINGLE_TYPE_DIO_BYTE or ME_IO_SINGLE_TYPE_DIO_BIT


Meilhaus Electronic - Intelligent Driver System (ME-iDS) for Windows: Analog input sub-device

  • MEphistoScope Description
  • Using the ME-iDS API with the MEphistoScope.

Analog input sub-device

Analog input sub-device

The analog input sub-device, which can be used in single and streaming mode, has 2 channels.

The following API functions are supported for this sub-device:

meIOResetSubdevice

  • iFlags: No flags defined here - Use ME_IO_RESET_SUBDEVICE_NO_FLAGS

This function immediately terminates any streaming operation which may be running. The channels are configured for single mode using the range with the largest amplitude and an offset of 0 Volts (-10V - +10V).

meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo

Seven ranges are supported. If the offset is 0 Volts (see meIOSetChannelOffset) then these ranges are as follows:

  • 0: Physical range: -0.1V - +0.1V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 1: Physical range: -0.25V - +0.25V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 2: Physical range: -0.5V - +0.5V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 3: Physical range: -1.0V - +1.0V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 4: Physical range: -2.5V - +2.5
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 5: Physical range: -5.0V - +5.0V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

  • 6: Physical range: -10.0V - +10.0V
    Digital range: 0 - 65535 (Hex FFFF) - 16 Bit resolution

The meQueryRange... functions return the information corresponding to an offset of 0 Volts.

meQuerySubdeviceCaps

This function returns 0 for 'piCaps'.

meIOSingleConfig

  • iChannel: The channel index: 0 or 1.
  • iSingleConfig: The range index (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

    /note The range is always used with offset 0.0 in single mode.
  • iRef: Must be ME_REF_AI_GROUND.
  • iTrigChan: Must be ME_TRIG_CHAN_DEFAULT.
  • iTrigType: Must be ME_TRIG_TYPE_SW.
  • iTrigEdge: Must be ME_VALUE_NOT_USED.
  • iFlags: No flags defined here, use ME_IO_SINGLE_CONFIG_NO_FLAGS.
Note:
After the device has been reset (see meIOResetSubdevice), and in particular on restarting the system, both channels are configured to range 6, -10.0V to +10.0V.

meIOSingle

The parameters in the structure meIOSingle for this sub-device should be as follows:

  • iChannel: The channel index: 0 or 1.
  • iDir: Must be ME_DIR_INPUT.
  • iValue: The current digital value of the channel is returned here.
    Use the utility function meUtilityDigitalToPhysical to convert the digital value to volts.
  • iTimeOut: Not required here, should be 0.
  • iFlags: No flags defined here - Use ME_IO_SINGLE_TYPE_NO_FLAGS

meIOStreamFrequencyToTicks and meIOStreamTimeToTicks

The analog input sub-device on the MEphistoScope has an internal timer with a basic frequency of 1 MHz

The minimum number of ticks which can be used here is 1 in oscilloscope mode which corresponding to a frequency of 1 MHz (analog or digital) and 10 in data-logging mode corresponding to a frequency of 100 kHz (analog or digital).

At frequencies lower than 100 Hz (10000 ticks), only multiples of 10000 ticks can be used, sampling takes place internally at 100 Hz and the result passed to the user is the average of several individual measurements.

These routines always return the number of ticks which is required to achieve the next higher possible frequency (meIOStreamFrequencyToTicks) or the next lower possible sampling time (meIOStreamTimeToTicks) unless the frequency or sampling time required lies outside the board's range, in which case the number of ticks is returned which will achieve the minimum/maximum possible frequency/sampling time.

  • iTimer: Must be ME_TIMER_CONV_START.
  • pdFrequency/pdTime: Pointer to a variable containing the frequency or sampling time required.

    On returning from the function this variable contains the frequency or sampling time which would be attained with the returned tick values.
  • iFlags: Use ME_IO_FREQUENCY_TO_TICKS_NO_FLAGS/ME_IO_TIME_TO_TICKS_NO_FLAGS here if you intend using the sub-device in data-logging mode (see meIOStreamConfig)

    Use ME_IO_FREQUENCY_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE/ME_IO_TIME_TO_TICKS_MEPHISTO_SCOPE_OSCILLOSCOPE here if you intend using the sub-device in oscilloscope mode (see meIOStreamConfig)

meIOSetChannelOffset

  • iChannel: The index 0 or 1 of the channel whose offset is to be adjusted.
  • iRange: The index of the range, 0 to 6 (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.
  • pdOffset: Pointer to a variable containing the required offset in volts.

    On returning from the function this variable contains the offset which will actually be used.
  • iFlags: No flags defined here, use ME_IO_SET_CHANNEL_OFFSET_NO_FLAGS

Note:
After the device has been reset ( see meIOResetSubdevice ), the offset for both channels and for all ranges is set to 0.

This routine only changes the range offset for streaming operations. In single mode the offset is always 0.0.

meIOStreamConfig

  • pConfigList: If the parameter 'iFlags' used to call this function is 'ME_IO_STREAM_CONFIG_BIT_PATTERN' (digital acquisition) then this parameter and the following parameter ''iCount' are ignored

    Otherwise (analog acquisition), this is a pointer to a list of 'iCount' meIOStreamConfig structures containing the configuration for the individual channels.
    In this case, the elements of this list should be configured as follows:

    • iChannel: 0 or 1.

    • iSingleConfig: The range index 0 to 6, (see meQueryNumberRanges, meQueryRangeByMinMax and meQueryRangeInfo) which is to be used for the acquisition.

    • iRef: Must be ME_REF_AI_GROUND.

    • iFlags: No flags defined here - Use ME_IO_STREAM_CONFIG_TYPE_NO_FLAGS

  • iCount: The number of elements in the list 'pConfigList' above.

    A maximum of 2 elements is allowed.
  • pTrigger: This is a pointer to a meIOStreamTrigger structure which determines the way in which the acquisition is started, the way in which it proceeds once started and the way in which it is terminated.

    Any elements in this structure which are not specifically used or mentioned here should be set to 0. The simplest approach is to zero out the entire structure before setting any required elements.

    • iAcqStartTrigType:

      For an analog acquisition, ('iFlags' below is ME_IO_STREAM_CONFIG_NO_FLAGS), this must be one of the constants ME_TRIG_TYPE_SW, ME_TRIG_TYPE_THRESHOLD, ME_TRIG_TYPE_WINDOW, ME_TRIG_TYPE_EDGE, ME_TRIG_TYPE_SLOPE or ME_TRIG_TYPE_EXT_DIGITAL.

      For a digital acquisition, ('iFlags' below is ME_IO_STREAM_CONFIG_BIT_PATTERN), this must be one of the constants, ME_TRIG_TYPE_SW, ME_TRIG_TYPE_EXT_DIGITAL or ME_TRIG_TYPE_PATTERN.

    • iAcqStartTrigEdge:

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_THRESHOLD, then this should be ME_TRIG_EDGE_ABOVE or ME_TRIG_EDGE_BELOW.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_WINDOW, then this should be ME_TRIG_EDGE_ENTRY or ME_TRIG_EDGE_EXIT.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_EDGE, ME_TRIG_TYPE_SLOPE or ME_TRIG_TYPE_EXT_DIGITAL then this should be ME_TRIG_EDGE_RISING or ME_TRIG_EDGE_FALLING.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_SW or ME_TRIG_TYPE_PATTERN then this parameter is not required and should be zero.

    • iAcqStartTrigChan:

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_THRESHOLD, ME_TRIG_TYPE_WINDOW, ME_TRIG_TYPE_EDGE or ME_TRIG_TYPE_SLOPE, then this is the index of the analog channel used to trigger the acquisition and should be 0 or 1.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_PATTERN, then this is the bit pattern which defines the trigger conditions (please see the MEphistoScope manual for details).

      For other values of 'iAcqStartTrigType', this parameter is not used and should be 0.

    • iAcqStartTicksLow and iAcqStartTicksHigh: Not required here, should be 0.

    • iAcqStartArgs[0]:

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_THRESHOLD, then this is the threshold value in microvolts.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_WINDOW, then this is the upper limit of the window in microvolts.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_EDGE, then this is the level in microvolts which must be crossed.

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_SLOPE, then this is the slope in microvolts per sample which must be exceeded.

      In the above cases, on returning from meIOStreamConfig the actual trigger value used is returned here.

      For other values of 'iAcqStartTrigType', this parameter is not used and should be 0.

    • iAcqStartArgs[1]:

      If 'iAcqStartTrigType' above is ME_TRIG_TYPE_WINDOW, then this is the lower limit of the window in microvolts.
      On returning from meIOStreamConfig the actual lower limit used is returned here.

      For all other values of 'iAcqStartTrigType', this parameter is not used and should be 0.

    • iScanStartTrigType: Must be ME_TRIG_TYPE_FOLLOW.

    • iScanStartTicksLow and iScanStartTicksHigh: Not required here, should be 0.

    • iConvStartTrigType: Must be ME_TRIG_TYPE_TIMER.

    • iConvStartTicksLow and iConvStartTicksHigh: Here the values should be used which were returned by a previous call to meIOStreamFrequencyToTicks or meIOStreamTimeToTicks - see meIOStreamFrequencyToTicks and meIOStreamTimeToTicks above.

    • iScanStopTrigType:

      To use the MEphistoScope in oscilloscope mode, set this parameter to ME_TRIG_TYPE_COUNT.

      To use the MEphistoScope in data logging mode, set this parameter to ME_TRIG_TYPE_NONE (0).

    • iScanStopCount:

      If the MEphistoScope is used in oscilloscope mode, then this is the number of data samples to collect for each channel.
      On returning from meIOStreamConfig the number of data samples per channel which will actually be collected is returned here.

      If the MEphistoScope is used in data-logging mode, then this parameter is not required and should be 0.

    • iScanStopArgs[0]:

      If the MEphistoScope is used in oscilloscope mode, then this is the trigger point as a percentage between 0% and 100%.
      On returning from meIOStreamConfig the actual trigger point as a percentage is returned here.

      If the MEphistoScope is used in data-logging mode, then this parameter is not required and should be 0.
  • iFifoIrqThreshold: Not required here, should be 0

  • iFlags: Use ME_IO_STREAM_CONFIG_NO_FLAGS here for an analog data acquisition or ME_IO_STREAM_CONFIG_BIT_PATTERN for a digital data acquisition

meIOStreamStart

The parameters in the structure meIOStreamStart for this sub-device should be as follows:

  • iStartMode: ME_START_MODE_NONBLOCKING or ME_START_MODE_BLOCKING.
  • iTimeOut:

    • If 'iStartMode' above is ME_START_MODE_NONBLOCKING: Not required, should be 0.

    • If 'iStartMode' above is ME_START_MODE_BLOCKING: Enter a value for the time-out in milliseconds here.

      Note:
      If you are using the MEphistoScope in oscilloscope mode, then the time entered here should include any expected delay and the entire time required for the data acquisition.

  • iFlags: No flags defined here - Use ME_IO_STREAM_START_TYPE_NO_FLAGS

meIOStreamRead

  • iReadMode: ME_READ_MODE_BLOCKING or ME_READ_MODE_NONBLOCKING.

  • piValues: Pointer to an array of integers which will contain data from the acquisition after the function returns.

  • piCount:

    Pointer to an integer, which, on entering the function, should contain the size of the array 'piValues' above.
    On returning from the function this contains the number of data values transferred to the buffer 'piValues'.

  • iFlags: ME_IO_STREAM_READ_NO_FLAGS or ME_IO_STREAM_READ_FRAMES.

Note:
If you are using the MEphistoScope in oscilloscope mode, then you should call meIOStreamRead with 'iReadMode' = ME_READ_MODE_BLOCKING immediately after starting the acquisition and with a buffer 'piValues' large enough to contain all the acquired data.

meIOStreamStatus

  • iWait: ME_WAIT_NONE or ME_WAIT_IDLE.

  • piStatus:

    Pointer to an integer which contains the status (ME_STATUS_IDLE, ME_STATUS_BUSY or ME_STATUS_ERROR) on returning from the function.

  • piCount:

    Pointer to an integer which, on returning from the function, contains the number of data values currently awaiting collection using meIOStreamRead.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STATUS_NO_FLAGS.

meIOStreamStop

The parameters in the structure meIOStreamStop for this sub-device should be as follows:

  • iStopMode: ME_STOP_MODE_IMMEDIATE.

  • iFlags: No flags defined here - Use ME_IO_STREAM_STOP_TYPE_NO_FLAGS.