Programming VXI Register-Based Devices
You can use one or more of the following methods to communicate with VXI register-based devices.
-
I-SCPI Interface Programming. Use the SICL iscpi interface and program using SCPI commands. The iscpi interface interprets the SCPI commands and allows direct communication with register-based devices. This method is supported over LAN. Keysight VISA must be installed to use the iscpi interface.
-
Direct Register Programming. Use the
vxi
interface to program directly to the device’s registers with a series of register peeks and pokes. This method can be very time-consuming and difficult. This method is not supported over LAN. -
Compiled SCPI Programming. The Compiled SCPI (C-SCPI) product is a programming language that can be used with SICL to program register-based devices using SCPI commands. Because Compiled SCPI interprets SCPI commands at compile time, Compiled SCPI can be used to achieve high throughput of register-based devices. See the applicable C-SCPI documentation for programming information.
-
Command Module Programming. You can use a Command Module to communicate with VXI devices via GPIB. The Command Module interprets the high-level SCPI commands for register-based instruments and sends low-level commands over the VXIbus backplane to the instruments. See Using SICL with GPIB for details on communicating via a Command Module.
Subtopics are:
- Addressing VXI Register-Based Devices
- Programming Directly to Registers
- Mapping Memory Space for Register-Based Devices
- Reading and Writing Device Registers
- Sample: VXI Register-Based Programming (C)
Addressing VXI Register-Based Devices
To create a device session, specify the interface symbolic name or logical unit and a device’s address in the addr parameter of the iopen function. The interface symbolic name and logical unit are set by running Connection Expert.

There are two methods to launch Connection Expert (CE):
From the Application Finder:
-
Open the Application Finder on your Linux machine.
-
Use any of the following ways to launch Connection Expert:
-
Search for Connection Expert and click to launch the application.
-
Or, search for IO Control and launch it. In the IO Control application, click on the Connection Expert application to it.
-
-
Open your preferred web browser.
-
Enter the URL in the format: https://<IP Address of the machine where IO Libraries Suite is installed>:4211.
For example: https://10.17.68.235:4211.
Functions Not Supported
Because VXI register-based devices do not support the word serial protocol and other features of message-based devices, the following SICL functions are not supported with register-based device sessions unless you use the iscpi interface. All other functions will work with all VXI devices (message-based, register-based, etc.). Use the i?peek and i?poke functions to communicate with register-based devices.
Category |
Functions Not Supported |
Non-formatted I/O |
iread, iwrite, itermchr |
Formatted I/O |
iprintf, iscanf, ipromptf, ifread, ifwrite, iflush, isetbuf, isetubuf |
Device/Interface Control |
iclear, ireadstb, isetstb, itrigger |
Service Requests |
igetonsrq, ionsrq |
Timeouts |
igettimeout, itimeout |
VXI Specific |
ivxiws |
Addressing Guidelines
The primary address corresponds to the VXI logical address and must be between 0 and 255. SICL supports only primary addressing on VXI device sessions. Specifying a secondary address causes an error. Some example addresses for VXI device sessions follow.
These examples use the default symbolic name specified during the system configuration. To change the name listed, you must also change the symbolic name or logical unit specified during the configuration. The name used in your SICL program must match the logical unit or symbolic name specified in the system configuration. Other possible interface names are VXI
, vxi
, etc.
iscpi,32 |
A register-based device address corresponding to the device at primary address 32 on the |
vxi,24 |
A device address corresponding to the device at primary address 24 on the vxi interface. |
vxi,128 |
A device address corresponding to the device at primary address 128 on the vxi interface. |
An example of opening a device session with the VXI device at logical address 64 follows.
INST dmm;
dmm = iopen (“vxi,64”);
Programming Directly to Registers
When communicating with register-based devices, you must either send a series of peeks and pokes directly to the device’s registers or use a command interpreter to interpret the high-level SCPI commands. Command interpreters include the iscpi interface, Keysight Command Module, Keysight B-Size Mainframe (built-in Command Module), or Compiled SCPI (C-SCPI).
When sending a series of peeks and pokes to the device’s registers, use the following process. This procedure is only used on register-based devices that are not using the iscpi interface. Note that programming directly to the registers is not supported over LAN.
- Map memory space into your process space.
- Read the register’s contents using i?peek.
- Write to the device registers using i?poke.
- Unmap the memory space.
Mapping Memory Space for Register-Based Devices
When using SICL to communicate directly to the device’s registers, you must map a memory space into the process space by using the SICL imap function:
imap (
id, map_space, pagestart, pagecnt,
suggested
)
;
This function maps space for the interface or device specified by the id parameter. pagestart, pagecnt, and suggested indicate the page number, number of pages, and a suggested starting location respectively. map_space determines the memory location to map the space to.
Due to hardware constraints on given devices or interfaces, not all address spaces may be implemented. In addition, there may be a maximum number of pages that can be simultaneously mapped.
If a request is made that cannot be granted due to hardware constraints, the process will hang until the desired resources become available. To avoid this, use the isetlockwait with the flag parameter set to 0 and thus generate an error instead of waiting for the resources to become available. You may also use the imapinfo function to determine hardware constraints before making an imap call. Some valid map_space choices follow.
Function |
Description |
I_MAP_A16 |
Maps in VXI A16 address space (device or interface sessions, 64K byte pages). |
I_MAP_A24 |
Maps in VXI A24 address space (device or interface sessions, 64K byte pages). |
I_MAP_A32 |
Maps in VXI A32 address space (device or interface sessions, 64K byte pages). |
I_MAP_VXIDEV |
Maps in VXI A16 device registers (device session only, 64 bytes). |
I_MAP_EXTEND |
Maps in VXI device extended memory address space in A24 or A32 address space (device sessions only). |
I_MAP_SHARED |
Maps in VXI A24/A32 memory that is physically located on the computer (sometimes called local shared memory, interface sessions only). |
I_MAP_AM | |
Maps in the specified region (address modifier) of VME address space. See the Mapping Memory Space table below in this topic for more information on this map space argument. |
Some example imap function calls follow.
/* Map to the VXI device vm starting at
pagenumber 0 for 1 page */
base_address = imap (vm, I_MAP_VXIDEV, 0, 1,
NULL);
/* Map to A32 address space (16 Mbytes) */
ptr = imap (id, I_MAP_A32, 0x000, 0x100,
NULL);
/* Map to device’s A24 or A32 extended memory */
ptr=imap (id, I_MAP_EXTEND, 0, 1, 0);
/* Map to computer’s A24 or A32 shared memory */
ptr=imap (id, I_MAP_SHARED, 0, 1, 0);
Use the following table to determine which map-space argument to use with a SICL imap/iunmap function. All accesses through the *_D32 map windows can only be 32-bit transfers. The application software must do a 32-bit assignment to generate the access and only accesses on 32-bit boundaries are allowed. If 8- or 16-bit accesses to the device are also necessary, a normal I_MAP_A16/24/32 map must also be requested.
|
Widths |
VME Data Access Mode |
I_MAP_A16 |
D8,D16 |
Supervisory |
I_MAP_A24 |
D8,D16 |
Supervisory |
I_MAP_A32 |
D8,D16 |
Supervisory |
I_MAP_A16_D32 |
D32 |
Supervisory |
I_MAP_A24_D32 |
D32 |
Supervisory |
I_MAP_A32_D32 |
D32 |
Supervisory |
Reading and Writing Device Registers
When you have mapped the memory space, use the SICL i?peek and i?poke functions to communicate with register-based instruments. With these functions, you need to know which register you want to communicate with and the register’s offset. See the instrument’s user’s manual for a description of the registers and register locations. An example using iwpeek follows
.
id = iopen (“vxi,24”);
addr = imap (id, I_MAP_VXIDEV, 0, 1, 0);
reg_data = iwpeek (addr + 4);
Be sure you use the iunmap function to unmap the memory space when the space is no longer needed. This frees the mapping hardware so it can be used by other processes.
Sample: VXI Register-Based Programming (C)
This sample program opens a communication session with a register-based device connected to the address entered by the user. The program then reads the Id and Device Type registers and prints the register contents.
/* vxirdev.c
The following example prompts the user for an instrument address and then reads the id register and device type register. The contents of the register are displayed.*/
#include <stdio.h>
#include <stdlib.h>
#include <sicl.h>
void main () {
char inst_addr[80];
char *base_addr;
unsigned short id_reg, devtype_reg;
INST id;
/* get instrument address */
puts (“Please enter the logical address of the
register-based instrument, for example,
vxi,24 : \n”);
gets (inst_addr);
/* install error handler */
ionerror (I_ERROR_EXIT);
/* open communication session with instrument
*/
id = iopen (inst_addr);
itimeout (id, 10000);
/* map into user memory space */
base_addr = imap (id, I_MAP_VXIDEV, 0, 1,
NULL);
/* read registers */
id_reg = iwpeek ((unsigned short *)(base_addr
+ 0x00));
devtype_reg = iwpeek ((unsigned short
*)(base_addr + 0x02));
/* print results */
printf (“Instrument at address %s\n”,
inst_addr);
printf “ID Register = 0x%4X\n Device Type
Register = 0x%4X\n”, id_reg, devtype_reg);
/* unmap memory space */
iunmap (id, base_addr, I_MAP_VXIDEV, 0, 1);
/* close session */
iclose (id);}