SetRangeTableEntry

IVI Library

Ivi_SetRangeTableEntry

Usage

ViStatus Ivi_SetRangeTableEntry(IviRangeTablePtr rangeTable, ViInt32 index, ViReal64 discreteOrMinValue, ViReal64 maxValue, ViReal64 coercedValue, ViChar cmdString[ ], ViInt32 cmdValue);

Purpose

This function configures the values in a range table entry. To set the terminating entry, call Ivi_SetRangeTableEnd.

Parameters

Name Type Description
rangeTable IviRangeTablePtr

Pass the range table pointer you obtain from Ivi_RangeTableNew.

index ViInt32

Pass the 0-based index of the range table entry you want to configure. For example, if you specify 10 entries when you call Ivi_RangeTableNew, you can call Ivi_SetRangeTableEntry with indexes 0 through 8. The termination entry is at index 9, unless you place it at a lower index using Ivi_SetRangeTableEnd.

If you call Ivi_SetRangeTableEnd to change the location of the termination entry, the index parameter to Ivi_SetRangeTableEntry must be less than the index of the termination entry.

discreteOrMinValue ViReal64

Pass the value you want to assign to the discreteOrMinValue field of the entry. Refer to the help for the Type Of Table parameter to Ivi_RangeTableNew for a discussion of how this field is used under the different range table types.

maxValue ViReal64

Pass the value you want to assign to the maxValue field of the entry. Refer to the help for the Type Of Table parameter to Ivi_RangeTableNew for a discussion of how this field is used under the different range table types. Discrete tables do not use this field.

coercedValue ViReal64

Pass the value you want to assign to the coercedValue field of the entry. Refer to the help for the Type Of Table parameter to Ivi_RangeTableNew for a discussion of how this field is used under the different range table types. Discrete and ranged tables do not use this field.

cmdString ViChar[ ]

Specify the string you want to assign to the cmdString field of the range table entry. The cmdString field is optional. You can use it to hold the command string that the write callback sends to the instrument when you set the attribute to the value or range of values that the range table entry defines.

If you do not want to associate a command string with the range table entry, pass VI_NULL.

If you want to dynamically allocate the command strings, call Ivi_Alloc. Pass the pointer you obtain from Ivi_Alloc for this parameter. If you call Ivi_RangeTableFree to deallocate the range table, you can request that it call Ivi_Free on each non-NULL command string in the table.

cmdValue ViInt32

Specify the integer value you want to assign to the cmdValue field of the range table entry. The cmdValue field is optional.

For a register-based instrument, you can use the cmdValue field to store the register value that the write callback sends to the instrument when you set the attribute to the value or range of values that the range table entry defines.

For a message-based instrument, you can use the cmdValue field to hold a value that the attribute write callback formats into an instrument command string. You can use the customInfo field of the IviRangeTable structure to store the format string for the instrument command.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes