Using VXI-Specific Attributes
From Agilent VISA.NET
Using VXI-Specific Attributes
VXI-specific attributes can be useful to determine the state of your VXI system. Attributes are read-only and read/write. Read-only attributes specify things such as the logical address of the VXI device and information about where your VXI device is mapped. This section shows how you might use some of the VXI-specific attributes.
Using the Map Address as a Pointer
The VI_ATTR_WIN_ACCESS read-only attribute specifies how a window can be accessed. You can access a mapped window with the VISA low-level memory functions or with a C pointer if the address is de-referenced. To determine how to access the window, read the VI_ATTR_WIN_ACCESS attribute.
VI_ATTR_WIN_ACCESS Settings
The VI_ATTR_WIN_ACCESS read-only attribute can be set to one of the following:
|
Settings for the VI_ATTR_WIN_ACCESS Attribute |
|
|
Setting |
Description |
|
VI_NMAPPED |
Specifies that the window is not mapped. |
|
VI_USE_OPERS |
Specifies that the window is mapped and you can only use the low-level memory functions to access the data. |
|
VI_DEREF_ADDR |
Specifies that the window is mapped and has a de-referenced address. In this case you can use the low-level memory functions to access the data, or you can use a C pointer. Using a de-referenced C pointer will allow faster access to data. |
Sample: Determining Window Mapping
ViAddr address;
Vi UInt16 access;
ViUInt16 value;
.
.
.
viMapAddress(vi, VI_A16_SPACE, 0x00, 0x04, VI_FALSE,VI_NULL, &address);
viGetAttribute(vi, VI_ATTR_WIN_ACCESS, &access);
.
.
If(access==VI_USE_OPERS) {
viPeek16(vi, (ViAddr)(((ViUInt16 *)address) + 4/sizeof(ViUInt16)), &value)
}else if (access==VI_DEREF_ADDR){
value=*((ViUInt16 *)address+4/sizeof(ViUInt16));
}else if (access==VI_NMAPPED){
return error;
}
.
.
Setting the VXI Trigger Line
The VI_ATTR_TRIG_ID attribute is used to set the VXI trigger line. This attribute is listed under generic attributes and defaults to VI_TRIG_SW (software trigger). To set one of the VXI trigger lines,
set the VI_ATTR_TRIG_ID attribute as follows:
viSetAttribute(vi, VI_ATTR_TRIG_ID, VI_TRIG_TTL0);
The above function sets the VXI trigger line to TTL trigger line 0 (VI_TRIG_TTL0). The following table shows valid VXI trigger lines.
|
VXI Trigger Line |
VI_ATTR_TRIG_ID Value |
|
TTL 0 |
VI_TRIG_TTL0 |
|
TTL 1 |
VI_TRIG_TTL1 |
|
TTL 2 |
VI_TRIG_TTL2 |
|
TTL 3 |
VI_TRIG_TTL3 |
|
TTL 4 |
VI_TRIG_TTL4 |
|
TTL 5 |
VI_TRIG_TTL5 |
|
TTL 6 |
VI_TRIG_TTL6 |
|
TTL 7 |
VI_TRIG_TTL7 |
|
ECL 0 |
VI_TRIG_ECL0 |
|
ECL 1 |
VI_TRIG_ECL1 |
|
Panel In* |
VI_TRIG_PANEL_IN |
*Panel In is an Agilent extension of the VISA specification.
Once you set a VXI trigger line, you can set up an event handler to be called when the trigger line fires. See Using Events and Handlers for more information on setting up an event handler. Once the VI_EVENT_TRIG event is enabled, the VI_ATTR_TRIG_ID becomes a read only attribute and cannot be changed. You must set this attribute prior to enabling event triggers.
The VI_ATTR_TRIG_ID attribute can also be used by viAssertTrigger function to assert software or hardware triggers. If VI_ATTR_TRIG_ID is VI_TRIG_SW, the device is sent a Word Serial Trigger command. If the attribute is any other value, a hardware trigger is sent on the line corresponding to the value of that attribute.