Admin Production ni-theme
Current Publication

Adding and Editing Range Tables

LabWindows/CVI

Adding and Editing Range Tables

Range tables define valid values for attributes. Only ViInt32, ViInt64, and ViReal64 attributes have range tables.

When you invoke the Attribute Editor, it finds all the range tables defined in the source file. It also associates a range table with an attribute when you pass the address of the range table to Ivi_AddAttributeViInt32, Ivi_AddAttributeViInt64, and Ivi_AddAttributeViReal64.

The Attribute Editor does not associate range tables with attribute data types other than ViInt32, ViInt64, and ViReal64. If you pass a variable name for the range table pointer parameter to Ivi_AddAttributeViInt32, Ivi_AddAttributeViInt64, or Ivi_AddAttributeViReal64, the Attribute Editor maintains the association of the attribute with the range table pointer variable name. The Attribute Editor assumes that the parameter is a variable name if you do not precede it with an ampersand (&) and it does not find a range table of that name in the source file.

When you click the Range Tables button in the Edit Driver Attributes dialog box, the Range Tables dialog box appears, as shown in the following figure.

The Range Tables Dialog box contains the following controls:

  • Add Range Table—Adds a new range table. The command launches the Edit Range Table dialog box with default information.
  • Edit Range Table—Edits an existing range table. The command launches the Edit Range Table dialog box for the currently selected range table.
  • Cut—Cuts the range table you selected.
  • Copy—Makes a copy of the range table you selected.
  • Paste—Pastes a duplicate of the range table you cut or copied.
  • Help—Launches LabWindows/CVI Help.

When you select Add Range Table or Edit Range Table, the Edit Range Table dialog box appears, as shown in the following figure.

Enter all the information into the Edit Range Table dialog box that is necessary for the Attribute Editor to generate a definition for the range table in the source file. For a discrete or coerced range table, enter help text and an actual numeric value for each table entry. Instrument driver users view the help text and actual values in the Select Attribute Constant dialog box they launch in the Get/Set/CheckAttribute function panels. The Attribute Editor also uses the actual values when generating #define statements in the driver header file for previously undefined constant names. You specify in the table names Discrete Value or Coerced Value fields of table entries.

The Edit Range Table Dialog box contains the following fields:

  • Range Table Name—Specifies the range table name in the source code.
  • Data Type—For each entry of a discrete or coerced range table, select the data type for the Actual Value control. Range tables always store entries with ViReal64 values. The Attribute Editor uses the data type to give you the correct type of numeric control for the actual values and to write the actual values to the .h and .sub files in the correct format. The data type you select must match the attribute data types you associate with the range table.
  • Table Type—Select from Discrete, Ranged, or Coerced. When you switch table types, some controls on the dialog box change. Coerced and discrete tables are the most common. When you use a ranged range table, you typically create only one entry in the table.
  • Has Minimum—Specifies whether the range table contains a minimum value. This control appears only when the Table Type is Coerced or Ranged. For a coerced range table, the minimum value represents the minimum coerced value.
  • Has Maximum—Specifies whether the range table contains a maximum value. This control appears only when the Table Type is Coerced or Ranged. For a coerced range table, the minimum value represents the maximum coerced value.
  • Display In Hex—Specifies whether to display the actual values in hexadecimal in the Select Attribute Constant dialog box that users can invoke in the Get/Set/CheckAttribute function panels. When the data type is ViReal64, this control is dim in the Select Attribute Editor dialog box.
  • Custom Information—Specifies the contents of the customInfo field of the range table structure. If you do not want to use the customInfo field, enter VI_NULL. Otherwise, enter a string surrounded by double quotes.
  • Entries—Contains the contents of each range table entry in a list box. The columns that appear depend on the type of range table. When you select an entry in the list box, its contents appear in the controls that are below the list box. To add new entries to the range table, click the New Above and New Below buttons to the right of the list box, or press <Enter> in the Command Value control.
  • New Above—Creates a new range table entry above the range table entry you selected.
  • New Below—Creates a new range table entry below the range table entry you selected.
  • Cut—Cuts the range table entry you selected.
  • Copy—Makes a copy of the range table entry you selected.
  • Paste—Pastes a duplicate of the range table entry you cut or copied.
  • Minimum Value—Specify the minimum value for the currently selected range table entry. This control appears only when the Table Type is Coerced or Ranged. Specify a text entry so that you can enter a defined constant, literal value, or expression. The Attribute Editor stores the contents of this control in the discreteOrMinValue field of the IviRangeTableEntry structure. Press <F4> to insert PREFIX_VAL_ at the beginning of the text in the control. Press <Enter> to display a list of all defined constants in the driver header file that begin with PREFIX_VAL_.
  • Maximum Value—Specify the maximum value for the currently selected range table entry. This control appears only when the Table Type is Coerced or Ranged. Specify a text entry so that you can enter a defined constant, literal value, or expression. The Attribute Editor stores the contents of this control in the maxValue field of the IviRangeTableEntry structure. Press <F4> to insert PREFIX_VAL_ at the beginning of the text in the control. Press <Enter> to display a list of all defined constants in the driver header file that begin with PREFIX_VAL_.
  • Coerced Value—Specify the coerced value for the currently selected range table entry. This control appears only when the Table Type is Coerced. Specify a text entry so that you can enter a defined constant, literal value, or expression. The Attribute Editor stores the contents of this control in the coercedValue field of the IviRangeTableEntry structure. Press <F4> to insert PREFIX_VAL_ at the beginning of the text in the control. Press <Enter> to display a list of all defined constants in the driver header file that begin with PREFIX_VAL_.
  • Discrete Value—Specify the discrete value for the currently selected range table entry. This control appears only when the Table Type is Discrete. Specify a text entry so that you can enter a defined constant, literal value, or expression. The Attribute Editor stores the contents of this control in the discreteOrMinValue field of the IviRangeTableEntry structure. Press <F4> to insert PREFIX_VAL_ at the beginning of the text in the control. Press <Enter> to display a list of all defined constants in the driver header file that begin with PREFIX_VAL_.
  • Actual Value—Specify the actual numeric value of the expression you enter in the Coerced Value or Discrete Value control. This control appears only when the Table Type is Coerced or Discrete. Instrument driver users view the actual value in the Select Attribute Constant dialog box that they launch in the Get/Set/CheckAttribute function panels. The Attribute Editor stores this value in the .sub file and, in some cases, the header file for the driver.
  • Command String—Specify the command string you use to set the instrument to the value that the currently selected range table entry defines. Enter a string surrounded by double quotes, a defined constant name for a string, an empty string, or VI_NULL. The Attribute Editor stores the contents of this control in the cmdString field of the IviRangeTableEntry structure.
  • Command Value—Specify the value to write to a register-based device to set the instrument to the value that the currently selected range table entry defines. Enter a literal integer value or a defined constant. The Attribute Editor stores the contents of this control in the cmdValue field of the IviRangeTableEntry structure. Press <Enter> to add a new row below the current entry in the range table.
  • Help Text—Contains the help text for the currently selected range table entry. Instrument driver users view the help text in the Select Attribute Constant dialog box that they invoke in the Get/Set/CheckAttribute function panels. The Attribute Editor stores the contents of this control in the driver .sub file.
  • Help—Launches LabWindows/CVI Help.
    Note Note  If you define range tables directly in the driver source code, you still must use the Edit Range Table dialog box to specify the actual values and help text for each table entry. The Attribute Editor saves this information in the.sub file.