LoggerSetChannelSetting


Function

Set channel information for the specified channel number.

Format

Ret = LoggerSetChannelSetting ( AppId , InputType , SequenceNum , ChannelNo , ChannelName , Range )

Parameters

AppId [ VB.NET: Short ] [ C++: short ] [ C#: short ] 

Specify Application ID retrieved by LoggerOpenApplication.

InputType [ VB.NET: UShort ] [ C++: unsigned short ] [ C#: ushort ]

Specify the input method.

Value

[Dec]

Macro

Description

0

LOGGER_PARAM_SINGLEENDED

Single End

1

LOGGER_PARAM_DIFFERENTIAL

Differential

SequenceNum [ VB.NET: UShort ] [ C++: unsigned short ] [ C#: ushort ]

Specify the sequence number used for analog input.

The configurable range is from 1 to the maximum channel number which depends on the device.
For more information, see "The specification for each device" item in Supported Devices topic.

ChannelNo [ VB.NET: UShort() ] [ C++: unsigned short * ] [ C#: ref ushort[] ]

Specify the channel number to use for analog input.

ChannelName [ VB.NET: Byte() ] [ C++: char *] [ C#: ref byte[] ]

Specify the channel name.
Please refer "Note of Using Visual Basic .NET" to know the way to convert a string variable to a Byte array on Visual Basic .NET.
Please refer "Note of Using Visual C#" to know the way to convert a string variable to a Byte array on Visual C#.

Range [ VB.NET: UShort ] [ C++: unsigned short *] [ C#: ref ushort ]

Specify the address where the analog input range is stored.

 

Value

Macro

Description

0

PM10

-10 to 10V

1

PM5

-5 to 5V

2

PM25

-2.5 to 2.5V

3

PM125

-1.25 to 1.25V

50

P10

0 to 10V

51

P5

0 to 5V

53

P25

0 to 2.5V

54

P125

0 to 1.25V

100

P20MA

0 to 20mA

101

P4TO20MA

4 to 20mA

102

PM20MA

-20 to 20mA

150

P1TO5

1 to 5V

 

Return Value

Ret [ VB.NET: Integer ] [ C++: long ] [ C#: int ]

Definition

Return code

[Dec]

Description

LOGGER_ERR_SUCCESS

0

Normal completed

LOGGER_ERR_STARTED

10006

Cannot execute because the device is in operation.

LOGGER_ERR_INVALID_ID

10010

Invalid AppId was specified.

LOGGER_ERR_SEQUENCE_NUM

20002

The number of sequence is out of the configurable range.

LOGGER_ERR_CHANNEL_NO

20003

The channel number is out of the configurable range.

LOGGER_ERR_INPUTMETHOD

20004

The input method is out of the configurable range.

LOGGER_ERR_SEQUENCE_NO

20006

The sequence number is out of the configurable range. (more than the specified number of channels)

LOGGER_ERR_SEQUENCE_FUNCTION

20007

The specified device does not have sequencing capability.

LOGGER_ERR_CHANNEL_NAME

20008

The channel name is out of the configurable range. (characters too long, etc.)

LOGGER_ERR_RANGE

20009

Range is out of the settable range.

The others (See also: Error Code List)

Initial Value

None

Remarks

Set the channel information.

You can specify the input method and input range for each channel.

ChannelNo, ChName, and Range are array variables, and you can specify sequence processing.

 

Example:

Sequences are processed in order of the array index from the youngest to the oldest.

Hardware channel number [2,0,1]

Channel name [Channel2, test channel, ch1]

Range [0,1,0]

 

Sequence image for the above settings

Sequence 0: hardware channel 2, channel 2, range ±10V

Sequence 1: hardware channel 0, test channel, range ±5V

Sequence 2: hardware channel 1, ch1, range ±10V

 

Example

For sequence 0, specify the single-end input method, Ch0, channel name "Channel 0," and input range ±10 [V].

VB.NET

Dim Ret As Integer
Dim ChannelNo(0) As UShort
Dim ChannelName(255) As Byte
Dim Range(0) As UShort

Dim Enc As Encoding

 

Enc = System.Text.Encoding.GetEncoding("shift_jis")

 

ChannelNo(0) = 0
ChannelName = Enc.GetBytes("Channel 0")
Range(0) = PM10

Ret = LoggerSetChannelSetting(AppId, LOGGER_PARAM_SINGLEENDED, 0, ChannelNo, ChannelName , Range)

 

C++

long Ret;
unsigned short ChannelNo[1];
char ChannelName[1][256];
unsigned short Range[1];

ChannelNo[0] = 0;
strcpy( "Channel 0", ChannelName[0]);
Range[0] = PM10;
Ret = LoggerSetChannelSetting(AppId, LOGGER_PARAM_SINGLEENDED, 0, &ChannelNo[0] , &ChannelName[0][0] , &Range[0]);

 

C#

int Ret;
ushort[] ChannelNo = new ushort[1];
byte[] ChannelName = new byte[256];
ushort[] Range = new ushort[1];
Encoding Enc;

 

Enc = System.Text.Encoding.GetEncoding("shift_jis");

 

ChannelNo[0] = 0;
ChannelName = Enc.GetBytes("Channel 0");

Range[0] = PM10;

Ret = logger.SetChannelSetting(AppId, LOGGER_PARAM_SINGLEENDED, 0, ref ChannelNo, ref ChannelName[0], ref Range);

 

See Also

LoggerGetChannelSetting