Valve Library


This valve library defines a common valve control interface for a range of different valve types such as e.g. rotation valves, switch valves or pinch valves.


The way how you include the library functions in your own windows program, depends on the compiler and on the programming language you use. In order to access the valve API, you have to include the library labbCAN_Valve_API.dll to your programming environment. You have to copy this file to the working directory of your system or to the application directory that contains your application EXE file. Use the calling convention LCV_CALL for this library. This convention is managing how the parameters are put on the stack and who is responsible to clean the stack after the function execution.

The interface of the library, constant definitions and declarations of the library functions, is defined in the header file interface/labbCAN_Valve_API.h

Valve API Usage

Retrieve device handle

To work with a valve, you need a valid device handle. A device handle is simply an opaque pointer to the internal device object created by the labbCAN environment. So the first thing you need do to is obtaining a valid device handle.

You can get a valid valve handle with the functions LCV_LookupValveByName() or LCV_GetValveHandle():

dev_hdl ValveHandle;
Result = LCV_LookupValveByName("Nemesys1_Valve", &ValveHandle);
dev_hdl ValveHandle2;
Result = LCV_GetValveHandle(1, &ValveHandle2);
You can get the valve names from the device configuration files (see Device Configuration Files)

Switching valve

Each valve position is identified by a logical valve position identifier from 0 - number of valve positions - 1. To switch the valve to a certain valve position, you simply call LCV_SwitchValveToPosition() with a valid logical valve position index. The following example switches the valve identified by valve handle hValve1 to the logical valve position 2.

long Result = LCV_SwitchValveToPosition(hValve1, 2);

Reading actual valve position

You can easily query the actual valve position with the function LCV_ActualValvePosition().

long ActualValvePosition = LCV_ActualValvePosition(hValve1);


See the labbCAN Valve API module for a detailed reference of all valve control and status functions.

Programming Interface - API

See the labbCAN Valve API module for a detailed reference of the valve library application programming interface