I-SCPI Windows 95 Implementation Notes: Contents: 1 What is I-SCPI? 1.1 System Requirements 2 Hints and Techniques 2.1 Addressing Rules 2.2 Instrument Initialization 2.3 Instrument Synchronization 2.4 Removing instsrvr(s) 2.5 Using ISCPI, PSCPI and VEE 2.3 3 Register-Based VXI Devices Supported by Interpreted SCPI 1 What is I-SCPI? I-SCPI (Interpreted SCPI) is a TULIP driver for the iscpi interface. I-SCPI was designed to control VXI register based instruments by providing HP Command Module functionality in software. HP Command Modules are found in the E1405 and E1406 C Size Message Based VXI cards, the E1306 B Size Message Based VXI card, as well the E1300 and E1301 B Size Mainframes. Command Modules have software and hardware which allow register based VXI cards to understand SCPI commands. Instead of directly accessing the instrument, a user sends SCPI commands to the HP Command Module to be processed. The Command Module parses the SCPI Commands and does the required register based actions on the selected instrument. Communication between the user and the Command Module is accomplished over HP-IB or RS-232. The HP Command Module provides a multi-tasking environment where each instrument is assigned to an individual task. Each task runs an instance of a particular instrument driver which controls those cards which are associated with the instrument. Each instrument task is in an infinite loop to parsing SCPI commands. All instrument tasks are running in the Command Module. Communication with the user is accomplished using HP-IB or RS-232. The I-SCPI interface duplicates Command Module functionality by creating a separate Windows 95 Task for each instrument that is opened. The instrument process is called an instsrvr (instrument server). These instrument Tasks are running in the Host Computer instead of in the Command Module. The I-SCPI tulip driver maintains communication between the instsrvr and the user's program. The 32-bit program is INSRVR32.EXE. I-SCPI serves as a communication channel between the user and the instrument. This is similar to the function of HP-IB, which serves as a communication channel between the user and the Command Module. I-SCPI serves as a software replacement for the HP Command Module and HP-IB hardware. The instsrvr runs in an infinite loop waiting to parse SCPI commands for that particular instrument. Like the Command Module, only one instrument Task is created per instrument and the instsrvr Task does not terminate when the user's program terminates. Because of this, opening an instrument only ensures communication between between the user's program and the instrument. 1.1 System Requirements I-SCPI requires SICL and EPConnect running the MS Windows 95 environment. I-SCPI is only supported on the EPC-7, EPC-8, and VXLink Computer platforms. 2 Hints and Techniques This section describes some general programming techniques and hints on using I-SCPI under Windows 95. 2.1 Addressing Rules There are several types of addressing in I-SCPI. The simplest follows the following format: iscpi,84 Where iscpi is the symbolic name for the iscpi interface as found in the I_O Configuration and 84 is the logical address of the first register based card. In order for this to work, all register based cards in the instrument must have consecutive logical addresses. For example if a scanning voltmeter contains a E1326 and a E1345, then it could have logical addresses 32 and 33 respectively. I-SCPI tries to create a card set by looking at all consecutive logical addresses starting at the logical address given in the iopen(). After creating a card set (e.g. finding all cards with consecutive logical addresses), I-SCPI asks each instrument driver if it wants these cards. As soons as a driver responds that it wants the cards, then an instsrvr is connected. If no instsrvr exists, then a new instsrvr is started. If the cardset is rejected by all instrument drivers, then a new card set is formed by removing the highest logical address from the previous cardset. The process is repeated until a driver is found or the cardset is empty. A card set can be specified explicitly. This is useful when cards are at non-contiguous logical addresses. This has the form: iscpi:vxi,(32,16) Where iscpi is the symbolic name for the iscpi interface as found in the I_O Configuration, vxi is the symbolic name for the VXI interface as found in the I_O Configuration and 32 and 16 are the logical addresses of the cards. In this case, the automatic rules for creating a cardset are ignored. A driver can be specified explicitly. This has the form: iscpi,62[ESWITCH] Where iscpi is the symbolic name for the iscpi interface as found in the I_O Configuration, 62 is the first contiguous logical address of the instrument, and ESWITCH specified which driver to load. The driver name is case sensitive. The driver name is the base name of the instrument's dynamic link library (DLL). These drivers are found in the \SICL\DRIVERS\ISCPI directory. The most explicit addressing form will explicitly describe both the cardset and the instrument driver to use. This has the form: iscpi[E1326]:vxi,(24,25) Where iscpi is the symbolic name for the iscpi interface, E1326 is the driver to use, vxi is symbolic name for the VXI interface as found in the I_O Configuration, and 24 and 25 specify the logical address(es) in the cardset. Once a card is assigned to an instrument, it can not be assigned to another instrument until the instsrvr for the first instrument is terminated. If a card is in use then the "CARD IN USE BY ANOTHER INSTRUMENT TASK" SICL log message is generated. For example, an E1345 is at logical address 9 and a E1326 Multimeter is at logical address 8. First the E1345 is opened using the switch driver: iscpi,9[ESWITCH]. It would not be possible to open the scanning voltmeter driver that also used the E1345. The following would generate an error: iscpi[E1326]:vxi,(8,9). This occurs because the E1345 is already in use as a switchbox and can not be used as part of the scanning voltmeter. The order of the cards in the cardset is also maintained by I-SCPI. Re-ordering the cardset and attempting to open the same instrument will also generate an error. For example if a cardset consisted of logical addresses (8,9,12). Then trying to open a session to (8,12,9) would generate an error. 2.2 Instrument Initialization A successful iopen() to a I-SCPI instrument only ensures that the instsrvr is running. Because of this, an I-SCPI instrument should be initialized to a known state (e.g. sending a *RST) in order for the instrument to always behave consistently. This is similar to using the Command Module over HP-IB. The iopen() opens the hpib interface to the Command Module. HP-IB serves as the communication channel between the user's program and the instrument. The instrument is not affected by opening the communication channel. Always assume that the instrument is in an unknown state when first opened. Therefore, the instrument should be always be initialized to a known state after being opened. 2.3 Instrument Synchronization I-SCPI was designed to emulate the HP-IB interface and HP Command Module. One characteristic of HP-IB is that successfully sending a SCPI Command does not mean that the instrument has completed execution of that command. This occurs because HP-IB is a communication channel to an instrument and does not necessarily reflect the instrument's state. Usually, the timing inconsistency between when an iwrite() or an iprintf() successfully completes and when the instrument completes the command does not cause a problem. However, sometimes it is necessary to ensure that a command has completed before continuing. There are two methods for accomplishing this goal. One is to query the instrument using "*OPC?". This IEEE 488.2 command will return a 1 when all of the instrument's pending operations are complete, at this point the instrument is ready to parse a new command. The other method involves sending a "*OPC". The command form will cause the OPC Event Bit (Bit 0) in the Standard Event Status Register to be set to 1 when all pending operations are completed. By using the appropriate status commands it is possible to set up an SRQ to occur when the instrument is finished with its command. Determining when an instrument has completed a command is important when two instruments are working together. For example if a switch has to close before a voltage measurement is going to be made, then a *OPC? should be placed after the switch close to insure that it completed before the measurement is taken. iprintf(sw,"CLOS (@100)\n"); /* close the switch */ ipromptf(sw, "*OPC?\n", "%d\n", &opc); /* make sure switch is closed */ ipromptf(vm, "VOLT?\n", "%f\n", &volt); /* take voltage measurement */ 2.4 Removing instsrvr(s) Selecting Start, Shut Down.., "Close all programs and log on as a different user?" will terminate all active instsrvr(s). Any previous state information will be lost. Server tasks may also be killed one at a time using a utility such as Microsoft PVIEW95 in the SDK. 3 Register-Based VXI Devices Supported by Interpreted SCPI This list describes the supported I-SCPI drivers. If you attempt message-based communication with a register-based VXI device for which there is no I-SCPI driver, the SICL iopen call will fail. Driver Name: E132632.DLL Supports Digital Multimeters: E1326B, E1411B. Supports Multiplexers and Switches: (Capable of DMM measurements and multiplexing) E1343A, E1344A, E1345A, E1346A, E1347A, E1351A, E1352A, E1353A, E1355A, E1356A, E1357A, E1358A, E1460A, E1476A. Driver Name: ESWITC32.DLL Supports Multiplexer and Switches: (Stand-alone) E1361A, E1364A, E1366A, E1367A, E1368A, E1369A, E1370A, E1442A, E1463A, E1465A, E1466A, E1467A, E1468A, E1469A, E1472A, E1473A, E1474A, E1475A, E1476A. Driver Name: E133232.DLL Supports Counter: E1332A Driver Name: E133332.DLL Supports Counter: E1333A. Driver Name: DIG_IO32.DLL Supports Digital I/O: E1330B, E1458A. Driver Name: E132832.DLL Supports D/A Converter: E1328A Driver Name: E144632.DLL Supports D/A Converter: E1446A. Driver Name: E134032.DLL Supports Arbitrary Function Generators: E1340A. Driver Name: E141332.DLL Supports A/D Converters: E1413A, E1413B, E1413C, E1313A. Driver Name: E141832.DLL Supports D/A Converter: E1418A Driver Name: E145032.DLL Supports HP 75000 Model D20 Modules: E1450, E1451A, E1452A. Driver Name: E147032.DLL Supports Switch: E1470A Driver Name: E148832.DLL Supports Memory Cards: E1488A. (Note: this driver is not supported on VXLink) Driver Name: MIL15532.DLL Supports HP Distributed Product: MIL-STD-1553B Interface. Driver Name: IRIG32.DLL Supports HP Distributed Product: Bancomm BANC 350 VXI IRIGB Clock/Timer.