Appendix f - sample program, Introduction, Description – KEPCO TMA VXI-27 User Manual

Page 72

Advertising
background image

TMA VXI-27 101602

F-1

APPENDIX F - SAMPLE PROGRAM

F.1

INTRODUCTION

The following program, written in C language, is an example to illustrate communication with the
TMA VXI-27. The program is written for LAB WINDOWS and for that reason some of the I/O
functions are not standard C functions.

In order to communicate through the VXI specific hardware interface (in this case a National
Instruments embedded slot 0 controller) a specific library NI-VXI is used.

The program contains examples of how to communicate to the register level and how to use the
Word Serial Protocol which is supported by the TMA VXI-27.

The TMA VXI-27 supports events as interrupts; the sample program shows how to use the inter-
rupt capabilities of the TMA VXI-27, even though they are not used in the LABVIEW library.

The program, after initializing the VXI library and testing that no interrupt lines are asserted,
finds all TMA VXI-27’s by looking for the manufacturer specific code (3804 hex for KEPCO INC.)
If there is more than one TMA VXI-27 the program will prompt the user to select one, but if there
is only one TMA VXI-27 the program goes on and does the following actions:

• do soft reset using the RESET BIT (bit 0) in control register
• check the PASSED bit
• check protocol register and response register
• execute the READ INTERRUPTERS command
• do BEGIN NORMAL OPERATION command
• send *idn?

F.2

DESCRIPTION

The TMA VXI-27 supports events as interrupts, however these interrupt capabilities are not
used in the LAB VIEW library. The events which are supported are Request True and Request
False. In order to check the interrupt capabilities on all levels from 1 to 7, the assign INTER-
RUPTER LINE command is used to connect the interrupter to level i from 1 to 7. The assign-
ment is verified using the READ INTERRUPTER LINE command. Next, the interrupt on level i is
routed to the signal handler and the signal interrupts are enabled. Now whenever there is a VXI
interrupt on Level i it will be treated as a VXI signal and will be routed and added to the signal
queue.

The program then sets the Event Status Enable and the Service Request Enable mask to a con-
figuration which will generate an event when a wrong command is sent to the TMA VXI-27. By
sending a wrong command *sr we now generate REQT signal which is added to the signal
queue. The WaitForSignal() function, if successful, acknowledges the receipt of the signal.

GetVXIbusStatus is then called to check the signals in the signal queue. If there are signals in
the signal queue, the SignalDeq() function is called to dequeue them. Reading the Event Status
Register generates REQF and resets the cause of the interrupt. REQF generates the interrupt
and the REQF event signal is generated. The end of the program closes the VXI library.

Advertising