beautypg.com

Software library reference (icalusb.dll), Read port, Write port – Measurement Computing SWITCH User Manual

Page 26: Chapter 4

background image

26

Chapter 4

Software Library Reference (ICalUSB.dll)

The interface library, CbUsb.dll, provides a set of functions that can be called from Microsoft Visual Basic or

Microsoft Visual C/C++, version 6 and earlier. Visual Basic applications need to include the VB module

cbUSB.bas.

This module contains the library function prototypes and unique definitions for interfacing to the

Visual C/C++ applications must include the header file cbUsb.h and the library cbUsb.lib. Like the VB module,

these files provide the interface definition for the library.

Use the library functions to create custom applications that control the Switch & Sense 8. There are no separate

initialization functions in the library. The first call to any of the following functions loads the configuration

information and generates a device list generated. Subsequent calls to any function in the library use the device

list to map the DeviceNum argument to a physical device. The following functions are included in the library.

Read port

long cbUSBDIn (int DeviceNum, int PortNum, int *DataValue)

This function reads any of the board's port values. Use this function to read the state of the isolated inputs, and

to determine the current state of the input filters or the SPDT relays.

Arguments

DeviceNum

A number assigned by IcalUsb to the physical device. By default, if there is only one device in the

system, this number will be (0).

PortNum

The port number to access. Valid entries are defined in the header file CbUsb.h are shown below.

RELAY_PORT (0): Relay settings

ISO_PORT (1): Isolated input state

FILTER_PORT(2): Filter settings

DataValue

Pointer to a user-defined integer variable that will receive the contents of the port on return.

Return values

CBUSB_SUCCESS (0)

Call completed successfully.

Write port

long cbUSBDOut (int DeviceNum, int PortNum, int DataValue);

This function writes to any of the valid output ports of the USB-PDISO8. The primary use is to set the state of

all eight relays or all eight isolated input filters with a single write operation.

Arguments

DeviceNum

A number assigned by IcalUsb to the physical device. By default, if there is only one device in the system,

this number will be (0).

This manual is related to the following products: