GtDio6xChannelSetMode

Applies To

GX5296, GX5961, GX5964, File

Purpose

Sets the channel mode.

Syntax

GtDio6xChannelSetMode (nHandle, lChannelListArraySize, palChannelListArray, nMode, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Session identifier:

     Board handle is used when communicating with the hardware. The Board handle session identifier is returned by calling GtDio6xInitialize or GtDio6xSetupInitialization.

     File handle is used when communicating with a file. The File handle session identifier is  returned by calling GtDio6xFileOpen.

lChannelListArraySize
LONG
Used to specify the number of channels to set. This parameter should not be greater than the size of palChannelListArray. If GTDIO6X_ALL_DOMAIN is passed in, then the palChannelListArray parameter can be set to NULL and the settings will be applied to all channels in the Domain.
palChannelListArrary
PLONG
Array containing channels numbers that will be set by this function, channels numbers are 0-based and refers to any channel in the Domain. Auxiliary channel numbers begin with 1000.
GX5296: Each GX5296 board has 4 auxiliary channels that support all the Pin Electronics API functions.
GX5961: Each GX5961 board has 4 fully programmable auxiliary channels, and 8 TTL I/O channels. First 4 auxiliary channels may use all the Pin Electronics API.
GX5964: Does not have Auxiliary channels.
nMode
SHORT
Used to set the channel mode:

0.    GTDIO6X_CHANNEL_MODE_DYNAMIC_IO: Normal sequencer-controlled mode used when outputting vectors dynamically. Output voltage levels will be set according to the GtDio6xChannelSetSourceLevels API.

1.    GTDIO6X_CHANNEL_MODE_DISABLED: Disable pin electronics.

2.    GTDIO6X_CHANNEL_MODE_OUTPUT_LOW: Force a static logic low level on the output. The output voltage level low will be set according to the GtDio6xChannelSetSourceLevels API.

3.    GTDIO6X_CHANNEL_MODE_OUTPUT_HIGH: Force a static logic high level on the output. The output voltage level high will be set according to the GtDio6xChannelSetSourceLevels API.

4.    GTDIO6X_CHANNEL_MODE_PMU_FORCE_CURRENT: Force a current in PMU mode. The force current will be set according to the GtDio6xChannelSetPmuForcedCurrentAPI.

5.    GTDIO6X_CHANNEL_MODE_PMU_FORCE_VOLTAGE: Force a voltage in PMU mode. The force voltage will be set according to the GtDio6xChannelSetPmuForcedVoltageAPI.

pnStatus
PSHORT
Returned status: 0 on success, negative value on failure.

Comments

This function sets a channel into a particular function mode. A channel can function as a dynamic digital I/O where the data sequencer controls its operation, a static level output, or as a parametric measurement unit (PMU). There are two PMU modes that can be selected, Force Voltage and Force Current.

In Forced Voltage mode, the pin electronics attempt to force a certain voltage. The output current limit serves to limit the amount of current the pin electronics will generate in order to generate a given forced voltage.

In Forced Current mode, the pin electronics attempt to force a certain current.

GX5296:

When changing the channel’s mode, the user can keep the current channels voltages and current settings, or to set them all back to the default values (same as values after calling GtDio6xReset() API).

In order to keep voltages and currents settings, the user need to do a binary OR of the following constant,

GTDIO6X_CHANNEL_MODE_KEEP_SETTINGS (0x10), with any of the above channel’s modes (see example below).

The following channel’s settings will be set back to the following default values whenever calling this API without GTDIO6X_CHANNEL_MODE_KEEP_SETTINGS (see example below):

Voltage Out High = 1.0V.

Voltage Out Low = 0.0V.

Input Threshold Voltage High = 1.5V.

Input Threshold Voltage Low = 0.5V.

Current Load Sink = 0.0mA.

Current Load Source = 0.0mA.

Commutating Voltage High = 2.5V.

PMU Drive Voltage = 0.0V.

PMU Current = 0.0mA.

PMU Commutating Voltage High = 2.5V.

PMU Commutating Voltage Low = -1.0V.

Example

The following example does the following:

1.    Sets channels 0, 2 and 3 to dynamic I/O, and not set voltages and currents settings back to default.

2.    Sets channels 10, 12 and 13 to forced cornet I/O, set voltages and currents settings back to default.

3.    Sets channels 20, 22 and 23 to forced voltage I/O, set voltages and currents settings back to default.

4.    Returns channels 0, 10, and 20 mode.

 

SHORT nStatus, nMode;

SHORT alChannelList[3];

 

// Fill the channels array

alChannelList[0]=0;

alChannelList[1]=2;

alChannelList[2]=3;

GtDio6xChannelSetMode(nHandle, 3, alChannelList, GTDIO6X_CHANNEL_MODE_DYNAMIC_IO | GTDIO6X_CHANNEL_MODE_KEEP_SETTINGS , &nStatus);

 

// Fill the channels array

alChannelList[0]=20;

alChannelList[1]=22;

alChannelList[2]=23;

GtDio6xChannelSetMode(nHandle, 3, alChannelList, GTDIO6X_CHANNEL_MODE_PMU_FORCE_VOLTAGE, &nStatus);

 

GtDio6xChannelGetMode(nHandle, 0, &nMode, &nStatus);

GtDio6xChannelGetMode(nHandle, 10, &nMode, &nStatus);

GtDio6xChannelGetMode(nHandle, 20, &nMode, &nStatus);

 

See Also

GtDio6xChannelGetMode, GtDio6xChannelSetSourceLevels, GtDio6xChannelGetSourceLevels, GtDio6xChannelSetPmuForcedVoltage, GtDio6xChannelGetPmuForcedVoltage, GtDio6xChannelSetPmuForcedCurrent,  GtDio6xChannelGetPmuForcedCurrent, GtDio6xGetErrorString